Ejemplo n.º 1
0
        public void UpdateTime(UpdateEvent e, BattleTimeWithLimitNode battle, [JoinByBattle] RoundNode round)
        {
            float timeLimitSec = battle.timeLimit.TimeLimitSec;

            if (battle.Entity.HasComponent <BattleStartTimeComponent>() && !round.Entity.HasComponent <RoundWarmingUpStateComponent>())
            {
                timeLimitSec -= Date.Now - battle.Entity.GetComponent <BattleStartTimeComponent>().RoundStartTime;
            }
            string timerText = TimerUtils.GetTimerText(timeLimitSec);

            battle.battleItemContent.SetTimeField(timerText);
        }
Ejemplo n.º 2
0
        public void ScoreUpdate(RoundScoreUpdatedEvent e, RoundNode node, [JoinByBattle] BattleWithoutLimitNode battleWithoutLimit, [JoinByBattle] IndicatorNode indicator, [JoinByBattle] ICollection <TeamNode> teams)
        {
            int redScore  = 0;
            int blueScore = 0;

            foreach (TeamNode node2 in teams)
            {
                TeamColor teamColor = node2.teamColor.TeamColor;
                if (teamColor == TeamColor.RED)
                {
                    redScore = node2.teamScore.Score;
                    continue;
                }
                if (teamColor == TeamColor.BLUE)
                {
                    blueScore = node2.teamScore.Score;
                }
            }
            indicator.teamBattleScoreIndicator.UpdateScore(blueScore, redScore, Mathf.Max(blueScore, redScore));
        }
Ejemplo n.º 3
0
        public void UpdateTimer(UpdateEvent e, BattleNode battle, [JoinByBattle] HUDNodes.SelfBattleUserNode self, [JoinByBattle] RoundNode round, [JoinAll] MainHUDNode hud)
        {
            float timeLimitSec          = battle.timeLimit.TimeLimitSec;
            float warmingUpTimeLimitSec = battle.timeLimit.WarmingUpTimeLimitSec;

            if (battle.Entity.HasComponent <BattleStartTimeComponent>())
            {
                float unityTime = battle.Entity.GetComponent <BattleStartTimeComponent>().RoundStartTime.UnityTime;
                if (!round.Entity.HasComponent <RoundWarmingUpStateComponent>())
                {
                    timeLimitSec -= Date.Now.UnityTime - unityTime;
                }
                else
                {
                    warmingUpTimeLimitSec = unityTime - Date.Now.UnityTime;
                }
            }
            hud.mainHUDTimers.Timer.Set(timeLimitSec);
            hud.mainHUDTimers.WarmingUpTimer.Set(warmingUpTimeLimitSec);
        }
Ejemplo n.º 4
0
        public void UpdateTime(UpdateEvent e, BattleTimeIndicatorNode battleTimeIndicator, [JoinByBattle] BattleTimeNode battleTime, [JoinByBattle] RoundNode round)
        {
            float progress     = 0f;
            long  timeLimitSec = battleTime.timeLimit.TimeLimitSec;
            float timeSeconds  = timeLimitSec;

            if (battleTime.Entity.HasComponent <BattleStartTimeComponent>() && !round.Entity.HasComponent <RoundWarmingUpStateComponent>())
            {
                Date roundStartTime = battleTime.Entity.GetComponent <BattleStartTimeComponent>().RoundStartTime;
                timeSeconds -= Date.Now - roundStartTime;
                progress     = Date.Now.GetProgress(roundStartTime, roundStartTime + timeLimitSec);
            }
            string timerText = TimerUtils.GetTimerText(timeSeconds);

            battleTimeIndicator.battleTimeIndicator.Progress = 1f - progress;
            battleTimeIndicator.battleTimeIndicator.Time     = timerText;
        }
Ejemplo n.º 5
0
 public void SwitchToSilentWhenRoundFinish(NodeRemoveEvent e, SingleNode <RoundActiveStateComponent> roundActive, [JoinSelf] RoundNode round, [JoinByBattle] SelfBattleUserNode battleUser, [JoinAll] SoundListenerNode listener)
 {
     this.SwitchToSilent(listener, listener.soundListenerBattleMixerSnapshotTransition.TransitionTimeToSilentAfterRoundFinish);
 }
Ejemplo n.º 6
0
        public void InitIndicator(NodeAddedEvent e, BattleWithoutLimitNode battleWithoutLimit, [Context, JoinByBattle] RoundNode round, [Context, JoinByBattle] IndicatorNode indicator)
        {
            int scoreRed  = battleWithoutLimit.battleScore.ScoreRed;
            int scoreBlue = battleWithoutLimit.battleScore.ScoreBlue;

            indicator.teamBattleScoreIndicator.UpdateScore(scoreBlue, scoreRed, Mathf.Max(scoreRed, scoreBlue));
        }
Ejemplo n.º 7
0
 public void InitIndicator(NodeAddedEvent e, BattleWithLimitNode battleWithLimit, [Context, JoinByBattle] RoundNode round, [Context, JoinByBattle] IndicatorNode indicator)
 {
     indicator.teamBattleScoreIndicator.UpdateScore(battleWithLimit.battleScore.ScoreBlue, battleWithLimit.battleScore.ScoreRed, battleWithLimit.scoreLimit.ScoreLimit);
 }
Ejemplo n.º 8
0
 public void UpdateScore(RoundScoreUpdatedEvent e, RoundNode round, [JoinByBattle] HUDNodes.SelfBattleUserNode selfBattleUser, [JoinByBattle] BattleNode battle)
 {
     base.ScheduleEvent <UpdateDMHUDScoreEvent>(battle);
 }
Ejemplo n.º 9
0
 public void ScoreUpdate(RoundScoreUpdatedEvent e, RoundNode node, [JoinByBattle] ScoreBattleNode battle, [JoinByBattle] HUDNodes.SelfBattleUserNode self, [JoinByBattle] ICollection <TeamNode> teams, [JoinAll] SingleNode <TeamScoreHUDComponent> hud)
 {
     this.SetScore(teams, hud.component);
 }
Ejemplo n.º 10
0
 public void InitIndicator(NodeAddedEvent e, ScoreBattleNode battle, [Context, JoinByBattle] RoundNode round, [Context, JoinByBattle] HUDNodes.SelfBattleUserNode self, [JoinByBattle] ICollection <TeamNode> teams, [Context] SingleNode <TeamScoreHUDComponent> hud)
 {
     hud.component.gameObject.SetActive(true);
     this.SetScore(teams, hud.component);
 }
Ejemplo n.º 11
0
 public void InitFlags(NodeAddedEvent e, CTFBattleNode battle, [Context, JoinByBattle] RoundNode round, [Context, JoinByBattle] HUDNodes.SelfBattleUserNode self, [Context] SingleNode <FlagsHUDComponent> hud)
 {
     hud.component.BlueFlagNormalizedPosition = 0f;
     hud.component.RedFlagNormalizedPosition  = 0f;
     hud.component.gameObject.SetActive(true);
 }
Ejemplo n.º 12
0
 public void RoundReturnedToBalance(NodeRemoveEvent e, RoundNode roundDisbalanced, [JoinAll] SingleNode <DisbalanceInfoComponent> disbalanceInfo)
 {
     disbalanceInfo.component.HideDisbalanceInfo();
 }