示例#1
0
 public static void OnLoad()
 {
     foreach (RenderableBuilding b in Buildings.Values)
     {
         b.Dispose();
     }
     Buildings.Clear();
     foreach (RenderablePlot p in Plots.Values)
     {
         p.Dispose();
     }
     Plots.Clear();
     foreach (Plot p in Haswell.Controller.City.Grid)
     {
         if (p.Building != null)
         {
             if (p.Building is Road)
             {
                 Buildings[p.Building] = new RenderableRoad((Road)p.Building);
             }
             else
             {
                 Buildings[p.Building] = new RenderableBuilding(p.Building);
             }
         }
         Plots[p] = new RenderablePlot(p);
         Plots[p].Create(SceneMgr, cityNode);
     }
     GameConsole.ActiveInstance.WriteLine("Game Loaded.");
     GuiMgr.AddInfoPopup("Game Loaded.");
 }
示例#2
0
 public void UpdateGUI(float frametime)
 {
     if (CityManager.Initialized)
     {
         GuiMgr.SetCurrentCursorBuilding(this.tempBuilding);
         GuiMgr.Update(frametime);
     }
     GuiMgr.DebugPanel[4] = mouseMode.ToString();
 }
示例#3
0
    protected void Awake()
    {
        _instance = this;

        _TransBack    = _instance.GetBackCamera().transform;
        _TransFront   = _instance.GetFrontCamera().transform;
        _TransCache   = _instance.transform.Find(strCachePath);
        _BackUICamera = _TransBack.GetComponent <UICamera>();
        InvokeRepeating("RefreshPoolQueue", 0.0f, 1.0f);
    }
示例#4
0
        public static void CreateBuildingOnCursor(BuildingConfiguration template)
        {
            RenderableBuilding rb = new RenderableBuilding(template);

            rb.Create(GameMgr.StateMgr.Engine.SceneMgr, cityNode);
            rb.IsVirtual = true;
            GameMgr.SetCursorBuilding(rb);
            GameMgr.SetMouseMode(MouseMode.PlacingBuilding);
            GuiMgr.ShowBuildingPlacementPanel();
        }
示例#5
0
 /// <summary>
 /// Add a new building to the city at the specified coordinates
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 public static void NewBuilding(int x, int y, BuildingConfiguration b)
 {
     if (Initialized)
     {
         try { Haswell.Controller.City.CreateBuilding(x, y, b); }
         catch (BuildingCreationFailedException e)
         {
             GameConsole.ActiveInstance.WriteLine(e.Message);
             GuiMgr.AddInfoPopup(e.Message);
         }
     }
     else
     {
         GameConsole.ActiveInstance.WriteError("Unable to create building, no city initialized!");
     }
 }
示例#6
0
 public static void Load()
 {
     Haswell.Controller.Load();
     GameConsole.ActiveInstance.WriteLine("Loading game...");
     GuiMgr.AddInfoPopup("Loading game...");
 }
示例#7
0
 public static void OnSave()
 {
     GameConsole.ActiveInstance.WriteLine("Game Saved.");
     GuiMgr.AddInfoPopup("Game Saved.");
 }
示例#8
0
    protected void OnDestroy()
    {
        StopAllCoroutines();

        _instance = null;
    }