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); }
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>(); } }
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>(); }
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(); } } }
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); }
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>())); }
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)); }
public void UnmarkBattle(NodeRemoveEvent e, SelfBattleUserNode battleUser, [JoinByBattle] BattleNode battle) { battle.Entity.RemoveComponent <SelfComponent>(); }
public void InitGravity(NodeAddedEvent e, SelfBattleUserNode selfBattleUser, [JoinByBattle, Mandatory] BattleNode battle) { Physics.gravity = Vector3.down * battle.gravity.Gravity; }
public void SetScore(NodeAddedEvent e, SingleNode <DMScoreHUDComponent> hud, HUDNodes.SelfBattleUserNode battleUser, [JoinByBattle, Context] BattleNode battle) { base.ScheduleEvent <UpdateDMHUDScoreEvent>(battle); }
public void MarkBattle(NodeAddedEvent e, SelfBattleUserNode battleUser, [JoinByBattle] BattleNode battle) { battle.Entity.AddComponent <SelfComponent>(); }
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); } }
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); }
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>(); } }
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;
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; }
public void UpdateScore(RoundScoreUpdatedEvent e, RoundNode round, [JoinByBattle] HUDNodes.SelfBattleUserNode selfBattleUser, [JoinByBattle] BattleNode battle) { base.ScheduleEvent <UpdateDMHUDScoreEvent>(battle); }
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; }
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); }
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); }
private bool ValidateSelfHit(SelfHitEvent e, SelfTankNode tank, BattleNode battle) => (e.Targets != null) ? ((e.Targets.Count != 0) ? this.ValidateTargets(e.Targets, tank, battle) : false) : false;
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)); }
public void OnUserExitBattle(NodeRemoveEvent e, RoundUserNode roundUser, [JoinByBattle] HUDNodes.SelfBattleUserNode self, [JoinByBattle] BattleNode battle) { base.NewEvent <UpdateDMHUDScoreEvent>().Attach(battle).ScheduleDelayed(0f); }