public override void WeaponCollide(Collider other) { BaseCharacterController EnemyController = other.gameObject.GetComponentInParent <BaseCharacterController>(); if (m_NextState == this) { if (other.gameObject.layer == LayerMask.NameToLayer("CharacterWeapon")) { FMOD_StudioSystem.instance.PlayOneShot("event:/Weapons/weapon_impact", m_Character.transform.position); if (m_Character.m_Opponent.m_CurrentState is IAttackState) { m_NextState = new AIBattleAttackDeflected(m_Character); } if (m_Character.m_Opponent.m_CurrentState is AIBattleParryUp) { m_NextState = new AIBattleCounterAttacked(m_Character); m_Character.m_Opponent.m_CurrentState.m_NextState = new AIBattleCounterAttackUp(m_Character.m_Opponent); } if (m_Character.m_Opponent.m_CurrentState is AIBattleBlockUp) { //m_NextState = new AIBattleBlocked(m_Character); m_Character.GetHit(5); m_Character.m_Opponent.m_CurrentState.m_NextState = new AIBattleIdle(m_Character.m_Opponent); m_Character.m_Opponent.GetComponent <Animator>().SetBool("BlockUp", false); } } else if (other.gameObject.layer == LayerMask.NameToLayer("CharacterBody") && m_Character != EnemyController) { FMOD_StudioSystem.instance.PlayOneShot("event:/Weapons/weapon_impact", m_Character.transform.position); if (m_Character.m_Opponent.m_CurrentState is AIBattleParryUp) { m_NextState = new AIBattleCounterAttacked(m_Character); m_Character.m_Opponent.m_CurrentState.m_NextState = new AIBattleCounterAttackUp(m_Character.m_Opponent); } else if (m_Character.m_Opponent.m_CurrentState is AIBattleBlockUp) { m_Character.GetHit(5); //m_NextState = new AIBattleBlocked(m_Character); m_Character.m_Opponent.m_CurrentState.m_NextState = new AIBattleIdle(m_Character.m_Opponent); m_Character.m_Opponent.GetComponent <Animator>().SetBool("BlockUp", false); } else { m_NextState = new AIBattleSuccessfulAttack(m_Character); m_Character.m_Opponent.GetHit(5); } } } }
public override void WeaponCollide(Collider other) { BaseCharacterController EnemyController = other.gameObject.GetComponentInParent<BaseCharacterController>(); if (m_NextState == this) { if (other.gameObject.layer == LayerMask.NameToLayer("CharacterWeapon")) { FMOD_StudioSystem.instance.PlayOneShot("event:/Weapons/weapon_impact", m_Character.transform.position); if (m_Character.m_Opponent.m_CurrentState is IAttackState) { m_NextState = new AIBattleAttackDeflected(m_Character); } if (m_Character.m_Opponent.m_CurrentState is AIBattleParryDown) { m_NextState = new AIBattleCounterAttacked(m_Character); m_Character.m_Opponent.m_CurrentState.m_NextState = new AIBattleCounterAttackDown(m_Character.m_Opponent); } if (m_Character.m_Opponent.m_CurrentState is AIBattleBlockDown) { m_Character.GetHit(5); //m_NextState = new AIBattleBlocked(m_Character); m_Character.m_Opponent.m_CurrentState.m_NextState = new AIBattleIdle(m_Character.m_Opponent); m_Character.m_Opponent.GetComponent<Animator>().SetBool("BlockDown", false); } } else if (other.gameObject.layer == LayerMask.NameToLayer("CharacterBody") && m_Character != EnemyController) { FMOD_StudioSystem.instance.PlayOneShot("event:/Weapons/weapon_impact", m_Character.transform.position); if (m_Character.m_Opponent.m_CurrentState is AIBattleParryDown) { m_NextState = new AIBattleCounterAttacked(m_Character); m_Character.m_Opponent.m_CurrentState.m_NextState = new AIBattleCounterAttackDown(m_Character.m_Opponent); } else if (m_Character.m_Opponent.m_CurrentState is AIBattleBlockDown) { m_Character.GetHit(5); //m_NextState = new AIBattleBlocked(m_Character); m_Character.m_Opponent.m_CurrentState.m_NextState = new AIBattleIdle(m_Character.m_Opponent); m_Character.m_Opponent.GetComponent<Animator>().SetBool("BlockDown", false); } else { m_NextState = new AIBattleSuccessfulAttack(m_Character); m_Character.m_Opponent.GetHit(5); } } } }