public override void OnInspectorGUI() //This is all just a fancy way to make a button to trigger "Recalculate"
 {
     DrawDefaultInspector();
     myStatSystem = (PlayerStatsSystem)target;
     GUILayout.BeginVertical();
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Recalculate Stats", GUILayout.MaxWidth(200), GUILayout.Height(50)))
     {
         Recalculate();
     }
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }
Пример #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance          = this;
         playerLevel       = player.GetComponent <PlayerLevel>();
         playerStatsSystem = player.GetComponent <PlayerStatsSystem>();
         Item[] allitems = Resources.FindObjectsOfTypeAll <Item>();
         itemDict = new Dictionary <string, Item>();
         foreach (Item item in allitems)
         {
             itemDict.Add(item.name, item);
         }
     }
     else
     {
         Destroy(this);
     }
 }