Esempio n. 1
0
        public bool Build(GenericBuilding b, bool IsReferenceForBuilding)
        {
            if (Building == null && IsBuildable)
            {
                Building = b;
                this.IsReferenceForBuilding = IsReferenceForBuilding;

                if (Building.Area == new Point(1, 1) && !this.IsReferenceForBuilding)
                {
                    Building.Location = new Rectangle(
                        this.Position.X,
                        ((int)this.TopPolygon.Edges[0].EndVertex.Y - (Building.Texture.Height - (Utils.HeightOfSelectionTexture / 2))),
                        Building.Texture.Width, Building.Texture.Height);
                }
                else if (!this.IsReferenceForBuilding)// if (Building.Area == new Point(2,2))
                {
                    #region clean
                    //Building.Location = new Rectangle(
                    //        this.Position.X - (DrawableCityBlock.BaseWidth / 2),
                    //        ((int)this.TopPolygon.Edges[0].EndVertex.Y - (Building.Texture.Height - Utils.HeightOfSelectionTexture)),
                    //        Building.Texture.Width, Building.Texture.Height);

                    //pra desenhar a partir do bloco mais abaixo

                    //Building.Location = new Rectangle(
                    //        this.Position.X - ((DrawableCityBlock.BaseWidth / 2) * (Building.Area.X - 1)),
                    //        ((int)this.TopPolygon.Edges[0].EndVertex.Y - Utils.HeightOfSelectionTexture * Building.Area.Y),
                    //        Building.Texture.Width, Building.Texture.Height);
                    #endregion

                    //pra desenhar as partir do bloco mais as direita
                    Building.Location = new Rectangle(
                        (int)this.TopPolygon.Edges[3].EndVertex.X - (CityBlock.BaseWidth * Building.Area.X), // + ((DrawableCityBlock.BaseWidth / 2) * (Building.Area.X - 1)),
                        ((int)this.TopPolygon.Edges[0].StartVertex.Y +                                       //(DrawableCityBlock.BaseHeight * (Building.Area.Y))),
                         -Building.Texture.Height),
                        Building.Texture.Width, Building.Texture.Height);
                }

                IsBuildable = false;

                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 public static void CallOnSelectBuilding(GenericBuilding b)
 {
     GameSession.OnSelectBuilding(b);
 }
Esempio n. 3
0
        public bool Build(GenericBuilding b, bool IsReferenceForBuilding)
        {
            if (Building == null && IsBuildable)
            {
                Building = b;
                this.IsReferenceForBuilding = IsReferenceForBuilding;

                if (Building.Area == new Point(1, 1) && !this.IsReferenceForBuilding)
                {
                    Building.Location = new Rectangle(
                            this.Position.X,
                            ((int)this.TopPolygon.Edges[0].EndVertex.Y - (Building.Texture.Height - (Utils.HeightOfSelectionTexture / 2))),
                            Building.Texture.Width, Building.Texture.Height);
                }
                else if (!this.IsReferenceForBuilding)// if (Building.Area == new Point(2,2))
                {
                    #region clean
                    //Building.Location = new Rectangle(
                    //        this.Position.X - (DrawableCityBlock.BaseWidth / 2),
                    //        ((int)this.TopPolygon.Edges[0].EndVertex.Y - (Building.Texture.Height - Utils.HeightOfSelectionTexture)),
                    //        Building.Texture.Width, Building.Texture.Height);

                    //pra desenhar a partir do bloco mais abaixo

                    //Building.Location = new Rectangle(
                    //        this.Position.X - ((DrawableCityBlock.BaseWidth / 2) * (Building.Area.X - 1)),
                    //        ((int)this.TopPolygon.Edges[0].EndVertex.Y - Utils.HeightOfSelectionTexture * Building.Area.Y),
                    //        Building.Texture.Width, Building.Texture.Height);
                    #endregion

                    //pra desenhar as partir do bloco mais as direita
                    Building.Location = new Rectangle(
                            (int)this.TopPolygon.Edges[3].EndVertex.X - (CityBlock.BaseWidth * Building.Area.X),// + ((DrawableCityBlock.BaseWidth / 2) * (Building.Area.X - 1)),
                            ((int)this.TopPolygon.Edges[0].StartVertex.Y + //(DrawableCityBlock.BaseHeight * (Building.Area.Y))),
                            -Building.Texture.Height),
                            Building.Texture.Width, Building.Texture.Height);
                }

                IsBuildable = false;

                return true;
            }
            else
            {
                return false;
            }
        }