Example #1
0
        private void Reset()
        {
            reaction = MTools.GetInstance <ModeReaction>("Damaged");
            stats    = this.FindComponent <Stats>();
            Root     = transform.root.GetComponent <MDamageable>(); //Check if there's a Damageable on the Root
            if (Root == this)
            {
                Root = null;
            }

            if (stats == null)
            {
                stats = gameObject.AddComponent <Stats>();

                var health = MTools.GetInstance <StatID>("Health");

                if (health != null)
                {
                    stats.stats = new System.Collections.Generic.List <Stat>();
                    var HealthStat = new Stat()
                    {
                        ID       = health,
                        MaxValue = 100,
                        MinValue = 0,
                        value    = new FloatReference(100)
                    };
                    stats.stats.Add(HealthStat);
                }
            }
        }
Example #2
0
 private void Reset()
 {
     reaction = MTools.GetInstance <ModeReaction>("Damaged");
     stats    = this.FindComponent <Stats>();
     Root     = transform.root.GetComponent <MDamageable>(); //Check if there's a Damageable on the Root
     if (Root == this)
     {
         Root = null;
     }
 }
Example #3
0
        private void AddReaction(Type NewReaction)
        {
            MReaction reaction = (MReaction)CreateInstance(NewReaction);

            // Pull all the information from the target of the serializedObject.
            reactions_List.serializedObject.Update();
            reactions_List.InsertArrayElementAtIndex(0);
            reactions_List.GetArrayElementAtIndex(0).objectReferenceValue = reaction;
            reactions_List.serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(reaction);
            EditorUtility.SetDirty(target);
        }