public FiredProjectileMovementSystem(FiredProjectileDefinition firedProjectileDefinition, FiredProjectile FiredProjectileRef) { FiredProjectileDefinition = firedProjectileDefinition; this.FiredProjectileRef = FiredProjectileRef; this.FiredProjectileTransform = FiredProjectileRef.InteractiveGameObject.InteractiveGameObjectParent.transform; this.CrossedDistance = 0f; }
public FiredProjectile(IInteractiveGameObject parent, FiredProjectileDefinition FiredProjectileDefinition, CoreInteractiveObject weaponHolder) { this.FiredProjectileDefinition = FiredProjectileDefinition; this.interactiveObjectTag = new InteractiveObjectTag() { IsDealingDamage = true }; parent.CreateLogicCollider(BuildBoxColliderDefinition(FiredProjectileDefinition)); this.BaseInit(parent, true); this.ProjectileWeaponHoldingSystem = new ProjectileWeaponHoldingSystem(weaponHolder); this.FiredProjectileMovementSystem = new FiredProjectileMovementSystem(FiredProjectileDefinition, this); this._damageDealerEmitterSystem = new DamageDealerEmitterSystem(this, FiredProjectileDefinition.damageDealerEmitterSystemDefinition, TriggerSelectionGuard: (InteractiveObjectPhysicsTriggerInfo) => FiredProjectileHasTriggerEnter_DealsDamage_And_MustBeDestroyed(InteractiveObjectPhysicsTriggerInfo.OtherInteractiveObject, this.ProjectileWeaponHoldingSystem.GetWeaponHolder()), OnDamageDealtToOtherAction: null); this.RegisterInteractiveObjectPhysicsEventListener(new InteractiveObjectPhysicsEventListenerDelegated( (InteractiveObjectPhysicsTriggerInfo) => FiredProjectileHasTriggerEnter_DealsDamage_And_MustBeDestroyed(InteractiveObjectPhysicsTriggerInfo.OtherInteractiveObject, this.ProjectileWeaponHoldingSystem.GetWeaponHolder()), this.OnObstacleTriggerEnter)); }
/// <summary> /// Because <see cref="FiredProjectile"/> are often a High Speed Rigid body, we force the RigidBody interpolation mode to Interpolate /// </summary> private static InteractiveObjectBoxLogicColliderDefinitionStruct BuildBoxColliderDefinition(FiredProjectileDefinition FiredProjectileDefinition) { InteractiveObjectBoxLogicColliderDefinitionStruct InteractiveObjectBoxLogicColliderDefinitionStruct = FiredProjectileDefinition.InteractiveObjectBoxLogicColliderDefinition; InteractiveObjectBoxLogicColliderDefinitionStruct.RigidbodyInterpolation = RigidbodyInterpolation.Extrapolate; InteractiveObjectBoxLogicColliderDefinitionStruct.Enabled = true; return InteractiveObjectBoxLogicColliderDefinitionStruct; }