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"; }
//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); }
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); }