Example #1
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();
        }
Example #2
0
        private static void CreateBuilding(object sender, BuildingEventArgs e)
        {
            GameConsole.ActiveInstance.WriteLine("Added a building at " + e.Building.Parent.X + ", " + e.Building.Parent.Y);

            RenderableBuilding rb;

            if (e.Building is Road)
            {
                rb = new RenderableRoad((Road)e.Building);
            }
            else
            {
                rb = new RenderableBuilding(e.Building);
            }
            if (!Buildings.ContainsKey(e.Building))
            {
                Buildings.Add(e.Building, rb);
            }

            RenderablePlot rp;

            if (Plots.ContainsKey(e.Building.Parent))
            {
                rp = Plots[e.Building.Parent]; rb.Create(SceneMgr, cityNode);
            }
            else
            {
                rp = new RenderablePlot(e.Building.Parent);
                rp.Create(SceneMgr, cityNode);
                Plots.Add(e.Building.Parent, rp);
            }

            rb.Deleted += (object sender2, EventArgs e2) => {
                Buildings.Remove(e.Building);
            };
        }
Example #3
0
 public void SetCurrentCursorBuilding(RenderableBuilding b)
 {
     bldgPlacePanel.SetRenderBldg(b);
 }