Euras

MonsterBase

Jan 31st, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.00 KB | None | 0 0
  1. using UnityEngine;
  2. using System;
  3. using System.Collections.Generic;
  4.  
  5. [RequireComponent(typeof(MonsterName))]
  6. [RequireComponent(typeof(MonsterHealth))]
  7. [RequireComponent(typeof(MonsterLevel))]
  8. [RequireComponent(typeof(MonsterBattle))]
  9. [RequireComponent(typeof(MonsterAttack))]
  10. [RequireComponent(typeof(MonsterDefense))]
  11. [RequireComponent(typeof(MonsterExperience))]
  12. [RequireComponent(typeof(MonsterFollowPlayer))]
  13. public class MonsterBase : MonoBehaviour
  14. {
  15.     public string Name = "changeme";
  16.     public int Health = 100;
  17.     public int CurrentLevel = 0;
  18.     public int LevelsMax = 100;
  19.     public int Attack = 10;
  20.     public int Defense = 10;
  21.     public int Experience = 0;
  22.     public Sprite sprite;
  23.  
  24.     public List<MonsterAbility> MonsterAbilities = new List<MonsterAbility>();
  25.  
  26.     public bool isWild = true;
  27.  
  28.     MonsterBattle attackFunctions;
  29.  
  30.     void Start()
  31.     {
  32.         attackFunctions = GetComponent<MonsterBattle>();
  33.     }
  34.  
  35.     void Update()
  36.     {
  37.         // For debugging purposes
  38.         if (!isWild)
  39.         {
  40.             if (Input.GetKeyDown(KeyCode.Alpha1))
  41.             {
  42.                 attackFunctions.AttackOpponent(transform.gameObject, MonsterAbilities[0]);
  43.                 Debug.Log(MonsterAbilities[0].abilityDescription);
  44.             }
  45.             if (Input.GetKeyDown(KeyCode.Alpha2))
  46.             {
  47.                 attackFunctions.AttackOpponent(transform.gameObject, MonsterAbilities[1]);
  48.                 Debug.Log(MonsterAbilities[1].abilityDescription);
  49.             }
  50.             if (Input.GetKeyDown(KeyCode.Alpha3))
  51.             {
  52.                 attackFunctions.AttackOpponent(transform.gameObject, MonsterAbilities[2]);
  53.                 Debug.Log(MonsterAbilities[2].abilityDescription);
  54.             }
  55.             if (Input.GetKeyDown(KeyCode.Alpha4))
  56.             {
  57.                 attackFunctions.AttackOpponent(transform.gameObject, MonsterAbilities[3]);
  58.                 Debug.Log(MonsterAbilities[3].abilityDescription);
  59.             }
  60.         }        
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment