public void toDead(bool whereFrom) { //Where from //True is from player killing zombie //False is from challenge starting if (whereFrom == true) { //Also adds kill to playerstats if (this.GetComponent <Tracker>() != null) { PlayerStats.Instance.AddMoney(1); } else { PlayerStats.Instance.AddMoney(1); PlayerStats.Instance.AddKill(); } //Drop Money GameObject newMoney = ObjectPool.Instance.GetFirstFreeObject("Money"); newMoney.transform.position = this.transform.position + new Vector3(0.0f, 0.4f, 0.0f); //could call newMoney.GetComponent<Money>().SetRanger(x,y) // if want higher or lower reward newMoney.SetActive(true); } else { //Dont Add money } //Splatter currentState = idleState; if (!ObjectPool.Instance.Kill(this.gameObject)) { Debug.LogError("Error"); Destroy(this.gameObject); } }
void Start() { currentState = idleState; wayPoints = GameObject.FindGameObjectsWithTag("Waypoint"); }