public void PlayRoundEndVoice(GameplayEnums.Outcome _outcome) { AudioClip clip = null; switch (_outcome) { case GameplayEnums.Outcome.Counter: clip = Counterhit; break; case GameplayEnums.Outcome.Shimmy: clip = Shimmy; break; case GameplayEnums.Outcome.StrayHit: clip = StrayHit; break; case GameplayEnums.Outcome.Sweep: clip = Feet; break; case GameplayEnums.Outcome.Throw: clip = Throw; break; case GameplayEnums.Outcome.TimeOut: clip = TimeOut; break; case GameplayEnums.Outcome.Trade: clip = Trade; break; case GameplayEnums.Outcome.WhiffPunish: clip = WhiffPunish; break; } if (clip != null) { VoiceSource.clip = clip; VoiceSource.time = 0f; VoiceSource.Play(); } }
private GameplayEnums.Outcome GetOutcomeFromPlayerState(CharacterState _winner, GameplayEnums.Outcome _previousOutcome) { //if previous outcome is "stray hit", it can be overridden with if (_previousOutcome == GameplayEnums.Outcome.StrayHit) { if (_winner.State == GameplayEnums.CharacterState.Special) { return(_winner.SelectedCharacter.GetCurrentCharacterSpecialOutcome()); } } return(_previousOutcome); }
private MatchOutcome ResolveHitboxInteractions(SinglePlayerInputs _p1Inputs, SinglePlayerInputs _p2Inputs, GameState _currentState) { bool p1_hits_p2 = false; bool p2_hits_p1 = false; bool clash = false; bool throwBreak = false; bool p1_throws_p2 = false; bool p2_throws_p1 = false; //check p1 attacks first foreach (Hitbox_Gameplay hg in _currentState.P1_Hitboxes) { if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack || hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw) { if (hg.HasStruck) { continue; } foreach (Hitbox_Gameplay p2_hg in _currentState.P2_Hitboxes) { if (p2_hg.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb || p2_hg.HitboxType == GameplayEnums.HitboxType.Hurtbox_Main) { if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack) { if (DoHitboxesOverlap(hg, p2_hg, _currentState)) { p1_hits_p2 = true; hg.HasStruck = true; } } if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw) { if (DoHitboxesOverlap(hg, p2_hg, _currentState) && p2_hg.HitboxType == GameplayEnums.HitboxType.Hurtbox_Main) { if (_currentState.P2_State == GameplayEnums.CharacterState.ThrowStartup) { throwBreak = true; } else { p1_throws_p2 = true; } hg.HasStruck = true; } } } else if (p2_hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack) { if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack) { if (DoHitboxesOverlap(hg, p2_hg, _currentState)) { clash = true; hg.HasStruck = true; } } } else if (p2_hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw) { if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw) { if (DoHitboxesOverlap(hg, p2_hg, _currentState)) { throwBreak = true; hg.HasStruck = true; } } } } } } //check p2 foreach (Hitbox_Gameplay hg in _currentState.P2_Hitboxes) { if (hg.HasStruck) { continue; } if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack || hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw) { foreach (Hitbox_Gameplay p1_hg in _currentState.P1_Hitboxes) { if (p1_hg.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb || p1_hg.HitboxType == GameplayEnums.HitboxType.Hurtbox_Main) { if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack) { if (DoHitboxesOverlap(p1_hg, hg, _currentState)) { p2_hits_p1 = true; hg.HasStruck = true; } } if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw) { if (DoHitboxesOverlap(p1_hg, hg, _currentState) && p1_hg.HitboxType == GameplayEnums.HitboxType.Hurtbox_Main) { if (_currentState.P1_State == GameplayEnums.CharacterState.ThrowStartup) { throwBreak = true; } else { p2_throws_p1 = true; } hg.HasStruck = true; } } } else if (p1_hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack) { if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack) { if (DoHitboxesOverlap(p1_hg, hg, _currentState)) { clash = true; hg.HasStruck = true; } } } else if (p1_hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw) { if (hg.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw) { if (DoHitboxesOverlap(p1_hg, hg, _currentState)) { throwBreak = true; hg.HasStruck = true; } } } } } } MatchOutcome res = new MatchOutcome(); //handle results : bool p1_is_hit = false; bool p2_is_hit = false; if (p1_hits_p2) { SetAttackAsConnectedWithOpponent(true, _currentState); if (DoesPlayerArmor(false, _currentState)) { //set hitstop _currentState.RemainingHitstop = GameplayConstants.BLOCK_HITSTOP; //play sfx GameManager.Instance.SoundManager.PlaySfx(SoundManager.SFX.Block); } else if (DoesPlayerBlock(false, _currentState, _p2Inputs)) { //set p2 to be in blockstun _currentState.P2_State = GameplayEnums.CharacterState.Blockstun; _currentState.P2_StateFrames = 0; //set hitstop _currentState.RemainingHitstop = GameplayConstants.BLOCK_HITSTOP; //give gauge _currentState.P1_CState.AddGauge(1); //play sfx GameManager.Instance.SoundManager.PlaySfx(SoundManager.SFX.Block); } else { p2_is_hit = true; //play sfx GameManager.Instance.SoundManager.PlaySfx(SoundManager.SFX.Hit); } } if (p2_hits_p1) { SetAttackAsConnectedWithOpponent(false, _currentState); if (DoesPlayerArmor(true, _currentState)) { //set hitstop _currentState.RemainingHitstop = GameplayConstants.BLOCK_HITSTOP; //play sfx GameManager.Instance.SoundManager.PlaySfx(SoundManager.SFX.Block); } else if (DoesPlayerBlock(true, _currentState, _p1Inputs)) { //set p2 to be in blockstun _currentState.P1_State = GameplayEnums.CharacterState.Blockstun; _currentState.P1_StateFrames = 0; //set hitstop _currentState.RemainingHitstop = GameplayConstants.BLOCK_HITSTOP; //give gauge _currentState.P2_CState.AddGauge(1); //play sfx GameManager.Instance.SoundManager.PlaySfx(SoundManager.SFX.Block); } else { p1_is_hit = true; //play sfx GameManager.Instance.SoundManager.PlaySfx(SoundManager.SFX.Hit); } } if (p1_is_hit && p2_is_hit) { res = new MatchOutcome(true, true, GameplayEnums.Outcome.Trade); } else if (p1_is_hit) { GameplayEnums.Outcome outcome = GetOutcomeFromOpponentState(_currentState.P1_CState); outcome = GetOutcomeFromPlayerState(_currentState.P2_CState, outcome); res = new MatchOutcome(false, true, outcome); } else if (p2_is_hit) { GameplayEnums.Outcome outcome = GetOutcomeFromOpponentState(_currentState.P2_CState); outcome = GetOutcomeFromPlayerState(_currentState.P1_CState, outcome); res = new MatchOutcome(true, false, outcome); } else if ((p2_throws_p1 && p1_throws_p2) || throwBreak) { _currentState.P2_State = GameplayEnums.CharacterState.ThrowBreak; _currentState.P2_StateFrames = 0; _currentState.P2_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb); _currentState.P2_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw); _currentState.P1_State = GameplayEnums.CharacterState.ThrowBreak; _currentState.P1_StateFrames = 0; _currentState.P1_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb); _currentState.P1_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw); //play sfx GameManager.Instance.SoundManager.PlaySfx(SoundManager.SFX.ThrowBreak); } else if (p1_throws_p2) { _currentState.P2_State = GameplayEnums.CharacterState.BeingThrown; _currentState.P2_StateFrames = 0; _currentState.P2_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb); _currentState.P2_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw); _currentState.P1_State = GameplayEnums.CharacterState.ThrowingOpponent; _currentState.P1_StateFrames = 0; _currentState.P1_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb); _currentState.P1_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw); } else if (p2_throws_p1) { _currentState.P2_State = GameplayEnums.CharacterState.ThrowingOpponent; _currentState.P2_StateFrames = 0; _currentState.P2_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb); _currentState.P2_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw); _currentState.P1_State = GameplayEnums.CharacterState.BeingThrown; _currentState.P1_StateFrames = 0; _currentState.P1_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb); _currentState.P1_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Throw); } else if (clash) { _currentState.P2_State = GameplayEnums.CharacterState.Clash; _currentState.P2_StateFrames = 0; _currentState.P2_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb); _currentState.P2_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack); _currentState.P1_State = GameplayEnums.CharacterState.Clash; _currentState.P1_StateFrames = 0; _currentState.P1_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb); _currentState.P1_Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack); //play sfx GameManager.Instance.SoundManager.PlaySfx(SoundManager.SFX.Clash); } return(res); }
public MatchOutcome(bool _p1Scores, bool _p2Scores, GameplayEnums.Outcome _outcome) { P1_Scores = _p1Scores; P2_Scores = _p2Scores; Outcome = _outcome; }
public MatchOutcome() { P1_Scores = false; P2_Scores = false; Outcome = GameplayEnums.Outcome.StillGoing; }