コード例 #1
0
        private bool onRoundStarted(IslandTargetsEvents.GameRoundStarted evt)
        {
            DateTime value     = evt.StartTime.MsToDateTime();
            DateTime dateTime  = evt.EndTime.MsToDateTime();
            DateTime dateTime2 = contentSchedulerService.PresentTime();

            currentGameDuration = (float)dateTime.Subtract(value).TotalSeconds;
            currentGameTime     = (float)dateTime2.Subtract(value).TotalSeconds;
            IslandTargetsSideScoreboard.SideScoreboardState state = IslandTargetsSideScoreboard.SideScoreboardState.InGame;
            if (gameState == TargetsGameState.Idle)
            {
                stopGameStartCountdown();
                ClockTimer.SetActive(value: true);
                if (animatorFloatingClock != null && !string.IsNullOrEmpty(ClockTriggerFlyOut))
                {
                    animatorFloatingClock.SetTrigger(ClockTriggerFlyOut);
                    animatorFloatingClock.ResetTrigger(ClockTriggerFlyBack);
                }
                CoroutineRunner.Start(setScarecrowVisible(isVisible: false), this, "setScarecrowVisible");
                currentRoofOpenAmount = 0f;
                targetRoofOpenAmount  = 0f;
                if (ClockController != null)
                {
                    ClockController.StopClock();
                }
                iTween.RotateTo(ClockLargeHand, iTween.Hash("z", 0f, "time", 0.8f));
                ClockTowerAnimator.SetTrigger("StartGame");
                CoroutineRunner.Start(gameTimer.Start(), this, "TargetsScoreboardsTimer");
            }
            UpdateRounds(playgroundController.CurrentRound, playgroundController.TotalRounds);
            gameState = ((!evt.IsFinalRound) ? TargetsGameState.InGame : TargetsGameState.FinalRound);
            if (gameState == TargetsGameState.FinalRound)
            {
                dispatcher.AddListener <IslandTargetsEvents.TargetHit>(onTargetHit);
                ClockTowerAnimator.Play("CrateCoRoofOpen", 0, 0f);
                ClockTowerAnimator.speed = 0f;
                state = IslandTargetsSideScoreboard.SideScoreboardState.FinalRound;
            }
            UpdateScores(playgroundController.TotalTargets - playgroundController.TargetsRemaining, playgroundController.TotalTargets);
            for (int i = 0; i < SideScoreboards.Length; i++)
            {
                SideScoreboards[i].SetState(state);
            }
            int num = playgroundController.CurrentRound;

            if (num == 0)
            {
                num = RoundSFXTriggers.Length - 1;
            }
            num--;
            if (num < RoundSFXTriggers.Length && !string.IsNullOrEmpty(RoundSFXTriggers[num]))
            {
                EventManager.Instance.PostEvent(RoundSFXTriggers[num], EventAction.PlaySound, base.gameObject);
            }
            if (num < RoundMusicNames.Length && !string.IsNullOrEmpty(RoundMusicNames[num]))
            {
                EventManager.Instance.PostEvent(MusicEventName, EventAction.SetSwitch, RoundMusicNames[num], createCoMusicTarget);
            }
            return(false);
        }
コード例 #2
0
 private bool onRoundEnded(IslandTargetsEvents.GameRoundEnded evt)
 {
     if (gameState == TargetsGameState.FinalRound)
     {
         gameState = TargetsGameState.Idle;
         ClockTowerAnimator.speed = 1f;
         gameState = TargetsGameState.Idle;
         dispatcher.RemoveListener <IslandTargetsEvents.TargetHit>(onTargetHit);
         CoroutineRunner.Start(setClockTimerVisible(isVisible: false, RewardDelay), this, "setClockTimerVisible");
         ClockSmallHand.transform.localRotation = Quaternion.identity;
         if (animatorFloatingClock != null && !string.IsNullOrEmpty(ClockTriggerFlyBack))
         {
             animatorFloatingClock.SetTrigger(ClockTriggerFlyBack);
             animatorFloatingClock.ResetTrigger(ClockTriggerFlyOut);
         }
         CoroutineRunner.Start(setScarecrowVisible(isVisible: true, RewardDelay), this, "setScarecrowVisible");
         FinishCamera.SetActive(value: true);
         if (ClockController != null)
         {
             ClockController.StartClock();
         }
         for (int i = 0; i < SideScoreboards.Length; i++)
         {
             SideScoreboards[i].SetState(IslandTargetsSideScoreboard.SideScoreboardState.WonGame);
         }
         CoroutineRunner.Start(resetScoreboardState(RoundWinResetDelay), this, "ResetScoreboardState");
         CoroutineRunner.Start(showRewards(), this, "ShowTargetGameRewards");
         if (!string.IsNullOrEmpty(WinMusicName))
         {
             EventManager.Instance.PostEvent(MusicEventName, EventAction.SetSwitch, WinMusicName, createCoMusicTarget);
         }
         EventManager.Instance.PostEvent(WinSFXTrigger, EventAction.PlaySound, base.gameObject);
         LogBIDataForWin();
         CoroutineRunner.Start(SwitchBackToDefautMusic(ReturnToEvergreenMusicWait), this, "SwitchToEvergreenMusic");
     }
     else
     {
         for (int i = 0; i < SideScoreboards.Length; i++)
         {
             SideScoreboards[i].SetState(IslandTargetsSideScoreboard.SideScoreboardState.BetweenRounds);
         }
     }
     if (isPlayingLowTimeSFX)
     {
         EventManager.Instance.PostEvent(LowTimeSFXTrigger, EventAction.StopSound, base.gameObject);
         isPlayingLowTimeSFX = false;
     }
     InvokeRepeating("displayGameStartCountdown", 0f, 1f);
     return(false);
 }
コード例 #3
0
 private bool onGameTimeOut(IslandTargetsEvents.TargetGameTimeOut evt)
 {
     gameState = TargetsGameState.Idle;
     gameTimer.Stop();
     CoroutineRunner.Start(setClockTimerVisible(isVisible: false, TimeoutDelay), this, "setClockTimerVisible");
     ClockTowerAnimator.speed = 1f;
     if (ClockController != null)
     {
         ClockController.StartClock();
     }
     ClockTowerAnimator.SetTrigger("TimeOut");
     if (animatorFloatingClock != null && !string.IsNullOrEmpty(ClockTriggerFlyBack))
     {
         animatorFloatingClock.ResetTrigger(ClockTriggerFlyOut);
         animatorFloatingClock.SetTrigger(ClockTriggerFlyBack);
     }
     CoroutineRunner.Start(setScarecrowVisible(isVisible: true, TimeoutDelay), this, "setScarecrowVisible");
     for (int i = 0; i < SideScoreboards.Length; i++)
     {
         SideScoreboards[i].SetState(IslandTargetsSideScoreboard.SideScoreboardState.RoundFail);
     }
     CoroutineRunner.Start(resetScoreboardState(RoundFailResetDelay), this, "ResetScoreboardState");
     if (!string.IsNullOrEmpty(LoseMusicName) && !isZoneTransitioning)
     {
         EventManager.Instance.PostEvent(MusicEventName, EventAction.SetSwitch, LoseMusicName, createCoMusicTarget);
         isPlayingLoseMusic = true;
     }
     if (!isZoneTransitioning)
     {
         EventManager.Instance.PostEvent(LoseSFXTrigger, EventAction.PlaySound, base.gameObject);
         isPlayingLoseSFXTrigger = true;
     }
     CoroutineRunner.Start(SwitchBackToDefautMusic(ReturnToEvergreenMusicWait), this, "SwitchToEvergreenMusic");
     if (isPlayingLowTimeSFX)
     {
         EventManager.Instance.PostEvent(LowTimeSFXTrigger, EventAction.StopSound, base.gameObject);
         isPlayingLowTimeSFX = false;
     }
     InvokeRepeating("displayGameStartCountdown", 0f, 1f);
     return(false);
 }