/// <summary> /// Deals damage to a game character. /// </summary> /// <param name="character">A game character</param> /// <returns>Was the character hit.</returns> private bool Hit(GameCharacter character) { if (character != null && !character.IsDead) { character.TakeDamage(damage); return(true); } return(false); }
/// <summary> /// What happens when enemy hits a shield /// </summary> /// <param name="shield">shield script on the object that is hit</param> //protected virtual void HitShield(Shield shield) //{ // shield.Hit(); // HitType = HitCastType.SHIELD; // Debug.Log("shield hit"); //} /// <summary> /// What happens when enemy hits a character /// </summary> /// <param name="character">GameCharacter script on the object that is hit</param> protected virtual void HitCharacter(GameCharacter character) { character.TakeDamage(Damage); HitType = HitCastType.PLAYER; Debug.Log("character hit"); }