Exemplo n.º 1
0
 public bool IsDie()
 {
     return(hp.IsDie());
 }
Exemplo n.º 2
0
    void UpdateState()
    {
        switch (state)
        {
        case State.WAITING_USER_INPUT:
            break;

        case State.PLAYER_ATTACK:
            if (playerAttackRemaining.IsFinished())
            {
                ChangeState(State.WAITING_ALL_PLAYER_ATTACKS_END);
            }
            break;

        case State.WAITING_ALL_PLAYER_ATTACKS_END:
            if (!dropLane.IsThereMovingDrop())
            {
                playerAttackEffectRemainingTime -= Time.deltaTime;
            }
            if (playerAttackEffectRemainingTime <= 0)
            {
                ChangeState(State.ENEMY_DAMAGING);
            }
            break;

        case State.ENEMY_DAMAGING:
            enemyDamagingRemainingTime -= Time.deltaTime;

            if (enemyDamagingRemainingTime <= tryangleAttackTiming && !tryangleAttackStartEffected)
            {
                SEPlayer.Play(SE.Name.ATTACK, 0.65f);
                tryangleAttackStartEffected = true;
                TryangleEffect.Effect(4);
                TryangleEffect.Attack();
            }
            if (enemyDamagingRemainingTime <= circleAttackTiming && !circleAttackStartEffected)
            {
                SEPlayer.Play(SE.Name.ATTACK, 0.65f);
                circleAttackStartEffected = true;
                CircleEffect.Effect(4);
                CircleEffect.Attack();
            }
            if (enemyDamagingRemainingTime <= crossAttackTiming && !crossAttackStartEffected)
            {
                SEPlayer.Play(SE.Name.ATTACK, 0.65f);
                crossAttackStartEffected = true;
                CrossEffect.Effect(4);
                CrossEffect.Attack();
            }

            if (enemyDamagingRemainingTime <= tryangleAttackTiming - 1f && !enemyDamagedTryangle)
            {
                enemyDamagedTryangle = true;
                TryangleAttackEffect.EffectIn(4, enemyManager.TargetX() + Random.Range(-20f, 20f));
                enemyManager.Damaged(GetPower(2), tDrop.Type.Tryangle);
            }
            if (enemyDamagingRemainingTime <= circleAttackTiming - 1f && !enemyDamagedCircle)
            {
                enemyDamagedCircle = true;
                CircleAttackEffect.EffectIn(4, enemyManager.TargetX() + Random.Range(30f, enemyManager.TargetRange()));
                enemyManager.Damaged(GetPower(1), tDrop.Type.Circle);
            }
            if (enemyDamagingRemainingTime <= crossAttackTiming - 1f && !enemyDamagedCross)
            {
                enemyDamagedCross = true;
                CrossAttackEffect.EffectIn(4, enemyManager.TargetX() - Random.Range(30f, enemyManager.TargetRange()));
                enemyManager.Damaged(GetPower(0), tDrop.Type.Cross);
            }

            if (enemyDamagingRemainingTime <= 0)
            {
                if (enemyManager.CheckAllDie())
                {
                    ChangeState(State.NEXT_WAVE);
                }
                else
                {
                    ChangeState(State.ENEMY_ATTACK);
                }
            }
            break;

        case State.ENEMY_ATTACK:
            enemyAttackRemainingTime -= Time.deltaTime;
            if (enemyAttackRemainingTime <= 0)
            {
                if (PlayerHP.IsDie())
                {
                    ChangeState(State.GAME_OVER);
                }
                else
                {
                    ChangeState(State.WAITING_USER_INPUT);
                }
            }
            break;

        case State.NEXT_WAVE:
            nextWaveRemainingTime -= Time.deltaTime;
            if (nextWaveRemainingTime <= 1.0f)
            {
                enemyManager.transform.localPosition = new Vector3(0f, enemyManager.transform.localPosition.y + (600f - enemyManager.transform.localPosition.y) * 0.2f, 0f);
            }
            if (nextWaveRemainingTime <= 0)
            {
                enemyManager.transform.localPosition = new Vector3(0f, 600f, 0f);
                ChangeState(State.WAITING_USER_INPUT);
            }
            break;
        }
    }