void OnTriggerEnter(Collider other) { if ((curAnim.inAttack || curAnim.inAttack2 || curAnim.inAttack3)) { if (playerI == 0) { if (((collisionLayers & 1 << other.gameObject.layer) != 0)) { if (other.gameObject.GetComponent <ActivateButton>() == null && (other.gameObject.name != "LeafBox")) { if (Physics.Raycast(this.transform.position, tpc.transform.forward, out checkCol, 3f, collisionLayers) && !checkCol.collider.isTrigger && checkCol.normal.y <= 0.1f) { BounceChara(-checkCol.normal, true); } } } if (other.gameObject.name == "LeafBox") { lbo = other.gameObject.GetComponentInParent <LeafBoxObstacle>(); if (tpc.leafNo >= lbo.boxType) { HDRumbleMain.PlayVibrationPreset(playerI, "D06_Thumpp4", 1f, 0, 0.2f); lbo.DestroyBox(); } else { if (lbo.boxType == 5) { if (PlayerPrefs.GetInt("WrongLeafBlockBlack", 0) == 0) { PlayerPrefs.SetInt("WrongLeafBlockBlack", 1); tpc.ps.gameObject.GetComponentInChildren <TextTriggerMain>().SetText(8); } } else { if (PlayerPrefs.GetInt("WrongLeafBlock", 0) == 0) { PlayerPrefs.SetInt("WrongLeafBlock", 1); tpc.ps.gameObject.GetComponentInChildren <TextTriggerMain>().SetText(7); } } lbo.Wrong(); LeafStarKnockback(other.transform.position); } } if (other.gameObject.GetComponent <NPCCage>()) { LeafStarKnockback(other.transform.position); } } if (other.tag == "LeafHit" || other.tag == "TouchActivate") { if (other.gameObject.GetComponentInChildren <Animator>()) { other.gameObject.GetComponentInChildren <Animator>().SetBool("Activate", true); if (other.tag == "LeafHit") { BerrySpawnManager.SpawnABerry(other.transform.position); } } } } }
IEnumerator Killed() { wasKilled = true; Vector3 curScale = this.transform.localScale; if (icodescript) { curScale = icodescript.gameObject.transform.localScale; } for (float k = 0f; k <= 1f; k += (1f / 60f)) { if (icodescript) { icodescript.gameObject.transform.localScale = Vector3.Lerp(curScale, Vector3.one * 0.001f, k); } else { this.transform.localScale = Vector3.Lerp(curScale, Vector3.one * 0.001f, k); } yield return(null); } if (spawnBigBerries) { int total = Random.Range(2, 4); for (int k = 0; k < total; k++) { BerrySpawnManager.SpawnABigBerry(this.transform.position); } } else { if (berriesToSpawn > 0) { for (int k = 0; k < berriesToSpawn; k++) { BerrySpawnManager.SpawnABerry(this.transform.position); } } } if (sound != null) { sound.enabled = true; sound.clip = berryRelease; sound.loop = false; sound.Stop(); sound.PlayDelayed(0f); } foreach (Renderer r in renderers) { r.enabled = false; } yield return(new WaitForSeconds(1f)); if (parentToDisable == null) { if (this.transform.parent.parent != null && this.transform.parent.parent.GetComponent <IActivablePrefab>()) { Destroy(this.transform.parent.parent.gameObject); } else { Destroy(this.transform.parent.gameObject); } } else { Destroy(parentToDisable.gameObject); // parentToDisable.SetActive(false); } }