void OnTriggerEnter(Collider other) { if (!other.isTrigger) { if (other.gameObject.GetComponent <NPCCage>() != null) { other.gameObject.GetComponent <NPCCage>().CageHit(); } else { if (other.gameObject.name != "LeafBox" && other.gameObject.layer == 15) { currentEnemy = other.gameObject.GetComponent <EnemyHP>(); if (currentEnemy != null && currentEnemy.isDark && !currentEnemy.invincible) { currentEnemy.health -= 100; if (currentEnemy.health <= 0 && !currentEnemy.infiniteHealth) { currentEnemy.Death(); } else { currentEnemy.BeenHit(true, -1); } } // BurstDrop(); } else { if (other.gameObject.name != "LeafBox" && Physics.Raycast(this.transform.position, -Vector3.up, out groundHit, 2f, whatIsCollidable) && groundHit.normal.y >= 0.75f) { } else { lbo = other.gameObject.GetComponentInParent <LeafBoxObstacle>(); if (lbo != null) { // BurstDrop(); if (lbo.boxType == 5) { lbo.DestroyBox(); } else { lbo.Wrong(); PlayerManager.GetMainPlayer().PlayBlockStar(); } } } } } BurstDrop(); } }
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); } } } } }