public void UpdateGravity(EnemyStates _enemyStates)
 {
     if (_enemyStates.GetState() == (int)EnemyStates.BaddieStates.FallingFromFloor ||
         _enemyStates.GetState() == (int)EnemyStates.BaddieStates.FallingWhileIdle)
     {
         GravityActing();
     }
     ApplyJump();
 }
 void GravityEnemy()
 {
     if (enemyStates.GetState() == (int)EnemyStates.BaddieStates.FallingFromFloor ||
         enemyStates.GetState() == (int)EnemyStates.BaddieStates.FallingWhileIdle ||
         enemyStates.GetState() == (int)EnemyStates.BaddieStates.Jumping ||
         enemyStates.GetState() == (int)EnemyStates.BaddieStates.FallingKnocked)
     {
         enemyJump.UpdateGravity(enemyStates);
     }
 }
 void FlinchDamage()
 {
     if (enemyStates.GetState() == (int)EnemyStates.BaddieStates.Damaged)
     {
         behaviourTimer += Time.deltaTime;
         if (behaviourTimer >= deactivateFlinchingTime)
         {
             enemyStates.SetEvent((int)EnemyStates.BaddieEvents.Recover);
             behaviourTimer = 0;
         }
     }
 }
 void MoveEnemy()
 {
     if (enemyStates.GetState() == (int)EnemyStates.BaddieStates.GoingToPlayer)
     {
         enemyMove.UpdateMovement();
     }
 }
 void MakeEnemyDissappear()
 {
     if (enemyStates.GetState() == (int)EnemyStates.BaddieStates.TKO)
     {
         behaviourTimer += Time.deltaTime;
         if (behaviourTimer >= dissappearTime)
         {
             this.gameObject.SetActive(false);
         }
     }
 }
Ejemplo n.º 6
0
 void TimeAttack()
 {
     if (enemyStates.GetState() == (int)EnemyStates.BaddieStates.AttackingPlayer)
     {
         behaviourTimer += Time.deltaTime;
         if (behaviourTimer >= deactivateAttackTime)
         {
             enemyStates.SetEvent((int)EnemyStates.BaddieEvents.Retreat);
             behaviourTimer = 0;
         }
     }
 }
 void Retreat()
 {
     if (enemyStates.GetState() == (int)EnemyStates.BaddieStates.Retreating)
     {
         behaviourTimer += Time.deltaTime;
         enemyMove.UpdateRetreat();
         if (behaviourTimer >= deactivateRetreatTime)
         {
             enemyStates.SetEvent((int)EnemyStates.BaddieEvents.StopRetreat);
             behaviourTimer = 0;
         }
     }
 }
Ejemplo n.º 8
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "PlayerAttack")
     {
         if (enemyStates.GetState() != (int)EnemyStates.BaddieStates.Damaged &&
             enemyStates.GetState() != (int)EnemyStates.BaddieStates.Falling &&
             enemyStates.GetState() != (int)EnemyStates.BaddieStates.Down)
         {
             this.gameObject.GetComponent <EnemyHealth>().SetHealth(this.gameObject.GetComponent <EnemyHealth>().GetHealth() - PlayerAttack.instance.GetAttackDamage());
             HealthUI.instance.SetEnemyHealthSlider(this.gameObject.GetComponent <EnemyHealth>().maxHealth, this.gameObject.GetComponent <EnemyHealth>().GetHealth());
             HealthUI.instance.SetEnemyName(this.gameObject.name);
         }
         if (PlayerMachines.instance.GetComboMachine().GetState() == (int)PlayerCombo.ComboStates.ThirdPunch ||
             PlayerMachines.instance.GetPlayerStateMachine().GetState() == (int)PlayerStates.States.HeavyPunching ||
             PlayerMachines.instance.GetPlayerStateMachine().GetState() == (int)PlayerStates.States.AirKickIdle ||
             PlayerMachines.instance.GetPlayerStateMachine().GetState() == (int)PlayerStates.States.AirKickLeft ||
             PlayerMachines.instance.GetPlayerStateMachine().GetState() == (int)PlayerStates.States.AirKickRight)
         {
             enemyStates.SetEvent((int)EnemyStates.BaddieEvents.Fall);
             return;
         }
         enemyStates.SetEvent((int)EnemyStates.BaddieEvents.Hit);
     }
 }