void PurchaseHumptyDumptySuicide() { if ((currentWoolCost <= GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>().woolTotal) && (currentWoolCost != -1) && GameObject.FindGameObjectWithTag("HumptyDumpty").GetComponent <NPCHumptyDumptyController>().enableSuicide == false) { NPCHumptyDumptyController humptyDumpty = GameObject.FindGameObjectWithTag("HumptyDumpty").GetComponent <NPCHumptyDumptyController>(); humptyDumpty.enableSuicide = true; GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>().woolTotal -= currentWoolCost; } }
void OnTriggerStay2D(Collider2D other) { if (other.tag == "Enemy") { NPCHumptyDumptyController hd = GameObject.FindGameObjectWithTag("HumptyDumpty").GetComponent <NPCHumptyDumptyController>(); if (other.transform.position.x > -3.5f) { hd.sheepTarget = other.transform.position - (new Vector3(3, 0, 0)); } else { hd.sheepTarget = other.transform.position; } hd.isEnemy = true; } }
/////////////////////// Set new stat functions void PurchaseHumptyDumptyFireRate() // Purchase { if ((currentWoolCost <= GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>().woolTotal) && (currentWoolCost != -1)) { NPCHumptyDumptyController humptyDumpty = GameObject.FindGameObjectWithTag("HumptyDumpty").GetComponent <NPCHumptyDumptyController>(); switch (humptyDumpty.maxEggCountdown) { case 2.0f: humptyDumpty.maxEggCountdown = 1.5f; break; case 1.5f: humptyDumpty.maxEggCountdown = 1.0f; break; case 1.0f: break; } GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>().woolTotal -= currentWoolCost; } }