private void AddIfMatches(TankNode tank, StreamHitNode streamHit) { StreamHitComponent component = streamHit.streamHit; if ((component.TankHit != null) && ReferenceEquals(component.TankHit.Entity, tank.Entity)) { streamHit.Entity.AddComponentIfAbsent <StreamHitTargetLoadedComponent>(); } }
public void EnableTarget(NodeAddedEvent e, [Combine] TargetEffectNode node, [Context, JoinByTeam] TeamNode team) { StreamHitComponent streamHit = node.streamHit; base.NewEvent <UpdateIsisRayModeEvent>().Attach(team).Attach(streamHit.TankHit.Entity).Attach(node).Schedule(); UpdateRayEffectUpdateEvent eventInstance = new UpdateRayEffectUpdateEvent(); eventInstance.speedMultipliers = new float[] { float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity }; base.NewEvent(eventInstance).Attach(node).Attach(streamHit.TankHit.Entity).Schedule(); }
private void AddStreamHit(Entity weapon, TargetingData targetingData, StreamHitConfigComponent config, StreamHitCheckingComponent checking) { if (!targetingData.HasAnyHit()) { throw new Exception("No hit in StreamHit " + weapon); } if (!config.DetectStaticHit && !targetingData.HasTargetHit()) { throw new Exception("No tank in StreamHit" + weapon); } StreamHitComponent hit = new StreamHitComponent(); this.FillStreamHit(hit, targetingData); this.SaveHitSentToServer(checking, hit); weapon.AddComponent(hit); }
public void UpdateTracer(UpdateWeaponStreamTracerByStreamHitEvent evt, WeaponStreamTracerStreamHitNode weapon) { StreamHitComponent streamHit = weapon.streamHit; GameObject tracer = weapon.weaponStreamTracerEffect.Tracer; WeaponStreamTracerBehaviour component = tracer.GetComponent<WeaponStreamTracerBehaviour>(); if (streamHit.StaticHit != null) { component.TargetPosition = MathUtil.WorldPositionToLocalPosition(streamHit.StaticHit.Position, tracer); } else if ((streamHit.TankHit != null) && weapon.Entity.HasComponent<StreamHitTargetLoadedComponent>()) { UpdateWeaponStreamTracerByTargetTankEvent eventInstance = new UpdateWeaponStreamTracerByTargetTankEvent { WeaponStreamTracerBehaviour = component, Hit = streamHit.TankHit, WeaponStreamTracerInstance = tracer }; base.ScheduleEvent(eventInstance, streamHit.TankHit.Entity); } }
private void UpdateHitData(HitNode weapon, TargetingData targetingData, bool skipTimeoutCheck) { StreamHitConfigComponent streamHitConfig = weapon.streamHitConfig; StreamHitCheckingComponent streamHitChecking = weapon.streamHitChecking; StreamHitComponent streamHit = weapon.streamHit; HitTarget tankHit = GetTankHit(targetingData); DirectionData bestDirection = targetingData.BestDirection; weapon.streamHitChecking.LastCheckTime = UnityTime.time; streamHit.TankHit = tankHit; streamHit.StaticHit = bestDirection.StaticHit; StaticHit staticHit = !streamHitConfig.DetectStaticHit ? null : bestDirection.StaticHit; bool flag = false; bool flag2 = false; if (!this.IsSameTank(tankHit, streamHitChecking.LastSentTankHit)) { flag = true; } else if (skipTimeoutCheck || ((streamHitChecking.LastSendToServerTime + streamHitConfig.SendToServerPeriod) < UnityTime.time)) { if (!IsAlmostEqual(staticHit, streamHitChecking.LastSentStaticHit)) { flag2 = true; } else if (!this.IsAlmostEqual(tankHit, streamHitChecking.LastSentTankHit)) { flag2 = true; } } if (flag) { weapon.Entity.RemoveComponent <StreamHitComponent>(); this.AddStreamHit(weapon.Entity, targetingData, streamHitConfig, streamHitChecking); } else if (flag2) { base.ScheduleEvent(new SelfUpdateStreamHitEvent(tankHit, staticHit), weapon); this.SaveHitSentToServer(streamHitChecking, streamHit); } }
public void UpdateHitEffect(UpdateEvent evt, WeaponStreamHitGraphicsNode weapon) { WeaponStreamHitGraphicsEffectComponent weaponStreamHitGraphicsEffect = weapon.weaponStreamHitGraphicsEffect; StreamHitComponent streamHit = weapon.streamHit; if (streamHit.StaticHit != null) { weaponStreamHitGraphicsEffect.HitStatic.transform.position = streamHit.StaticHit.Position + (streamHit.StaticHit.Normal * weaponStreamHitGraphicsEffect.HitOffset); weaponStreamHitGraphicsEffect.HitStatic.transform.rotation = Quaternion.LookRotation(streamHit.StaticHit.Normal); weaponStreamHitGraphicsEffect.HitStatic.Play(true); weaponStreamHitGraphicsEffect.HitStaticLight.enabled = true; } else if ((streamHit.TankHit != null) && weapon.Entity.HasComponent <StreamHitTargetLoadedComponent>()) { UpdateWeaponStreamHitGraphicsByTargetTankEvent eventInstance = new UpdateWeaponStreamHitGraphicsByTargetTankEvent { HitTargetParticleSystem = weaponStreamHitGraphicsEffect.HitTarget, HitTargetLight = weaponStreamHitGraphicsEffect.HitTargetLight, TankHit = streamHit.TankHit, HitOffset = weaponStreamHitGraphicsEffect.HitOffset }; base.ScheduleEvent(eventInstance, streamHit.TankHit.Entity); } }
private void UpdateHitSoundsIfNeeded(WeaponStreamHitSoundsEffectComponent effect, StreamHitComponent hit) { bool flag = !ReferenceEquals(hit.StaticHit, null); if (effect.IsStaticHit != flag) { this.UpdateHitSoundsByForce(effect, hit); } }
private void UpdateHitSoundsByForce(WeaponStreamHitSoundsEffectComponent effect, StreamHitComponent hit) { bool flag = !ReferenceEquals(hit.StaticHit, null); effect.IsStaticHit = flag; effect.SoundController.StopImmediately(); effect.SoundController.Source.clip = !flag ? effect.TargetHitClip : effect.StaticHitClip; effect.SoundController.SetSoundActive(); }
private void UpdateHitSoundPosition(WeaponStreamHitSoundsEffectComponent effect, StreamHitComponent hit) { bool flag2 = !ReferenceEquals(hit.TankHit, null); if (!ReferenceEquals(hit.StaticHit, null)) { effect.SoundController.gameObject.transform.position = hit.StaticHit.Position; } if (flag2) { effect.SoundController.gameObject.transform.position = hit.TankHit.TargetPosition; } }
private bool ValidateShakeOnVulcanImpact(VulcanStreamHitNode vulcan, CameraShakerNode cameraShaker, SingleNode <GameCameraShakerSettingsComponent> settings) { StreamHitComponent streamHit = vulcan.streamHit; return(settings.component.Enabled ? ((streamHit.TankHit != null) ? streamHit.TankHit.Entity.HasComponent <SelfTankComponent>() : false) : false); }
private void SaveHitSentToServer(StreamHitCheckingComponent checking, StreamHitComponent streamHit) { checking.LastSendToServerTime = UnityTime.time; checking.LastSentTankHit = streamHit.TankHit; checking.LastSentStaticHit = streamHit.StaticHit; }
private void FillStreamHit(StreamHitComponent hit, TargetingData targetingData) { hit.TankHit = GetTankHit(targetingData); hit.StaticHit = targetingData.BestDirection.StaticHit; }