Exemplo n.º 1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            SceneManager.LoadScene(0);
        }

        if ((Input.GetMouseButton(0) || Input.touchCount > 0) && ControlledBox == null)
        {
            Vector3 CursorLocation = InputRaycastPlaneSingletone.GetCursorWorldLocation();

            int Layer = LayerMask.NameToLayer("Boxes");

            Collider2D Target = Physics2D.OverlapPoint(CursorLocation, 1 << Layer);

            if (Target != null)
            {
                CatchBox(Target.gameObject);
            }
        }
        else if (ControlledBox != null && (!Input.GetMouseButton(0)) && !(Input.touchCount > 0))
        {
            FreeBox();
        }
        if (ControlledBoxStats != null)
        {
            if (ControlledBoxStats.State.State == BoxState.Losted)
            {
                FreeBox();
            }
        }
    }
Exemplo n.º 2
0
 void Update()
 {
     transform.position = InputRaycastPlaneSingletone.GetCursorWorldLocation();
 }