public void DoAwardPoints() { if (!canAward) { return; } endTime = timeSystem.GetTimer(); float timeItTook = startTime - endTime; int extraPoints = 0; if (timeItTook <= shortTime) { extraPoints = shortPoints; OnShort.Invoke(standardPoints + extraPoints); } else if (timeItTook <= mediumTime) { extraPoints = mediumPoints; OnMedium.Invoke(standardPoints + extraPoints); } else { extraPoints = longPoints; OnLong.Invoke(standardPoints + extraPoints); } pointSystem.AddPoints(standardPoints + extraPoints); // Restart time startTime = timeSystem.GetTimer(); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "lumberjack1" || other.gameObject.tag == "termite1") { tag = other.gameObject.tag; PointSystem.AddPoints(5); if (PointSystem.points >= 1000) { //Winning scene name, change as needed SceneManager.LoadScene("Win"); } Destroy(other.gameObject); Destroy(gameObject); } }
private void OnCollisionEnter(Collision collision) { if (CheckIfItemMatches(collision))//if the player is carrying the right item, change item to ask for { overlordItemAmount++; StartCoroutine(colorChangeScript.CorrectAnswer());//turn green pointSystem.AddPoints(1); StartCoroutine(BufferTimeBetweenChoosingItems()); spawn.GetComponent <SpawnItems>().RespawnItems();//this is still nulllllll! } else { StartCoroutine(colorChangeScript.WrongAnswer());//if you give the dude the wrong item, he flash red CheckForOverlordChanges(); } playerInventory.ableToCollectThings = true; //set you to be able to collect things again playerInventory.Inventory = PlayerInventory.InventoryState.nothing; //i also need to change the item state back to nothing }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "Missile") { col.gameObject.SetActive(false); hs.DealDamage(1); if (hs.health <= 0) { if (this.gameObject.tag == "repuloCucc") { ps.AddPoints(2); } else if (this.gameObject.tag == "sarga") { ps.AddPoints(4); } else if (this.gameObject.tag == "piros") { ps.AddPoints(5); } else if (this.gameObject.tag == "Enemy") { ps.AddPoints(1); } else if (this.gameObject.tag == "Boss") { ps.AddPoints(25); } this.gameObject.SetActive(false); } } else if (col.gameObject.tag == "Missile2") { col.gameObject.GetComponent <Renderer>().enabled = false; hs.DealDamage(2); if (hs.health <= 0) { if (this.gameObject.tag == "repuloCucc") { ps.AddPoints(2); } else if (this.gameObject.tag == "sarga") { ps.AddPoints(4); } else if (this.gameObject.tag == "piros") { ps.AddPoints(5); } else if (this.gameObject.tag == "Enemy") { ps.AddPoints(1); } else if (this.gameObject.tag == "Boss") { ps.AddPoints(25); PlayerPrefs.SetString("Boss", "Killed"); } this.gameObject.SetActive(false); } } }