Example #1
0
 public void SendDMInitEvent(NodeAddedEvent e, DMBattleNode battle, [Context, Combine] RemoteTankNode tank, [Context, JoinByTank] WeaponNode weapon, [JoinAll] SelfBattleUserNode selfBattleUser, [Context, JoinAll] SingleNode <TankOutlineColorsComponent> colors)
 {
     if (!selfBattleUser.Entity.HasComponent <UserInBattleAsSpectatorComponent>())
     {
         base.ScheduleEvent <InitDeathMatchEvent>(tank);
     }
 }
Example #2
0
 public void DisableHealthBarOnSpawn(NodeAddedEvent e, [Context, Combine] RemoteTankNode remoteTank, [Context, JoinByTank] NameplateNode nameplate, [Context] SelfTankNode selfTank, [JoinByTank] Optional <SonarEffectNode> sonarEffect)
 {
     if (!sonarEffect.IsPresent() && !remoteTank.Entity.IsSameGroup <TeamGroupComponent>(selfTank.Entity))
     {
         nameplate.healthBar.HideHealthBar();
     }
 }
        public void OnLocalTankDestruction(NodeRemoveEvent e, RemoteTankNode node)
        {
            Entity entity = node.Entity;

            entity.RemoveComponent <KalmanFilterComponent>();
            entity.RemoveComponent <RemoteTankSmootherComponent>();
        }
Example #4
0
        public void RemoteDetachWeapon(DetachWeaponEvent e, RemoteTankNode tank, [JoinByTank] UnblockedWeaponNode weapon)
        {
            Rigidbody rigidbody = this.DetachWeapon(tank, weapon);

            rigidbody.SetVelocitySafe(e.Velocity);
            rigidbody.SetAngularVelocitySafe(e.AngularVelocity);
        }
Example #5
0
 public void InitEnemyWeapon(NodeAddedEvent e, [Combine] WeaponNode weapon, [JoinByUser, Context] RemoteTankNode remoteTank, SingleNode <GameTankSettingsComponent> settings)
 {
     if (settings.component.SelfTargetHitFeedbackEnabled)
     {
         weapon.Entity.AddComponent(new WeaponSelfTargetHitFeedbackTimerComponent(Time.time - 0.5f));
         weapon.Entity.CreateGroup <WeaponSelfTargetHitFeedbackGroupComponent>();
     }
 }
Example #6
0
 public void DisableHealthBarsForSpectator(NodeAddedEvent e, [Context, Combine] RemoteTankNode remoteTank, [Context, JoinByTank] NameplateNode nameplate, [Context] SelfSpectatorNode spectator)
 {
     if (!spectator.Entity.HasComponent <UserAdminComponent>() && !spectator.Entity.HasComponent <UserTesterComponent>())
     {
         nameplate.healthBar.HideHealthBar();
     }
     nameplate.nameplate.Alpha         = 1f;
     nameplate.nameplate.alwaysVisible = true;
 }
Example #7
0
 public void EnableHealthBarForEnemies(NodeAddedEvent e, [Context, Combine] RemoteTankNode remoteTank, [Context, JoinByTank] NameplateNode nameplate, [Context] SelfTankNode selfTank, [Context, JoinByTank] SonarEffectNode sonarEffect)
 {
     if (!remoteTank.Entity.IsSameGroup <TeamGroupComponent>(selfTank.Entity))
     {
         nameplate.nameplate.Alpha         = 1f;
         nameplate.nameplate.alwaysVisible = true;
         nameplate.healthBar.ShowHealthBar();
     }
 }
        public void PlayRemoteUserRankSoundEffect(UpdateUserRankEffectEvent evt, RemoteTankNode tank, [JoinAll] SingleNode <MapInstanceComponent> map)
        {
            AudioSource source = Object.Instantiate <AudioSource>(tank.updateUserRankSoundEffectAsset.RemoteUserRankSource);

            source.transform.position = tank.tankSoundRoot.SoundRootTransform.position;
            source.transform.rotation = tank.tankSoundRoot.SoundRootTransform.rotation;
            source.transform.SetParent(map.component.SceneRoot.transform, true);
            source.Play();
            Object.DestroyObject(source.gameObject, source.clip.length + 0.3f);
        }
        public void OnTankCreation(NodeAddedEvent e, RemoteTankNode node)
        {
            Entity entity = node.Entity;
            KalmanFilterComponent component = new KalmanFilterComponent {
                kalmanFilterPosition = new KalmanFilter(node.rigidbody.RigidbodyTransform.position)
            };

            entity.AddComponent(component);
            entity.AddComponent <RemoteTankSmootherComponent>();
            base.ScheduleEvent <PositionSmoothingSnapEvent>(node);
        }
Example #10
0
 private void CreateSelfTargetHitHUDFeedback(ReadyWeaponNode enemyWeapon, RemoteTankNode remoteTank, SelfTankNode selfTank, BattleCameraNode camera, SingleNode <ScreensLayerComponent> canvasNode, bool isShaft)
 {
     if (CheckPossibilityForEffectInstancing(enemyWeapon))
     {
         SelfTargetHitEffectHUDData?nullable = this.GetDataForSelfTargetHitEffect(enemyWeapon, selfTank, camera, canvasNode, isShaft);
         if (nullable != null)
         {
             enemyWeapon.weaponSelfTargetHitFeedbackTimer.LastTime = Time.time;
             SelfTargetHitFeedbackHUDInstanceComponent component = Object.Instantiate <SelfTargetHitFeedbackHUDInstanceComponent>(selfTank.selfTargetHitFeedbackHUDConfig.EffectPrefab, canvasNode.component.transform);
             Entity entity = base.CreateEntity("SelfTargetHitHUDEffectInstance");
             remoteTank.tankGroup.Attach(entity);
             enemyWeapon.weaponSelfTargetHitFeedbackGroup.Attach(entity);
             component.Init(entity, nullable.Value);
         }
     }
 }
Example #11
0
        public void InstantiateAimingSoundsEffectsForRemoteWeapon(NodeAddedEvent evt, [Combine] InitialRemoteShaftAimingSoundsEffectNode weapon, [Combine, Context, JoinByTank] RemoteTankNode tank, SingleNode <SoundListenerBattleStateComponent> soundListener)
        {
            Transform soundRoot = weapon.weaponSoundRoot.transform;

            weapon.shaftAimingOptixMovementSoundEffect.Init(soundRoot);
            weapon.Entity.AddComponentIfAbsent <ShaftRemoteAimingSoundsInstantiatedComponent>();
        }
Example #12
0
 public void InitHealthBarProgressOnRemoteTanks(NodeAddedEvent e, RemoteTankNode tank, [Context, JoinByTank] AttachedHealthBarNode healthBar)
 {
     this.UpdateHealth(tank.health, tank.healthConfig, healthBar.healthBar);
 }
 public void InitMagazineSounds(NodeAddedEvent evt, [Combine] InitialMagazineSoundEffectNode weapon, [Combine, Context, JoinByTank] RemoteTankNode tank, SingleNode <SoundListenerBattleStateComponent> soundListener)
 {
     this.InitMagazineSound(weapon, false);
 }
Example #14
0
 public void InitTankEngineSoundEffect(NodeAddedEvent evt, [Combine] RemoteTankNode tank, SingleNode <SoundListenerBattleStateComponent> soundListener)
 {
     this.InitTankEngineSoundEffect(tank, false);
 }
Example #15
0
 public void CheckSelfTargetHit(DamageInfoTargetEvent e, StreamWeaponNode enemyWeapon, [JoinByUser] RemoteTankNode remoteTank, SelfTankNode selfTank, [JoinByTank] ShaftAimingWeaponNode selfWeapon, [JoinAll] BattleCameraNode camera, [JoinAll] SingleNode <ScreensLayerComponent> canvasNode)
 {
     this.CreateSelfTargetHitHUDFeedback(enemyWeapon, remoteTank, selfTank, camera, canvasNode, true);
 }
 public void DefineForSpec(NodeAddedEvent e, [Combine] RemoteTankNode tank, [Context, JoinByBattle] SelfBattleUserAsSpectator userAsSpectator)
 {
     tank.Entity.AddComponent <TankFriendlyEnemyStatusDefinedComponent>();
 }
Example #17
0
 private void InitTankPartsForOutlineEffect(RemoteTankNode tank, WeaponNode weapon)
 {
     weapon.tankPartOutlineEffectUnity.InitTankPartForOutlineEffect(tank.tankPartOutlineEffectUnity.InitTankPartForOutlineEffect(null));
     tank.Entity.AddComponent <TankPartOutlineEffectInitializedComponent>();
     weapon.Entity.AddComponent <TankPartOutlineEffectInitializedComponent>();
 }
Example #18
0
 public void InitDMTankPartsForOutlineEffect(InitDeathMatchEvent e, RemoteTankNode remoteTank, [JoinByTank] WeaponNode weapon, [JoinAll] SingleNode <TankOutlineColorsComponent> colors)
 {
     this.InitTankPartsForOutlineEffect(remoteTank, weapon);
     remoteTank.tankPartOutlineEffectUnity.MaterialForTankPart.SetColor("_OutlineColor", colors.component.DmEnemies);
     weapon.tankPartOutlineEffectUnity.MaterialForTankPart.SetColor("_OutlineColor", colors.component.DmEnemies);
 }
Example #19
0
 public void SnapOnAdd(NodeAddedEvent e, WeaponNode weapon, [Context, JoinByTank] RemoteTankNode tank)
 {
     this.Snap(weapon);
 }
Example #20
0
        public void OnUpdate(TimeUpdateEvent e, WeaponNode node, [JoinByTank] RemoteTankNode tank)
        {
            Transform weaponInstance = node.weaponInstance.WeaponInstance.transform;

            this.InterpolateVisualRotation(weaponInstance, node.weaponVisualRoot.transform, e.DeltaTime);
        }
 public void InstantiateLaserForRemoteTank(NodeAddedEvent evt, ShaftAimingLaserNode weapon, [Context, JoinByTank] RemoteTankNode remoteTank)
 {
     if (remoteTank.assembledTank.AssemblyRoot)
     {
         GameObject gameObject = Object.Instantiate <GameObject>(weapon.shaftAimingLaser.Asset);
         ShaftAimingLaserBehaviour component = gameObject.GetComponent <ShaftAimingLaserBehaviour>();
         weapon.shaftAimingLaser.EffectInstance = component;
         CustomRenderQueue.SetQueue(gameObject, 0xc4e);
         Transform transform = weapon.shaftAimingLaserSource.gameObject.transform;
         gameObject.transform.position = transform.position;
         gameObject.transform.rotation = transform.rotation;
         component.Init();
         component.SetColor(weapon.shaftAimingColorEffect.ChoosenColor);
         weapon.Entity.AddComponent <ShaftAimingLaserReadyComponent>();
     }
 }
        public void UpdateLaserTargetPosition(UpdateEvent evt, AimingLaserTargetPointNode weapon, [JoinByTank] RemoteTankNode tank, [JoinAll] CameraNode camera)
        {
            Vector3 barrelOriginWorld = new MuzzleVisualAccessor(weapon.muzzlePoint).GetBarrelOriginWorld();

            this.InterpolateLaser(weapon, barrelOriginWorld, Vector3.Lerp(weapon.shaftAimingLaser.CurrentLaserDirection, Vector3.Normalize(weapon.shaftAimingTargetPoint.Point - barrelOriginWorld), weapon.shaftAimingLaser.InterpolationCoeff).normalized);
        }
Example #23
0
 public void SetTankAsReadyForCameraJoining(TankMovementInitEvent evt, RemoteTankNode tank, [JoinByUser] FollowedBattleUserNode followedBattleUser)
 {
     tank.Entity.AddComponent <FollowedTankReadyToCameraComponent>();
 }
 public void AddEnemyComponent(NodeAddedEvent e, [Combine] RemoteTankNode tank, [JoinByBattle] SingleNode <DMComponent> dmBattle)
 {
     tank.Entity.AddComponent <EnemyComponent>();
     tank.Entity.AddComponent <TankFriendlyEnemyStatusDefinedComponent>();
 }
Example #25
0
 public void DisableHealthBarForEnemies(NodeRemoveEvent e, SonarEffectNode sonarEffect, [Context, JoinByTank] SelfTankNode selfTank, [Context, Combine] RemoteTankNode remoteTank, [Context, JoinByTank] NameplateNode nameplate)
 {
     if (!remoteTank.Entity.IsSameGroup <TeamGroupComponent>(selfTank.Entity))
     {
         nameplate.nameplate.alwaysVisible = false;
         nameplate.healthBar.HideHealthBar();
     }
 }
 public void InitTeamMaterial(NodeAddedEvent e, [Combine] EffectTeamGraphicsNode effect, [JoinByTank, Context, Combine] RemoteTankNode remoteTank, [JoinByTeam] SingleNode <ColorInBattleComponent> teamUIColor)
 {
     this.ApplyTeamColor(effect, teamUIColor.component.TeamColor, true);
 }
Example #27
0
 public void Explosion(TriggerEnterEvent e, RemoteTankNode targetTank, SpiderActiveNode spider, [JoinByTank] SingleNode <SelfTankComponent> tank)
 {
     MineUtil.ExecuteSplashExplosion(spider.Entity, tank.Entity, spider.rigidbody.Rigidbody.transform.position);
 }