示例#1
0
文件: UI.cs 项目: hanzemeng/GameSqur
    void Update()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            SceneManager.LoadScene("LevelSelect");
        }
        else if (Input.GetKeyDown("e"))
        {
            Cancel();
            CurrentTurn++;
            ObjectReference.Turn.text = CurrentTurn.ToString();
            UnitManage.UpdateEvent();
            UpdateFog();
            AI.AIMove();
        }
        else if (Input.GetKeyDown("q"))
        {
            FindUnit();
        }

        if (Input.GetMouseButton(1))
        {
            Cursor.SetCursor(ResourceFile.DragCursor, Vector2.zero, CursorMode.ForceSoftware);
            DragScreen();
            Cancel();
        }
        else if (Input.GetMouseButtonUp(1))
        {
            Cursor.SetCursor(null, Vector2.zero, CursorMode.ForceSoftware);
            Check = false;
        }

        if (MoveMode)
        {
            PathFinding.ClearRoute(Route);
            if (Physics.Raycast(ObjectReference.Camera.GetComponent <Camera>().ScreenToWorldPoint(Input.mousePosition), Vector3.forward, out Hit, 11))
            {
                int MouseX = Hit.transform.parent.GetComponent <Tile>().XCor;
                int MouseY = Hit.transform.parent.GetComponent <Tile>().YCor;
                Route = PathFinding.FindPath(Selected.transform.parent.gameObject, Selected.transform.parent.gameObject, Tool.GetTile(MouseX, MouseY));
                PathFinding.DrawRoute(Route);
            }
        }
    }