// Use this for initialization void Start() { npc = null; GameObject gameController = GameObject.Find("GameController"); prefabSource = gameController.GetComponent<PrefabSource>(); gatlingControll = transform.GetComponentInChildren<GatlingControll>(); shootNPC = transform.parent.GetComponent<NPCShooter>(); startRotation = transform.rotation; }
void UpdateButtonsCreate(GameObject tower, int x, int y, CPUComputeTimeController controller ) { if(controller.CPUTime<DMGPrice) {GUI.enabled = false;} GUI.skin.label.fontSize = fontSize; GUI.Label(new Rect(x+((int)buttonSize*0.65f),y-buttonSize,buttonSize/2,buttonSize/3),"DMG"); if (GUI.Button(new Rect(x, y-buttonSize, buttonSize, buttonSize), new GUIContent("",("DMGlabel")), customGuiStyle)) { //Increase DMG upgradeComp =tower.GetComponent<NPCShooter>(); if(upgradeComp.HasDamage){ controller.CPUTime -= DMGPrice; upgradeComp.WeaponDamage += 1;} } GUI.enabled = true; if(controller.CPUTime<DMGPrice) {GUI.enabled = false;} GUI.skin.label.fontSize = fontSize; GUI.Label(new Rect(x+buttonSize+((int)buttonSize*0.65f),y-buttonSize,buttonSize/2,buttonSize/3),"RNG"); if (GUI.Button(new Rect(x+buttonSize, y-buttonSize, buttonSize, buttonSize), new GUIContent("",("RNGlabel")), customGuiStyle)) { //increase Range upgradeComp =tower.GetComponent<NPCShooter>(); if(upgradeComp.HasRadius && controller.CPUTime>RangePrice) { controller.CPUTime -= RangePrice; upgradeComp.BiggerRadius(1);} } GUI.enabled = true; if(controller.CPUTime<DMGPrice) {GUI.enabled = false;} GUI.skin.label.fontSize = fontSize; GUI.Label(new Rect(x+buttonSize*2+((int)buttonSize*0.65f),y-buttonSize,buttonSize/2,buttonSize/3),"SPD"); if (GUI.Button(new Rect(x+buttonSize*2, y-buttonSize, buttonSize, buttonSize), new GUIContent("",("SPDlabel")), customGuiStyle)) { //increase Speed upgradeComp =tower.GetComponent<NPCShooter>(); // TODO: Creates an exception if the script hasnt been started! if(upgradeComp.HasDelay && controller.CPUTime>SpeedPrice) { controller.CPUTime -= SpeedPrice; tower.GetComponent<NPCShooter>().Delay /= 1.1f;} } GUI.enabled = true; if(true) {GUI.enabled = false;} GUI.skin.label.fontSize = fontSize; GUI.Label(new Rect(x+buttonSize*3+((int)buttonSize*0.65f),y-buttonSize,buttonSize/2,buttonSize/3),"SLL"); if (GUI.Button(new Rect(x+buttonSize*3, y-buttonSize, buttonSize, buttonSize), new GUIContent("",("SLLlabel")), customGuiStyle)) { //sell tower //controller.CPUTime += tower.GetComponent<TowerCost>().CPUTimeCost; //Destroy(tower); GUI.enabled = true; } }