Example #1
0
        private bool IsDeserter(BattleNode battle, SelfBattleUserNode battleUser, ICollection <BattleUserAsTankNode> battleUsers)
        {
            Entity entity  = battle.Entity;
            Entity entity2 = battleUser.Entity;

            if (entity.HasComponent <DMComponent>())
            {
                return(battleUsers.Count > 1);
            }
            if (!entity.HasComponent <TeamBattleComponent>())
            {
                return(false);
            }
            int num = 0;

            foreach (BattleUserAsTankNode node in battleUsers)
            {
                Entity otherEntity = node.Entity;
                if (!entity2.IsSameGroup <TeamGroupComponent>(otherEntity) && !otherEntity.HasComponent <TankAutopilotComponent>())
                {
                    num++;
                }
            }
            return(num > 0);
        }
Example #2
0
 public void AddVisibleItem(NodeAddedEvent e, BattleNode battle, [JoinAll] ScreenNode screen)
 {
     if (screen.visibleItemsRange.Range.Contains(battle.searchData.IndexInSearchResult))
     {
         base.Log.InfoFormat("AddVisibleItem {0}", battle.Entity.Id);
         battle.Entity.AddComponent <VisibleItemComponent>();
     }
 }
Example #3
0
        public void BuildPedestal(NodeAddedEvent e, BattleNode ctf, SingleNode <MapInstanceComponent> map, [Combine] FlagPedestalNode flagPedestal, [JoinByTeam] TeamNode teamNode)
        {
            CTFAssetProxyBehaviour        assetProxyBehaviour = GetAssetProxyBehaviour(ctf);
            FlagPedestalInstanceComponent component           = new FlagPedestalInstanceComponent {
                FlagPedestalInstance = Object.Instantiate <GameObject>((teamNode.colorInBattle.TeamColor != TeamColor.RED) ? assetProxyBehaviour.bluePedestal : assetProxyBehaviour.redPedestal, flagPedestal.flagPedestal.Position, Quaternion.identity)
            };

            flagPedestal.Entity.AddComponent(component);
        }
        public void LoadBonusClientConfigPrefab(NodeAddedEvent e, BattleNode battle)
        {
            Entity entity = base.CreateEntity("BonusClientConfigPrefabLoader");

            entity.AddComponent <BonusClientConfigPrefabLoaderComponent>();
            entity.AddComponent(new BattleGroupComponent(battle.Entity));
            entity.AddComponent(new AssetReferenceComponent(new AssetReference(battle.bonusClientConfigPrefab.AssetGuid)));
            entity.AddComponent <AssetRequestComponent>();
        }
Example #5
0
 public void ShowWarmingUpTimerNotifications(UpdateEvent e, BattleNode battle, [JoinByBattle] SelfBattleUserNode self, [JoinByBattle] RoundWarmingUpStateNode round, [JoinAll] WarmingUpTimerNotificationsNode notifications)
 {
     if (notifications.warmingUpTimerNotifications.HasNotifications())
     {
         float num = battle.battleStartTime.RoundStartTime.UnityTime - Date.Now.UnityTime;
         if (notifications.warmingUpTimerNotifications.NextNotificationTime > num)
         {
             base.ScheduleEvent <DisableOldMultikillNotificationsEvent>(notifications);
             notifications.warmingUpTimerNotifications.ShowNextNotification();
         }
     }
 }
Example #6
0
 private bool ValidateTargets(List <HitTarget> targets, SelfTankNode tank, BattleNode battle)
 {
     for (int i = 0; i < targets.Count; i++)
     {
         HitTarget target = targets[i];
         if (this.ValidateTarget(target.Entity, tank, battle))
         {
             return(true);
         }
     }
     return(false);
 }
Example #7
0
        public void BuildFlag(NodeAddedEvent e, BattleNode ctf, SingleNode <MapInstanceComponent> map, [Combine] FlagNode flag, [JoinByTeam] TeamNode teamNode)
        {
            CTFAssetProxyBehaviour assetProxyBehaviour = GetAssetProxyBehaviour(ctf);
            TeamColor             teamColor            = teamNode.colorInBattle.TeamColor;
            GameObject            original             = (teamColor != TeamColor.RED) ? assetProxyBehaviour.blueFlag : assetProxyBehaviour.redFlag;
            GameObject            obj3      = (teamColor != TeamColor.RED) ? assetProxyBehaviour.blueFlagBeam : assetProxyBehaviour.redFlagBeam;
            FlagInstanceComponent component = new FlagInstanceComponent();
            GameObject            obj4      = Object.Instantiate <GameObject>(original, flag.flagPosition.Position, Quaternion.identity);

            component.FlagInstance = obj4;
            component.FlagBeam     = Object.Instantiate <GameObject>(obj3, obj4.transform, false);
            flag.Entity.AddComponent(component);
            obj4.AddComponent <FlagPhysicsBehaviour>().TriggerEntity = flag.Entity;
            flag.Entity.AddComponent(new FlagColliderComponent(obj4.GetComponent <BoxCollider>()));
        }
Example #8
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);
        }
 public void InitTeamButtonLock(NodeAddedEvent e, [Combine] TeamNode team, [JoinByBattle, Context] BattleNode battle, [JoinByBattle] ScreenNode screen)
 {
     GetTeamButton(team, screen).SetInteractable(!team.Entity.HasComponent <FullTeamComponent>() && this.CanEnter(battle));
 }
Example #10
0
 public void UnmarkBattle(NodeRemoveEvent e, SelfBattleUserNode battleUser, [JoinByBattle] BattleNode battle)
 {
     battle.Entity.RemoveComponent <SelfComponent>();
 }
Example #11
0
 public void InitGravity(NodeAddedEvent e, SelfBattleUserNode selfBattleUser, [JoinByBattle, Mandatory] BattleNode battle)
 {
     Physics.gravity = Vector3.down * battle.gravity.Gravity;
 }
Example #12
0
 public void SetScore(NodeAddedEvent e, SingleNode <DMScoreHUDComponent> hud, HUDNodes.SelfBattleUserNode battleUser, [JoinByBattle, Context] BattleNode battle)
 {
     base.ScheduleEvent <UpdateDMHUDScoreEvent>(battle);
 }
Example #13
0
 public void MarkBattle(NodeAddedEvent e, SelfBattleUserNode battleUser, [JoinByBattle] BattleNode battle)
 {
     battle.Entity.AddComponent <SelfComponent>();
 }
Example #14
0
 public void ScheduleHitFeedbackOnSelfSplashHitEvent(SelfSplashHitEvent e, SplashWeaponNode weapon, [JoinByTank] SelfTankNode tank, [JoinByBattle] BattleNode battle)
 {
     if (this.ValidateSelfHit(e, tank, battle))
     {
         base.ScheduleEvent <HitFeedbackEvent>(tank);
     }
     else if (((e.SplashTargets != null) && (e.SplashTargets.Count != 0)) && this.ValidateTargets(e.SplashTargets, tank, battle))
     {
         base.ScheduleEvent <HitFeedbackEvent>(tank);
     }
 }
Example #15
0
        public void InitNotifications(NodeAddedEvent e, BattleNode battle, [JoinByBattle, Context] RoundWarmingUpStateNode round, WarmingUpTimerNotificationsNode notifications)
        {
            float remainingTime = battle.battleStartTime.RoundStartTime.UnityTime - Date.Now.UnityTime;

            notifications.warmingUpTimerNotifications.Init(remainingTime);
        }
Example #16
0
 public void AddStreamWeaponHitFeedback(SelfHitEvent e, StreamWeaponWorkingFeedbackControllerNode weapon, [JoinByTank] SelfTankNode tank, [JoinByBattle] BattleNode battle)
 {
     if (this.ValidateSelfHit(e, tank, battle))
     {
         weapon.Entity.AddComponentIfAbsent <StreamHitEnemyFeedbackComponent>();
     }
     else
     {
         weapon.Entity.RemoveComponentIfPresent <StreamHitEnemyFeedbackComponent>();
     }
 }
Example #17
0
 public void SetScoresTDMPosition(NodeAddedEvent e, SingleNode <TeamScoreHUDComponent> hud, HUDNodes.SelfBattleUserAsTankNode battleUser, [JoinByBattle] BattleNode battle)
 {
     hud.component.SetTdmMode();
 }
 public void UnlockTeamButton(NodeRemoveEvent e, [Combine] FullTeamNode team, [JoinByBattle, Context] BattleNode battle, [JoinByBattle] ScreenNode screen)
 {
     GetTeamButton(team, screen).SetInteractable(this.CanEnter(battle));
 }
 private bool CanEnter(BattleNode battle) =>
 battle.personalBattleInfo.Info.CanEnter;
Example #20
0
 public void UpdateSelfScore(UpdateDMHUDScoreEvent e, BattleNode battle, [JoinByBattle] HUDNodes.SelfBattleUserNode self, [JoinByUser] RoundUserNode selfRoundUser, [JoinAll] SingleNode <DMScoreHUDComponent> hud)
 {
     hud.component.Place       = selfRoundUser.roundUserStatistics.Place;
     hud.component.PlayerScore = selfRoundUser.roundUserStatistics.ScoreWithoutBonuses;
 }
Example #21
0
 public void UpdateScore(RoundScoreUpdatedEvent e, RoundNode round, [JoinByBattle] HUDNodes.SelfBattleUserNode selfBattleUser, [JoinByBattle] BattleNode battle)
 {
     base.ScheduleEvent <UpdateDMHUDScoreEvent>(battle);
 }
Example #22
0
 public void UpdateMaxScore(UpdateDMHUDScoreEvent e, BattleNode battle, [JoinByBattle] Optional <ScoreLimitNode> scoreLimit, BattleNode battle2, [JoinByBattle] HUDNodes.SelfBattleUserAsTankNode self, BattleNode battle3, [JoinByBattle] ICollection <RoundUserNode> roundUsers, [JoinAll] SingleNode <DMScoreHUDComponent> hud)
 {
     hud.component.MaxScore = !scoreLimit.IsPresent() ? roundUsers.Min <RoundUserNode>().roundUserStatistics.ScoreWithoutBonuses : scoreLimit.Get().scoreLimit.ScoreLimit;
     hud.component.Players  = roundUsers.Count;
 }
Example #23
0
 private bool ValidateTarget(Entity targetEntity, SelfTankNode tank, BattleNode battle) =>
 !targetEntity.Equals(tank.Entity) ? (targetEntity.HasComponent <TankActiveStateComponent>() ? (!battle.Entity.HasComponent <TeamBattleComponent>() || (targetEntity.GetComponent <TeamGroupComponent>().Key != tank.Entity.GetComponent <TeamGroupComponent>().Key)) : false) : false;
 public void Join(NodeAddedEvent e, [Combine] JoinToScreenBattleNode joinToScreenBattle, [Context, JoinByScreen] ScreenNode screen, [JoinByBattle] BattleNode battle)
 {
     battle.battleGroup.Attach(joinToScreenBattle.Entity);
 }
Example #25
0
 public void ScheduleHitFeedbackOnSelfHitEvent(SelfHitEvent e, DiscreteWeaponNode weapon, [JoinByTank] SelfTankNode tank, [JoinByBattle] BattleNode battle)
 {
     if (this.ValidateSelfHit(e, tank, battle))
     {
         base.ScheduleEvent <HitFeedbackEvent>(tank);
     }
 }
 public void ShowScreen(NodeAddedEvent e, SingleNode <SelfBattleUserComponent> battleUser, [JoinByBattle, Context] BattleNode battle, [JoinByMap, Context] MapNode map)
 {
     base.ScheduleEvent <ShowScreenNoAnimationEvent <BattleLoadScreenComponent> >(battleUser);
     base.ScheduleEvent(new ChangeScreenLogEvent(LogScreen.Battle), battleUser);
 }
Example #27
0
 private bool ValidateSelfHit(SelfHitEvent e, SelfTankNode tank, BattleNode battle) =>
 (e.Targets != null) ? ((e.Targets.Count != 0) ? this.ValidateTargets(e.Targets, tank, battle) : false) : false;
Example #28
0
 public void Init(NodeAddedEvent evt, SelfBattleUserNode battleUser, [Context, JoinByBattle] BattleNode battle, [Context, JoinByMap] MapInstanceNode mapInstance, SingleNode <DecalManagerComponent> managerComponent)
 {
     managerComponent.component.GraffitiDynamicDecalManager = new GraffitiDynamicDecalManager(mapInstance.mapInstance.SceneRoot, battle.userLimit.UserLimit, (float)battle.timeLimit.TimeLimitSec, managerComponent.component.DecalsQueue);
 }
 public void OnShowScreen(NodeAddedEvent e, BattleLoadScreenNode screen, [JoinAll] SingleNode <SelfBattleUserComponent> battleUser, [JoinByBattle, Context] BattleNode battle, [JoinByMap, Context] SingleNode <MapComponent> map)
 {
     screen.battleLoadScreen.InitView(battle.Entity, MapRegistry.GetMap(map.Entity));
 }
Example #30
0
 public void OnUserExitBattle(NodeRemoveEvent e, RoundUserNode roundUser, [JoinByBattle] HUDNodes.SelfBattleUserNode self, [JoinByBattle] BattleNode battle)
 {
     base.NewEvent <UpdateDMHUDScoreEvent>().Attach(battle).ScheduleDelayed(0f);
 }