//OnCantMove overrides the abstract function OnCantMove in MovingObject. //It takes a generic parameter T which in the case of Player is a Wall which the player can attack and destroy. protected override void OnCantMove<T>(T component) { Destuctible destuctible = component as Destuctible; destuctible.LoseLife(this.totalStr, this.totalDex, this.totalLuc); //Set the attack trigger of the player's animation controller in order to play the player's attack animation. animator.SetTrigger("playerChop"); }
//OnCantMove is called if Enemy attempts to move into a space occupied by a Player, it overrides the OnCantMove function of MovingObject //and takes a generic parameter T which we use to pass in the component we expect to encounter, in this case Player protected override void OnCantMove <T>(T component) { Destuctible hitPlayer = component as Destuctible; hitPlayer.LoseLife(str, dex, luc); //Set the attack trigger of animator to trigger Enemy attack animation. animator.SetTrigger("enemyAttack"); SoundManager.instance.RandomizeSfx(enemyAttack1, enemyAttack2); }
protected void OnCantMoveSp <T>(T component) { Destuctible hitPlayer = component as Destuctible; hitPlayer.LoseLife(playerDamage); animator.SetTrigger("enemySp"); SoundManager.instance.RandomizeSfx(enemyAttack1, enemyAttack2); }