コード例 #1
0
    void Monster_attack_States()
    {
        if (MonsterAttack)
        {
            switch (state)
            {
            case State.Attack:
                monster_base.SetMonsterAttack();
                timer += Time.deltaTime;
                if (timer >= 1.7f)
                {
                    timer         = 0;
                    state         = State.Turning;
                    reached_enemy = false;
                }
                break;

            case State.Turning:
                monster_controller.Backwards_Movement();
                if (monsterf)
                {
                    state = State.Busy;
                }
                break;

            case State.Busy:

                if (monsterf)
                {
                    monster_base.SetMonsterWait();
                    MonsterAttackEnded = true;
                    MonsterAttack      = false;
                    monsterf           = false;
                }
                break;

            case State.Marching:
                monster_controller.Forward_Movement();
                marching_Player = true;
                if (reached_enemy)
                {
                    state = State.Attack;
                }
                break;
            }
        }
    }