Esempio n. 1
0
 public void Draw(SpriteBatch sb, Texture2D gridSquareTex)
 {
     if (Building == BuildingType.Concrete && GameManager.BuildState != GameManager.BuildStates.Concrete)
     {
         sb.Draw(ghostImage, rect, ghostCol * highlight);
     }
     if (typeOfSquare.HasFlag(SqrFlags.Concrete))
     {
         sb.Draw(Art.Concrete, rect, ghostCol * highlight);
     }
     if (typeOfSquare.HasFlag(SqrFlags.Concrete) && sqrCoord.counter == GameManager.DEFAULYDIST && Building == BuildingType.Concrete)
     {
         sb.Draw(Art.ConcreteBlocked, rect, ghostCol * highlight);
     }
     if (Building == BuildingType.Trench)
     {
         sb.Draw(Art.getTrenchTex(TrenchName), rect, ghostCol * highlight);
     }
     else if (Building == BuildingType.None)
     {
         sb.Draw(ghostImage, rect, ghostCol * highlight);
     }
     //else if (Building == BuildingType.Base)
     //    sb.Draw(Art.Base, new Rectangle(rect.X, rect.Y, rect.Width*2, rect.Height*2), Color.White);
 }
Esempio n. 2
0
        public void Update()
        {
            ghostImage = Art.GroundTexs;
            ghostCol   = Color.White;
            sqrEdited  = false;

            if (Input.WasLMBClicked)
            {
                canClick = true;
            }

            if (!sqrCoord.CoordEqual(GameManager.STARTPOINT))
            {
                if (rect.Contains(Input.MousePosition.ToPoint()))
                {
                    GameManager.mouseSqrCoords = new Coordinates(sqrCoord.x, sqrCoord.y);

                    if (GridManager.HasNeighbour(BuildingType.Trench, sqrCoord))
                    {
                        if (Building == BuildingType.None && GameManager.BuildState == GameManager.BuildStates.Trench)
                        {
                            ghostImage = Art.getTrenchTex(GameManager.grid.sqrTexDecider((int)sqrCoord.x, (int)sqrCoord.y));
                        }

                        if (Input.LMBDown && canClick && Building != BuildingType.Tower && Building != BuildingType.Trench && !WaveManager.WaveStarted)
                        {
                            BuildManager.Build();
                            sqrEdited = true;
                        }
                    }

                    if (Input.WasLMBClicked && (GameManager.BuildState == GameManager.BuildStates.Upgrade || GameManager.BuildState == GameManager.BuildStates.Destroy) && !WaveManager.WaveStarted)
                    {
                        BuildManager.Build();
                    }

                    highlight = 0.5f;
                }

                else
                {
                    highlight = 1;
                }
            }
        }
Esempio n. 3
0
 public void Draw(SpriteBatch sb, Texture2D gridSquareTex)
 {
     if (Building == BuildingType.Concrete && GameManager.BuildState != GameManager.BuildStates.Concrete)
     {
         sb.Draw(ghostImage, rect, ghostCol * highlight);
     }
     if (typeOfSquare.HasFlag(SqrFlags.Concrete))
     {
         sb.Draw(Art.Concrete, rect, ghostCol * highlight);
     }
     if (Building == BuildingType.Trench)
     {
         sb.Draw(Art.getTrenchTex(TrenchName), rect, ghostCol * highlight);
     }
     else if (Building == BuildingType.None)
     {
         sb.Draw(ghostImage, rect, ghostCol * highlight);
     }
     else if (Building == BuildingType.Base)
     {
         sb.Draw(gridSquareTex, rect, Color.Red * highlight);
     }
 }
Esempio n. 4
0
        public void Update()
        {
            ghostImage = Art.GroundTexs;
            ghostCol   = Color.White;
            sqrEdited  = false;

            if (Input.WasLMBClicked)
            {
                canClick = true;
            }

            if (sqrCoord.counter == GameManager.DEFAULYDIST)
            {
                ghostImage = Art.BlockedSquare;
                squareInfo = "A blocked of square, solve this problem by building a trench or a tower here!";
            }

            if (Building != BuildingType.Base)
            {
                if (!QuestionPopUpManager.QuestionUp)
                {
                    if (!sqrCoord.CoordEqual(GameManager.STARTPOINT))
                    {
                        if (rect.Contains(Input.MousePosition.ToPoint()))
                        {
                            if (GameManager.HelpMode)
                            {
                                if (!HelpDialogManager.Hovering)
                                {
                                    HelpDialogManager.Hovering = true;
                                }
                            }

                            GameManager.mouseSqrCoords = new Coordinates(sqrCoord.x, sqrCoord.y);

                            if (Building == BuildingType.None && GameManager.BuildState == GameManager.BuildStates.Trench)
                            {
                                ghostImage = Art.getTrenchTex(GameManager.grid.sqrTexDecider((int)sqrCoord.x, (int)sqrCoord.y));
                                squareInfo = "A grass patch, build a trench here or concrete for tower foundations!";
                            }

                            if (Building == BuildingType.Concrete)
                            {
                                squareInfo = "Build a tower on this concrete!";
                            }

                            if (Building == BuildingType.Trench)
                            {
                                squareInfo = "A trench";
                            }

                            if (Building == BuildingType.Tower)
                            {
                                squareInfo = "A tower";
                            }

                            if (Input.WasLMBClicked && canClick && !WaveManager.WaveStarted)
                            {
                                BuildManager.Build();
                                sqrEdited = true;
                            }


                            if (GameManager.HelpMode)
                            {
                                HelpDialogManager.Add(new HelpDialog(squareInfo, Input.MousePosition));
                            }

                            highlight = 0.5f;
                        }

                        else
                        {
                            highlight = 1;
                        }
                    }
                }

                else
                {
                    highlight = 1;
                }
            }
        }