Beispiel #1
0
 /// <summary>
 /// Places the building on the map
 /// </summary>
 public abstract void PlaceBuilding(Engineer e);
Beispiel #2
0
        public override void PlaceBuilding(Engineer e)
        {
            this.state = State.Constructing;
            this.constructedBy = e;
            e.constructing = this;
            this.mesh = Game1.GetInstance().map.collisionMap.PlaceBuilding(this.DefineRectangle());
            Game1.GetInstance().IsMouseVisible = true;

            for (int i = 0; i < p.buildings.Count(); i++)
            {
                Building b = p.buildings.ElementAt(i);
                if (b != this)
                {
                    if (b.type != Type.Resources && b.type != Type.Sentry)
                    {
                        if (b.waypoints.Count() > 0)
                        {
                            Point point = b.waypoints.GetLast();
                            PathfindingProcessor.GetInstance().Push(b, point);
                        }
                    }
                }
            }

            if (Game1.GetInstance().IsMultiplayerGame() &&
                     this.p == Game1.CURRENT_PLAYER)
            {
                Synchronizer.GetInstance().QueueBuilding(this);
            }

            p.resources -= Building.GetCost(this.type);
            resources = CalculateRPS();

            for (int i = 0; i < p.buildings.Count(); i++)
            {
                Building b = p.buildings.ElementAt(i);
                if (b is ResourceGather)
                {
                    ResourceGather rg = (ResourceGather)b;
                    rg.drawRange = false;
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Places the building on the map
 /// </summary>
 public void PlaceBuilding(Engineer e)
 {
     this.state = BuildState.Constructing;
     this.constructedBy = e;
     this.mesh = Game1.GetInstance().collision.PlaceBuilding(this.DefineSelectedRectangle());
 }