コード例 #1
0
 /// <summary>
 /// Have the robot take damage, possibly killing it
 /// </summary>
 /// <param name="damageAmount">The amount of damage to apply</param>
 public void TakeDamage(short damageAmount)
 {
     health -= damageAmount;
     if (health < 1)
     {
         currentState = RobotState.Dying; //TODO: death animations?s
         GameManager.Instance.IncrementKillCount();
         RobotManager.DecrementRobotCount(Index);
         gameObject.SetActive(false);
         FMODUnity.RuntimeManager.PlayOneShot(enemyDeathSound);
     }
     else
     {
         FMODUnity.RuntimeManager.PlayOneShot(enemyDamage);
     }
 }
コード例 #2
0
ファイル: Robot.cs プロジェクト: MAClavell/Technical-Support
 /// <summary>
 /// Have the robot take damage, possibly killing it
 /// </summary>
 /// <param name="damageAmount">The amount of damage to apply</param>
 public void TakeDamage(short damageAmount)
 {
     health -= damageAmount;
     if (health < 1)
     {
         currentState = RobotState.Dying; //TODO: death animations?
         if (!GameManager.Instance.muteSFX)
         {
             audioSource.pitch = DEATH_PITCH;
             audioSource.PlayOneShot(deathSound, DEATH_VOLUME * GameManager.Instance.sfxVolume);
         }
         GameManager.Instance.IncrementKillCount();
         RobotManager.DecrementRobotCount(Index);
         gameObject.SetActive(false);
     }
 }