Ejemplo n.º 1
0
        void RenderNewGameUnitArea()
        {
            EditorGUILayout.BeginHorizontal();

            newGameUnitKey = EditorGUILayout.TextField(newGameUnitKey);
            newGameUnit = EditorGUILayout.ObjectField(newGameUnit, typeof(GameUnit), false) as GameUnit;
            if (GUILayout.Button("Add") && newGameUnit != null && !string.IsNullOrEmpty(newGameUnitKey))
            {
                if (!GameEntities.GetInstance().Units.ContainsKey(newGameUnitKey) && !GameEntities.GetInstance().Units.ContainsValue(newGameUnit))
                {
                    GameEntities.GetInstance().Units.Add(newGameUnitKey, newGameUnit);
                }
            }

            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 2
0
 /// <summary> Registers a unit type to the global collection of unit types so that it can be instantiated elsewhere in the game. </summary>
 /// <param name="name">the unique name ID for the unit type</param>
 /// <param name="unit">the unit</param>
 public static void AddUnit(string name, GameUnit unit)
 {
     instance.Units.Add(name, unit);
 }