Esempio n. 1
0
        public bool _BuildTowerDragNDrop(UnitTower tower)
        {
            if (tower.type == _TowerType.Resource && !GameControl.IsGameStarted())
            {
                return(false);
                // "Cant Build Tower before spawn start";
            }

            UnitTower sampleTower = GetSampleTower(tower);
            int       cost        = sampleTower.GetCost();

            bool isSuffCost = ResourceManager.HasSufficientResource(cost);

            if (isSuffCost == true)
            {
                sampleTower.thisObj.SetActive(true);
                _ShowPlatform(true);
                GameControl.SelectTower(sampleTower);
                UnitTower towerInstance = sampleTower;
                towerInstance.StartCoroutine(towerInstance.DragNDropRoutine());
                return(true);
            }

            return(false);
            //"Insufficient Resource";
        }
Esempio n. 2
0
        //called when a tower building is initated in DragNDrop, use the sample tower as the model and set it in DragNDrop mode
        public string StartDragNDrop(int ID, int pointerID = -1)
        {
            UnitTower sampleTower = GetSampleTower(ID);

            if (sampleTower.type == _TowerType.Resource && !GameControl.IsGameStarted())
            {
                return("Cant Build Tower before spawn start");
            }

            IndicatorControl.SetDragNDropPhase(true);

            List <int> cost     = sampleTower.GetCost();
            int        suffCost = ResourceManager.HasSufficientResource(cost);

            if (suffCost == -1)
            {
                sampleTower.thisT.position = new Vector3(9999, 9999, 9999);
                sampleTower.thisObj.SetActive(true);

                UnitTower towerInstance = sampleTower;

                towerInstance.StartCoroutine(towerInstance.DragNDropRoutine(pointerID));

                return("");
            }

            return("Insufficient Resource   " + suffCost);
        }
Esempio n. 3
0
        public string _BuildTowerDragNDrop(UnitTower tower)
        {
            UnitTower  sampleTower = GetSampleTower(tower);
            List <int> cost        = sampleTower.GetCost();

            int suffCost = ResourceManager.HasSufficientResource(cost);

            if (suffCost == -1)
            {
                sampleTower.thisObj.SetActive(true);
                GameControl.SelectTower(sampleTower);
                UnitTower towerInstance = sampleTower;
                towerInstance.StartCoroutine(towerInstance.DragNDropRoutine());

                return("");
            }

            return("Insufficient Resource   " + suffCost);
        }