示例#1
0
    void FixedUpdate()
    {
        switch (state)
        {
        case State.myTurn:
        {
            if (!firstTime)
            {
                firstTime = true;
                Player.Instance.DetectMap(Player.Instance.detectedMapDis, Player.Instance.index);
            }
            enemyHasAction = false;
            if (Input.GetKey(KeyCode.F7) && !f7KeyUp)
            {
                f7KeyUp = true;
                PlayerData.Instance.currentExp += 100;
            }
            else if (!Input.GetKey(KeyCode.F8) && f7KeyUp)
            {
                f7KeyUp = false;
            }
            if (Input.GetKey(KeyCode.F6) && !f6KeyUp)
            {
                f6KeyUp = true;
                Player.Instance.transform.position = Map.Instance.getNodeAtPoint(bossRoom).getPiece().transform.position;
                Player.Instance.index = new Point(bossRoom.x, bossRoom.y);
                Player.Instance.DetectMap(Player.Instance.detectedMapDis, Player.Instance.index);
            }
            else if (!Input.GetKey(KeyCode.F6) && f6KeyUp)
            {
                f6KeyUp = false;
            }

            if (Input.GetKey(KeyCode.F5) && !f5KeyUp)
            {
                f5KeyUp = true;
                PlayerData.Instance.remainPoint += 3;
            }
            else if (!Input.GetKey(KeyCode.F5) && f5KeyUp)
            {
                f5KeyUp = false;
            }
            break;
        }

        case State.turning:
        {
            game.TurningUpdate();
            break;
        }

        case State.matching:
        {
            game.Match3Update();
            break;
        }

        case State.dropping:
        {
            game.DroppingUpdate();
            break;
        }

        case State.action:
        {
            Player.Instance.ActionUpdate();
            break;
        }

        case State.enemyTurn:
        {
            if (enemyHasAction)
            {
                return;
            }
            enemyHasAction = true;
            if (boss.open)
            {
                boss.EnemyNeedToDO();
            }
            else
            {
                foreach (NormalEnemy enemy in enemys)
                {
                    if (enemy.GetComponent <SpriteRenderer>().color.a >= 1)
                    {
                        enemy.EnemyNeedToDO();
                        if (enemy.moveTimes > mostTimes)
                        {
                            mostTimes = enemy.moveTimes;
                        }
                    }
                }
                treasureChestEnemy.EnemyNeedToDO();
                StartCoroutine(WaitToDo(mostTimes * 0.25f, () => state = State.myTurn));
            }

            break;
        }

        case State.pause:
        {
            break;
        }
        }
    }