Advertisement
3darkman

RPG Classes Sample

Apr 2nd, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. public class Player : MonoBehaviour {
  2.     public int basicAttackValue = 5;
  3.     public int basicLifeValue = 50;
  4.     public int basicDefenseValue = 5;
  5.     public Weapon currentWeapon;
  6.  
  7.     public int AttackValue {
  8.         get
  9.         {
  10.             int value = basicAttackValue;
  11.             if (currentWeapon != null) {
  12.                 value += currentWeapon.attackValueModifier;
  13.             }
  14.             return value;
  15.         }  
  16.     }
  17. }
  18.  
  19. public abstract class Equipment {
  20.     public string name;
  21. }
  22.  
  23. public class Weapon : Equipment {
  24.     public int attackValueModifier;
  25. }
  26.  
  27. public class LongSword : Weapon {
  28.     public LongSword {
  29.         attackValueModifier = 10;
  30.         name = "Long Sword";
  31.     }  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement