public void PrepareImpactOnShot(FixedUpdateEvent evt, ImpactNode weapon) { ImpactComponent impact = weapon.impact; DamageWeakeningByDistanceComponent damageWeakeningByDistance = weapon.damageWeakeningByDistance; HitTarget tankHit = weapon.streamHit.TankHit; if (tankHit != null) { float deltaTime = evt.DeltaTime; VulcanImpactEvent eventInstance = new VulcanImpactEvent(); float hitDistance = tankHit.HitDistance; float impactWeakeningByRange = base.GetImpactWeakeningByRange(hitDistance, damageWeakeningByDistance); eventInstance.Force = (((Vector3.Normalize(tankHit.HitDirection) * impact.ImpactForce) * WeaponConstants.WEAPON_FORCE_MULTIPLIER) * deltaTime) * impactWeakeningByRange; eventInstance.LocalHitPoint = tankHit.LocalHitPoint; eventInstance.WeakeningCoeff = impactWeakeningByRange; Entity[] entities = new Entity[] { weapon.Entity, tankHit.Entity }; base.NewEvent(eventInstance).AttachAll(entities).Schedule(); } }
public void ApplyVulcanImpact(VulcanImpactEvent evt, TankNode tank) { Rigidbody body = tank.rigidbody.Rigidbody; VulcanPhysicsUtils.ApplyVulcanForce(evt.Force, body, MathUtil.LocalPositionToWorldPosition(evt.LocalHitPoint, body.gameObject), tank.tankFalling, tank.track); }