Created
April 9, 2020 16:08
-
-
Save smkplus/9c9c61bbfb588e2094f91aaaebc206c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| public class CombatComponent : MonoBehaviour | |
| { | |
| public void PlayerAttacksEnemy(Player player, Enemy enemy) | |
| { | |
| if (player != null) | |
| { | |
| enemy?.ReceiveDamage(player.Attack); | |
| } | |
| } | |
| public void EnemyAttacksPlayer(Enemy enemy, Player player) | |
| { | |
| if (enemy != null) | |
| { | |
| player?.ReceiveDamage(enemy.Attack); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment