void BuildTurret() { GameObject tempAlert = GameObject.FindGameObjectsWithTag("AlertSys") [0]; AlertScript flag = (AlertScript)tempAlert.GetComponent(typeof(AlertScript)); if (gm.credits - 25f >= 0) { string[] splitter = this.gameObject.name.Split(','); if (!isWall) { Game.addWall(int.Parse(splitter [0]), int.Parse(splitter [1])); isWall = true; //this.GetComponent<Renderer> ().material.color = Color.green; this.GetComponent <SpriteRenderer> ().sprite = bottle; this.GetComponent <SpriteRenderer> ().color = Color.white; this.gameObject.AddComponent <TurretBehavior> (); gm.credits = gm.credits - 25f; } } else { flag.AlertCall("NoFunds"); print("No Funds Tried To Call"); } }
void BuildWall() { GameObject tempAlert = GameObject.FindGameObjectsWithTag("AlertSys") [0]; AlertScript flag = (AlertScript)tempAlert.GetComponent(typeof(AlertScript)); if (gm.credits - 10f >= 0) { string[] splitter = this.gameObject.name.Split(','); if (!isWall) { Game.addWall(int.Parse(splitter [0]), int.Parse(splitter [1])); isWall = true; this.GetComponent <SpriteRenderer> ().color = Color.gray; gm.credits = gm.credits - 10f; } } else { flag.AlertCall("NoFunds"); print("No Funds Tried To Call"); } }
private void BuildBomb() { GameObject tempAlert = GameObject.FindGameObjectsWithTag("AlertSys") [0]; AlertScript flag = (AlertScript)tempAlert.GetComponent(typeof(AlertScript)); if (gm.credits - 50f >= 0) { string[] splitter = this.gameObject.name.Split(','); if (!isWall) { this.gameObject.AddComponent <BombBehavior> (); isWall = true; this.GetComponent <SpriteRenderer> ().sprite = yarn; this.GetComponent <SpriteRenderer> ().color = Color.white; //this.GetComponent<Renderer> ().material.color = Color.yellow; gm.credits = gm.credits - 50f; } } else { flag.AlertCall("NoFunds"); print("No Funds Tried To Call"); } }