public void UpdateHitEffect(UpdateWeaponStreamHitGraphicsByTargetTankEvent evt, HullNode tank) { Vector3 vector = tank.hullInstance.HullInstance.transform.TransformPoint(evt.TankHit.LocalHitPoint); Quaternion quaternion = Quaternion.LookRotation(evt.TankHit.HitDirection); evt.HitTargetParticleSystem.transform.position = vector - (evt.TankHit.HitDirection * evt.HitOffset); evt.HitTargetParticleSystem.transform.rotation = quaternion; evt.HitTargetParticleSystem.Play(true); evt.HitTargetLight.enabled = true; }
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); } }