Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        switch (state)
        {
        case State.PICKING:
            if (tilePicker != null)
            {
                if (tilePicker.IsDone())
                {
                    targetTile = tilePicker.GetResponse();
                    if (targetTile != null)
                    {
                        order.TargetTile = targetTile;
                        //combatant.StartAttackAnimation(targetTile);
                        state = State.ANIMATING;
                        tilePicker.CleanUp();
                        Destroy(tilePicker.gameObject);
                    }
                }
            }
            CheckForBackButton();
            break;

        case State.ANIMATING:
            GameObject objToSpawn = new GameObject("OrderConfirm Action");
            objToSpawn.AddComponent <OrderConfirmation>();
            objToSpawn.GetComponent <OrderConfirmation>().battleStateTracker.previous = this.battleStateTracker;
            objToSpawn.GetComponent <OrderConfirmation>().SetBattleOrder(order);
            this.gameObject.SetActive(false);

            if (!combatant.animating)
            {
                state = State.FINISHED;
            }
            break;

        case State.FINISHED:
            isDone = true;
            battleStateTracker.ResetChain();
            break;
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        switch (state)
        {
        case State.PICKING:
            if (tilePicker != null)
            {
                if (tilePicker.IsDone())
                {
                    destinationTile = tilePicker.GetResponse();
                    if (destinationTile != null)
                    {
                        MapManager map = GameObject.FindGameObjectWithTag("Map").GetComponent <MapManager>();
                        tilePath = map.GetShortestPath(combatant.Tile, destinationTile);
                        state    = State.ANIMATING;
                        tilePicker.CleanUp();
                        Destroy(tilePicker.gameObject);
                        previousHop = tilePath[0];
                        nextHop     = tilePath[0];
                    }
                }
            }
            CheckForBackButton();
            break;

        case State.ANIMATING:
            combatant.animator.SetBool("IsWalking", true);
            WalkToDestination();
            break;

        case State.FINISHED:
            combatant.animator.SetBool("IsWalking", false);
            isDone = true;
            battleStateTracker.ResetChain();
            break;
        }
    }