本文整理汇总了C#中Machine.CanMoveToOrigin方法的典型用法代码示例。如果您正苦于以下问题:C# Machine.CanMoveToOrigin方法的具体用法?C# Machine.CanMoveToOrigin怎么用?C# Machine.CanMoveToOrigin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Machine
的用法示例。
在下文中一共展示了Machine.CanMoveToOrigin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
public void Display(Machine machine)
{
if(machine == null)
{
gameObject.SetActive(false);
return;
}
else if(Input.GetMouseButtonDown(1))
{
SimulationView.Instance.CarriedMachine = null;
return;
}
else
{
gameObject.SetActive(true);
}
Vector3 pos = InputManager.InputWorldPos;
pos.z = ZLayer.Machine + ZLayer.CarriedOffset;
transform.position = pos;
if(transform.position.x >= swapX)
{
//check if could drop machine on floorspace
Vector2i targetOrigin = new Vector2i(FloorView.WorldToFloorPoint(pos));
if (machine.CanMoveToOrigin(targetOrigin))
{
//snap display to that space
Vector3 snapPos = FloorView.FloorToWorldPoint(targetOrigin, FloorViewSpace.TileCenter);
snapPos.z = ZLayer.Machine + ZLayer.CarriedOffset;
transform.position = snapPos;
if (Input.GetMouseButtonUp(0))
{
machine.AddToFloor(targetOrigin);
SimulationView.Instance.CarriedMachine = null; //Causes refresh of display, early out!
return;
}
}
//set large display active
largeDisplay.gameObject.SetActive(true);
largeDisplay.Display(machine);
smallDisplay.gameObject.SetActive(false);
}
else
{
//set small display active
smallDisplay.gameObject.SetActive(true);
smallDisplay.Display(machine);
largeDisplay.gameObject.SetActive(false);
}
}