public void ChangeToNewBat(PlayerBatTypes _newBatType) { if (_newBatType == currentBatType) { // this power up is already active // ensure that the bat is enabled, as in first level or restart return; } if (isMorphingBat) { StopTransitionCoroutine(); } previousBatType = currentBatType; nextBatType = _newBatType; // depending on the previous bat type, we need to transition to the next if (previousBatType != PlayerBatTypes.None) { StopTransitionCoroutine(); transitionCoroutine = TransitionToNextBatType(); StartCoroutine(transitionCoroutine); } else { // no bat was previously enabled, switch the bat type instantly SwitchToNextBat(); // might want a first reveal of the players bat, growing out of a small dot if (currentBat != null) { currentBat.MorphToPlayingState(); } } }
public void Reset() { StopTransitionCoroutine(); StopRunningCoroutine(); currentBatType = PlayerBatTypes.None; HideAllBats(); batIsActive = false; }
private IEnumerator StartGameSequence() { StopTransitionCoroutine(); HideAllBats(); currentBatType = PlayerBatTypes.None; ChangeToNewBat(PlayerBatTypes.Normal); currentBat.EnableBat(); freezePlayerActive = false; batIsActive = true; yield return(new WaitForSeconds(1.0f)); }
public override void LevelComplete() { foreach (var batPair in allBats) { var bat = batPair.Value; bat.LevelComplete(); } DisableFreezePlayer(); currentBatType = PlayerBatTypes.None; batIsActive = true; ChangeToNewBat(PlayerBatTypes.Normal); }
private void SwitchToNextBat() { HideAllBats(); currentBatType = nextBatType; if (nextBatType == PlayerBatTypes.None) { // no bat return; } currentBat = GetBat((int)nextBatType); currentBat.transform.position = currentBatPosition; currentBat.EnableBat(); }