Exemplo n.º 1
0
        // Create a GameObject in the map by data in the passed Map.Unit
        public UI.MapUnitUI GetGameObjectClone(Map.Unit mapUnit)
        {
            if (!prefabs.ContainsKey(mapUnit.CoreUnit.Type.ToString()))
            {
                Debug.Log("Warning! No GameObject was generated because of type error!");
                return(null);
            }
            GameObject clonedGameObject = GameObject.Instantiate(prefabs[mapUnit.CoreUnit.Type.ToString()] as GameObject, mapUnit.Position, mapUnit.Rotation);
            MapUnitUI  clonedMapUnitUI  = clonedGameObject.AddComponent <MapUnitUI>();

            clonedMapUnitUI.SendMessage("SetMapUnit", mapUnit, SendMessageOptions.RequireReceiver);
            return(clonedMapUnitUI);
        }
Exemplo n.º 2
0
 // Add Map.Unit to this script
 public void SetMapUnit(Map.Unit mapUnit)
 {
     this.mapUnit = mapUnit;
 }