Example #1
0
        /// <summary>
        /// Updates this instance of the builder
        /// tower building is done here
        /// </summary>
        /// <param name="mousex">mouse x position</param>
        /// <param name="mousey">mouse y position</param>
        public static void Update(int mousex, int mousey)
        {
            Tower newtower;


            switch (towertype)
            {
            case "normal":
                if (NormalTower.Unlocked && isValidLoc_NormalTower(mousex, mousey))
                {
                    newtower = new NormalTower(mousex, mousey, UICreator.CurrentColor);
                    cliamLocation_NormalTower(mousex, mousey);
                    holdingTower = false;
                    TowerHeld.Kill();
                    TowerDefenseManager.TDLayers[TowerDefenseManager.numLayers - 1].RemoveEntity(TowerHeld);
                    TowerHeld = null;
                }
                break;

            case "fast":
                if (FastTower.Unlocked && isValidLoc_NormalTower(mousex, mousey))
                {
                    newtower = new FastTower(mousex, mousey, UICreator.CurrentColor);
                    cliamLocation_NormalTower(mousex, mousey);
                    holdingTower = false;
                    TowerHeld.Kill();
                    TowerDefenseManager.TDLayers[TowerDefenseManager.numLayers - 1].RemoveEntity(TowerHeld);
                    TowerHeld = null;
                }
                break;

            case "strong":
                if (StrongTower.Unlocked && isValidLoc_NormalTower(mousex, mousey))
                {
                    newtower = new StrongTower(mousex, mousey, UICreator.CurrentColor);
                    cliamLocation_NormalTower(mousex, mousey);
                    holdingTower = false;
                    TowerHeld.Kill();
                    TowerDefenseManager.TDLayers[TowerDefenseManager.numLayers - 1].RemoveEntity(TowerHeld);
                    TowerHeld = null;
                }
                break;

            case "spray":
                if (SprayTower.Unlocked && isValidLoc_NormalTower(mousex, mousey))
                {
                    newtower = new SprayTower(mousex, mousey, UICreator.CurrentColor);
                    cliamLocation_NormalTower(mousex, mousey);
                    holdingTower = false;
                    TowerHeld.Kill();
                    TowerDefenseManager.TDLayers[TowerDefenseManager.numLayers - 1].RemoveEntity(TowerHeld);
                    TowerHeld = null;
                }
                break;
            }
        }
Example #2
0
        /// <summary>
        /// Updates this instance of the builder
        /// tower building is done here
        /// </summary>
        /// <param name="mousex">mouse x position</param>
        /// <param name="mousey">mouse y position</param>
        public static void Update(int mousex, int mousey)
        {
            Tower newtower;

            switch (towertype)
            {
                case "normal":
                    if(NormalTower.Unlocked && isValidLoc_NormalTower(mousex, mousey))
                    {
                        newtower = new NormalTower(mousex, mousey, UICreator.CurrentColor);
                        cliamLocation_NormalTower(mousex, mousey);
                        holdingTower = false;
                        TowerHeld.Kill();
                        TowerDefenseManager.TDLayers[TowerDefenseManager.numLayers - 1].RemoveEntity(TowerHeld);
                        TowerHeld = null;
                    }
                    break;
                case "fast":
                    if (FastTower.Unlocked  && isValidLoc_NormalTower(mousex, mousey))
                    {
                        newtower = new FastTower(mousex, mousey, UICreator.CurrentColor);
                        cliamLocation_NormalTower(mousex, mousey);
                        holdingTower = false;
                        TowerHeld.Kill();
                        TowerDefenseManager.TDLayers[TowerDefenseManager.numLayers - 1].RemoveEntity(TowerHeld);
                        TowerHeld = null;
                    }
                    break;

                case "strong":
                    if (StrongTower.Unlocked  && isValidLoc_NormalTower(mousex, mousey))
                    {
                        newtower = new StrongTower(mousex, mousey, UICreator.CurrentColor);
                        cliamLocation_NormalTower(mousex, mousey);
                        holdingTower = false;
                        TowerHeld.Kill();
                        TowerDefenseManager.TDLayers[TowerDefenseManager.numLayers - 1].RemoveEntity(TowerHeld);
                        TowerHeld = null;
                    }
                    break;

                case "spray":
                    if (SprayTower.Unlocked  && isValidLoc_NormalTower(mousex, mousey))
                    {
                        newtower = new SprayTower(mousex, mousey, UICreator.CurrentColor);
                        cliamLocation_NormalTower(mousex, mousey);
                        holdingTower = false;
                        TowerHeld.Kill();
                        TowerDefenseManager.TDLayers[TowerDefenseManager.numLayers - 1].RemoveEntity(TowerHeld);
                        TowerHeld = null;
                    }
                    break;
            }
        }