void OnTriggerEnter2D(Collider2D other) { if (other.tag != "Player" && other.tag != "Collectibles" && other.tag != "LethalHazard" && other.tag != "Platform") { otherRB = other.GetComponent<Rigidbody2D> (); Debug.Log ("not here"); if (other.tag == "Destructable Platform") { Debug.Log ("here"); other.GetComponent<PlatformHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Enemy" && attTimer <= 0) { timer = 0.1f; other.GetComponent<EnemyHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Boss" && attTimer <= 0) { timer = 0.1f; if (sasuke != null) { sasuke.takeDamage(abilityDamage); } else { return; } } if (other.tag == "Boss") { other.GetComponent<BossHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Destroyable") { DestroyObject(other.gameObject); } if(other.GetComponent<EnemyMovement>()) { eMScrp = other.GetComponent<EnemyMovement>(); eMScrp.GetStun(stunTime); } if( other.GetComponent<EnemyAttack>()) { eAScrp = other.GetComponent<EnemyAttack>(); eAScrp.GetStun(stunTime); } if (other.transform.position.x < transform.position.x) { otherRB.velocity = new Vector2 (-10, 2); } else { otherRB.velocity = new Vector2 (10, 2); } } }
void OnTriggerEnter2D(Collider2D other) { if (timeBetweenAttacks <= 0 && (other.tag == "Enemy" || other.tag == "Boss")) { timeBetweenAttacks = 0.2f; Debug.Log("time reseted"); if (other.name != "Player" || other.tag != "Collectibles" || other.tag != "LethalHazard" || other.tag != "Platform") { if (other.GetComponent<Rigidbody2D> () == null) { return; } else { otherRB = other.GetComponent<Rigidbody2D> (); } if (other.tag == "Boss") { if (sasuke != null) { timer = 0; sasuke.takeDamage (1); } else { return; } } if (other.tag == "Destructable Platform") { other.GetComponent<PlatformHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "MysteryBox") { other.GetComponent<MysteryBoxHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Enemy") { Debug.Log("damage deal"); other.GetComponent<EnemyHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "MiniBoss") { other.GetComponent<BossHealthManager> ().takeDamage (abilityDamage); } if (other.GetComponent<EnemyMovement> ()) { eMScrp = other.GetComponent<EnemyMovement> (); eMScrp.GetStun (stunTime); } if (other.GetComponent<EnemyAttack> ()) { eAScrp = other.GetComponent<EnemyAttack> (); eAScrp.GetStun (stunTime); } if (other.transform.position.x < player.transform.position.x) { otherRB.velocity = new Vector2 (-5, 2); } else { otherRB.velocity = new Vector2 (5, 2); } } } //Cleanup //Destroy(gameObject); }
void OnTriggerEnter2D(Collider2D other) { //if (other.name != "Player" || other.tag != "Collectibles" || other.tag != "LethalHazard" || other.tag != "Platform") if(other.GetComponent<Rigidbody2D> () || other.tag == "Obstacle") { otherRB = other.GetComponent<Rigidbody2D> (); if (other.tag == "Boss" && attTimer <=0) { attTimer = 0.1f; sasuke.takeDamage (abilityDamage); } if (other.tag == "Enemy" && attTimer <=0) { attTimer = 0.1f; other.GetComponent<EnemyHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Obstacle") { //Debug.Log("IS GETTING CALLED"); DestroyObject(other.gameObject); } if(other.GetComponent<EnemyMovement>()) { eMScrp = other.GetComponent<EnemyMovement>(); eMScrp.GetStun(stunTime); } if( other.GetComponent<EnemyAttack>()) { eAScrp = other.GetComponent<EnemyAttack>(); eAScrp.GetStun(stunTime); } if(other.tag != "Obstacle"){ if (other.transform.position.x < transform.position.x) { otherRB.velocity = new Vector2 (-18, 2); } else { otherRB.velocity = new Vector2 (18, 2); } } } }
void OnTriggerEnter2D(Collider2D other) { if (!canWallClimb && (other.tag == "Ground" || other.tag == "Platform")) { if (currentCharacter == 2 && afterClimbEffing ) { actualQuake = Instantiate(theQuake); actualQuake.transform.localScale = new Vector3(quakeSize,quakeSize,1); actualQuake.transform.position = transform.position; FromAfterClimbToNormal(); } FromAfterClimbToNormal(); canWallClimb = true; } if (other.tag == "Enemy" && isBackFlipping && bfHitCD <= 0) { bfHitCD = 1; other.GetComponent<EnemyHealthManager>().takeDamage(backFlipDamage); if(other.GetComponent<EnemyMovement>()) { eMScrp = other.GetComponent<EnemyMovement>(); eMScrp.GetStun(shortStun); } if( other.GetComponent<EnemyAttack>()) { eAScrp = other.GetComponent<EnemyAttack>(); eAScrp.GetStun(shortStun); } if (other.transform.position.x < transform.position.x) { other.attachedRigidbody.velocity = new Vector2 (-4, 2); } else { other.attachedRigidbody.velocity = new Vector2 (4, 2); } } //Debug.Log("trying"); if (other.tag == "Boss" && isBackFlipping && bfHitCD <= 0) { bfHitCD = 1; if (sasukeHP != null) { Debug.Log("bH FOR SHO"); sasukeHP.takeDamage(backFlipDamage); if (other.transform.position.x < transform.position.x) { other.attachedRigidbody.velocity = new Vector2 (-4, 2); } else { other.attachedRigidbody.velocity = new Vector2 (4, 2); } } else { return; } } if (other.tag == "Enemy" && isSpringing) { other.GetComponent<EnemyHealthManager>().takeDamage(springDamage); if(other.GetComponent<EnemyMovement>()) { eMScrp = other.GetComponent<EnemyMovement>(); eMScrp.GetStun(shortStun); } if( other.GetComponent<EnemyAttack>()) { eAScrp = other.GetComponent<EnemyAttack>(); eAScrp.GetStun(shortStun); } } if(other.tag == "Enemy" && isGoingSuper && other.name != "Gizmo") { other.GetComponent<EnemyHealthManager>().enemyHP = 0; if( other.GetComponent<EnemyAttack>()) { eAScrp = other.GetComponent<EnemyAttack>(); eAScrp.GetStun(shortStun); } } if (other.tag == "Boss" && isSpinDashing) { if (sasukeHP != null) { Debug.Log("bH FOR SHO"); sasukeHP.takeDamage(spinDashDamage); other.attachedRigidbody.velocity = new Vector2 (0, 8); } } if(other.tag == "Enemy" && isSpinDashing) { other.GetComponent<EnemyHealthManager>().takeDamage(spinDashDamage); if(other.GetComponent<EnemyMovement>()) { eMScrp = other.GetComponent<EnemyMovement>(); eMScrp.GetStun(shortStun); } if( other.GetComponent<EnemyAttack>()) { eAScrp = other.GetComponent<EnemyAttack>(); eAScrp.GetStun(shortStun); } other.attachedRigidbody.velocity = new Vector2 (0, 8); } if(other.tag == "Obstacle" && isSpinDashing) { disableInput = false; isSpinDashing = false; rb2D.velocity = new Vector2(0.0f, rb2D.velocity.y); } if(currentCharacter == 3 && !isGrounded) { if(other.tag == "Enemy") { other.GetComponent<EnemyHealthManager>().takeDamage(sonicJumpDamage); } if(other.tag == "Boss") { if(Application.loadedLevel == 9) { //Sasuke Takes Dmg if (GameObject.FindObjectOfType<BossHealthManager>() != null) { GameObject.FindObjectOfType<BossHealthManager>().takeDamage(sonicJumpDamage); } } else if(Application.loadedLevel == 12) { //Gizmo Takes Dmg gizmo.GetComponent<EnemyHealthManager>().takeDamage(sonicJumpDamage); } else if (Application.loadedLevel == 15) { //Robotnik Takes Double Dmg sonicJumpDamage *= 2; //robotink.GetComponent<RobotnikController>().takeDamage(sonicJumpDamage); } } } }