Exemple #1
0
 void CheckActions()
 {
     if (CloseEnough() && !IsStunned())
     {
         if (!attackCooldown)
         {
             attackCooldown      = true;
             attackCooldownTimer = DateTime.Now;
             GetComponent <Animator>().SetTrigger("Attack");
             clips.RandomPitchPlay(clips.bearAttacksSource);
             clips.RandomPitchPlay(clips.catMoansSource);
             attackManager.EnemyAttack(transform.position, direction, damage);
         }
         else
         {
             //Debug.Log(StaticValues.Player.GetComponent<HealthManager>().CheckHealth());
             TimeSpan cooldownTime = DateTime.Now - attackCooldownTimer;
             if (cooldownTime > TimeSpan.FromMilliseconds(attackTime))
             {
                 attackCooldown = false;
             }
         }
     }
 }
Exemple #2
0
 void CheckActions()
 {
     if (inputManager.AttackButton() && !AttackCooldown)
     {
         AttackCooldown      = true;
         AttackCooldownTimer = DateTime.Now;
         clips.RandomPitchPlay(clips.catAttackSource);
         attackManager.PlayerAttack(transform.position, Direction);
     }
     else
     {
         TimeSpan cooldownTime = DateTime.Now - AttackCooldownTimer;
         if (cooldownTime.Milliseconds > attackTime)
         {
             AttackCooldown = false;
         }
     }
 }