public void Equip(ToyFoundation Equipment) { State = State.Equip; StatusesActivate(State); if (Equipment.Gear == Gear.Hands) { Damage -= Hands.Damage; Status.Remove(Hands.Status); Hands = Equipment; Damage += Equipment.Damage; } if (Equipment.Gear == Gear.Head) { Status.Remove(Head.Status); Head = Equipment; } if (Equipment.Gear == Gear.Chest) { Status.Remove(Chest.Status); Chest = Equipment; } if (Equipment.Gear == Gear.Feet) { Status.Remove(Feet.Status); Feet = Equipment; } if (Equipment.Status != null) AddStatus(Equipment.Status); Turn = false; }
public override void OnInspectorGUI() { Creature CreatureGUI = (Creature)target; EditorGUILayout.BeginHorizontal (); CreatureGUI.Name = EditorGUILayout.TextField("Name", CreatureGUI.Name); EditorGUILayout.EndHorizontal (); EditorGUILayout.PropertyField(Health); EditorGUILayout.PropertyField(Damage); EditorGUILayout.PropertyField(Jump); ConfigFoldout = EditorGUILayout.Foldout(ConfigFoldout, "Config"); if (ConfigFoldout) { EditorGUILayout.PropertyField(Player); EditorGUILayout.PropertyField(Storey); EditorGUILayout.PropertyField(Height); EditorGUILayout.PropertyField(AI); } EquipmentFoldout = EditorGUILayout.Foldout(EquipmentFoldout, "Gear"); if (EquipmentFoldout) { EditorGUILayout.ObjectField("Hands",CreatureGUI.Hands,typeof(ToyFoundation),true); EditorGUILayout.ObjectField("Head",CreatureGUI.Head,typeof(ToyFoundation),true); EditorGUILayout.ObjectField("Chest",CreatureGUI.Chest,typeof(ToyFoundation),true); EditorGUILayout.ObjectField("Feet",CreatureGUI.Feet,typeof(ToyFoundation),true); EditorGUILayout.BeginHorizontal (); Equipment = (ToyFoundation)EditorGUILayout.ObjectField("Wear", Equipment,typeof(ToyFoundation),true); if(GUILayout.Button("Yield",GUILayout.Width(45f),GUILayout.Height(14f))) { CreatureGUI.Equip(Equipment); } EditorGUILayout.EndHorizontal (); } EditorGUILayout.PropertyField(Inventory,true); EditorGUILayout.PropertyField(Status,true); serializedObject.ApplyModifiedProperties(); }