示例#1
0
    public void update()
    {
        if (Input.GetMouseButtonDown(0) && Input.touchCount < 2)
        {
            lastMouseDown = Time.time;
        }

        if (selectedMove != null && Game.instance.state == Game.State.GETTING_PLAYER_INPUT && Input.GetMouseButtonDown(0))
        {
            Vector3    pos           = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Vector2Int touchLocation = new Vector2Int(Mathf.FloorToInt(pos.x), Mathf.FloorToInt(pos.y));
            foreach (Vector2Int v in inputChoices)
            {
                if (v == touchLocation)
                {
                    if (selectedMove.isCantrip)
                    {
                        selectedMove.setCastLocation(v);
                        selectedMove.performMove();
                        clearInputChoices();
                    }
                    else
                    {
                        selectedMove.setCastLocation(v);
                        Game.QueueMove(selectedMove);
                        clearInputChoices();
                        Game.finishState(Game.State.GETTING_PLAYER_INPUT);
                    }
                }
            }
        }
    }
示例#2
0
    public virtual void queueMove()
    {
        ShiblitzMove      move          = moves[UnityEngine.Random.Range(0, moves.Count)];
        List <Vector2Int> possibleMoves = move.getCastableLocations(position);

        if (possibleMoves.Count > 0)
        {
            Vector2Int moveLocation = possibleMoves[0];
            foreach (Vector2Int v in possibleMoves)
            {
                if (Vector2Int.Distance(v, Game.getPlayer().position) < Vector2Int.Distance(moveLocation, Game.getPlayer().position))
                {
                    moveLocation = v;
                }
            }
            Game.getDungeonBoard().gui.SetTile((Vector3Int)moveLocation, ShiblitzTile.enemyInputHighlight);
            move.setCastLocation(moveLocation);
            Game.QueueMove(move);
        }
    }