void OnTriggerEnter2D(Collider2D other) { if (gameObject.CompareTag("Player1Skill")) { if (other.gameObject.CompareTag("Player1Bullet") || other.gameObject.CompareTag("Player2Bullet")) { Destroy(other.gameObject); } if (other.gameObject.CompareTag("Player2") && PlayerStatusControl_Level3._instance.playerIdentity == 2) { ps2.Damage(ps1.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps1.attackAbility)); } if (other.gameObject.CompareTag("Player3") && PlayerStatusControl_Level3._instance.playerIdentity == 3) { ps3.Damage(ps1.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps1.attackAbility)); } } else if (gameObject.CompareTag("Player2Skill")) { if (other.gameObject.CompareTag("Player1Bullet") || other.gameObject.CompareTag("Player3Bullet")) { Destroy(other.gameObject); } if (other.gameObject.CompareTag("Player1") && PlayerStatusControl_Level3._instance.playerIdentity == 1) { ps1.Damage(ps2.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps2.attackAbility)); } if (other.gameObject.CompareTag("Player3") && PlayerStatusControl_Level3._instance.playerIdentity == 3) { ps3.Damage(ps2.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps2.attackAbility)); } } else if (gameObject.CompareTag("Player3Skill")) { if (other.gameObject.CompareTag("Player1Bullet") || other.gameObject.CompareTag("Player2Bullet")) { Destroy(other.gameObject); } if (other.gameObject.CompareTag("Player1") && PlayerStatusControl_Level3._instance.playerIdentity == 1) { ps1.Damage(ps3.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps3.attackAbility)); } if (other.gameObject.CompareTag("Player2") && PlayerStatusControl_Level3._instance.playerIdentity == 2) { ps2.Damage(ps3.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps3.attackAbility)); } } }
void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Wall") { Destroy(gameObject); } if (gameObject.CompareTag("Player1Bullet")) { if (collision.gameObject.CompareTag("Player2") || collision.gameObject.CompareTag("Player3")) { if (collision.gameObject.CompareTag("Player2") && PlayerStatusControl_Level3._instance.playerIdentity == 2) { if (ps2.damageReflect) { ps1.Damage(ps1.attackAbility); TcpClient_All._instance.SendHpChange(ps1.playerIdentity, -Mathf.RoundToInt(ps1.attackAbility)); } else { ps2.Damage(ps1.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps1.attackAbility)); } } if (collision.gameObject.CompareTag("Player3") && PlayerStatusControl_Level3._instance.playerIdentity == 3) { if (ps3.damageReflect) { ps1.Damage(ps1.attackAbility); TcpClient_All._instance.SendHpChange(ps1.playerIdentity, -Mathf.RoundToInt(ps1.attackAbility)); } else { ps3.Damage(ps1.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps1.attackAbility)); } } if (isIceBullet) { if (collision.gameObject.CompareTag("Player2")) { ps2.frozenSpeed = 0.5f; ps2.frozenRemain = 6; if (ps2.frozenCarryEffect) { Destroy(ps2.frozenCarryEffect); } ps2.frozenCarryEffect = Instantiate(frozenCarryEffect, collision.gameObject.transform.position, Quaternion.identity); ps2.frozenCarryEffect.transform.parent = collision.gameObject.transform; } if (collision.gameObject.CompareTag("Player3")) { ps3.frozenSpeed = 0.5f; ps3.frozenRemain = 6; if (ps3.frozenCarryEffect) { Destroy(ps3.frozenCarryEffect); } ps3.frozenCarryEffect = Instantiate(frozenCarryEffect, collision.gameObject.transform.position, Quaternion.identity); ps3.frozenCarryEffect.transform.parent = collision.gameObject.transform; } explo = (GameObject)Instantiate(iceExlposion, collision.transform.position, Quaternion.identity); Destroy(explo, 1); } else { explo = (GameObject)Instantiate(explosion, collision.transform.position, Quaternion.identity); Destroy(explo, 1); } Destroy(gameObject); } } else if (gameObject.CompareTag("Player2Bullet")) { if (collision.gameObject.CompareTag("Player1") || collision.gameObject.CompareTag("Player3")) { if (collision.gameObject.CompareTag("Player1") && PlayerStatusControl_Level3._instance.playerIdentity == 1) { if (ps1.damageReflect) { ps2.Damage(ps2.attackAbility); TcpClient_All._instance.SendHpChange(ps2.playerIdentity, -Mathf.RoundToInt(ps2.attackAbility)); } else { ps1.Damage(ps2.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps2.attackAbility)); } } if (collision.gameObject.CompareTag("Player3") && PlayerStatusControl_Level3._instance.playerIdentity == 3) { if (ps3.damageReflect) { ps2.Damage(ps2.attackAbility); TcpClient_All._instance.SendHpChange(ps2.playerIdentity, -Mathf.RoundToInt(ps2.attackAbility)); } else { ps3.Damage(ps2.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps2.attackAbility)); } } if (isIceBullet) { if (collision.gameObject.CompareTag("Player1")) { ps1.frozenSpeed = 0.5f; ps1.frozenRemain = 6; if (ps1.frozenCarryEffect) { Destroy(ps1.frozenCarryEffect); } ps1.frozenCarryEffect = Instantiate(frozenCarryEffect, collision.gameObject.transform.position, Quaternion.identity); ps1.frozenCarryEffect.transform.parent = collision.gameObject.transform; } if (collision.gameObject.CompareTag("Player3")) { ps3.frozenSpeed = 0.5f; ps3.frozenRemain = 6; if (ps3.frozenCarryEffect) { Destroy(ps3.frozenCarryEffect); } ps3.frozenCarryEffect = Instantiate(frozenCarryEffect, collision.gameObject.transform.position, Quaternion.identity); ps3.frozenCarryEffect.transform.parent = collision.gameObject.transform; } explo = (GameObject)Instantiate(iceExlposion, collision.transform.position, Quaternion.identity); Destroy(explo, 1); } else { explo = (GameObject)Instantiate(explosion, collision.transform.position, Quaternion.identity); Destroy(explo, 1); } Destroy(gameObject); } } else if (gameObject.CompareTag("Player3Bullet")) { if (collision.gameObject.CompareTag("Player1") || collision.gameObject.CompareTag("Player2")) { if (collision.gameObject.CompareTag("Player1") && PlayerStatusControl_Level3._instance.playerIdentity == 1) { if (ps1.damageReflect) { ps3.Damage(ps3.attackAbility); TcpClient_All._instance.SendHpChange(ps3.playerIdentity, -Mathf.RoundToInt(ps3.attackAbility)); } else { ps1.Damage(ps3.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps3.attackAbility)); } } if (collision.gameObject.CompareTag("Player2") && PlayerStatusControl_Level3._instance.playerIdentity == 2) { if (ps2.damageReflect) { ps3.Damage(ps3.attackAbility); TcpClient_All._instance.SendHpChange(ps3.playerIdentity, -Mathf.RoundToInt(ps3.attackAbility)); } else { ps2.Damage(ps3.attackAbility); TcpClient_All._instance.SendHpChange(PlayerStatusControl_Level3._instance.playerIdentity, -Mathf.RoundToInt(ps3.attackAbility)); } } if (isIceBullet) { if (collision.gameObject.CompareTag("Player1")) { ps1.frozenSpeed = 0.5f; ps1.frozenRemain = 6; if (ps1.frozenCarryEffect) { Destroy(ps1.frozenCarryEffect); } ps1.frozenCarryEffect = Instantiate(frozenCarryEffect, collision.gameObject.transform.position, Quaternion.identity); ps1.frozenCarryEffect.transform.parent = collision.gameObject.transform; } if (collision.gameObject.CompareTag("Player2")) { ps2.frozenSpeed = 0.5f; ps2.frozenRemain = 6; if (ps2.frozenCarryEffect) { Destroy(ps2.frozenCarryEffect); } ps2.frozenCarryEffect = Instantiate(frozenCarryEffect, collision.gameObject.transform.position, Quaternion.identity); ps2.frozenCarryEffect.transform.parent = collision.gameObject.transform; } explo = (GameObject)Instantiate(iceExlposion, collision.transform.position, Quaternion.identity); Destroy(explo, 1); } else { explo = (GameObject)Instantiate(explosion, collision.transform.position, Quaternion.identity); Destroy(explo, 1); } Destroy(gameObject); } } }