Last active
April 10, 2020 09:18
-
-
Save smkplus/1abf4e67148879f00fb10e2d8e18b7a9 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 System; | |
| using UnityEngine; | |
| public class Warrior : MonoBehaviour | |
| { | |
| public int Armor { get; set; } | |
| public int Life { get; set; } | |
| public virtual void Attack() | |
| { | |
| // Attack to closest enemy | |
| } | |
| public virtual void TakeDamage(int damage) | |
| { | |
| Life -= Math.Max(0, damage - Armor); | |
| } | |
| } | |
| public class Mage : Warrior | |
| { | |
| public int MagicProtection { get; set; } | |
| public override void Attack() | |
| { | |
| // Throw a Fire to target | |
| } | |
| public void Hex() | |
| { | |
| // Convert target to sheep | |
| } | |
| public override void TakeDamage(int damage) | |
| { | |
| Life -= Math.Max(0, damage - Armor - MagicProtection); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment