private void FireInteractionHandler(FireInteraction fireInteraction) { if (!fireInteraction.attacker.Equals(entityId)) { return; } EntityType munition = fireInteraction.munitionType; for (int i = 0; i < ReflectedParticles.Length; i++) { MunitionTypeParticlePair pair = ReflectedParticles[i]; if (EntityType.FromString(pair.MunitionType).MatchPattern(munition)) { if (pair.ParticleSystem != null) { pair.ParticleSystem.Stop(); pair.ParticleSystem.Play(); } break; } } }
private void FireInteractionHandler(FireInteraction fireInteraction) { if (!fireInteraction.attacker.Equals(entityId)) { return; } EntityType munition = fireInteraction.munitionType; for (int i = 0; i < ReflectedEffects.Length; i++) { MunitionTypeEffects effects = ReflectedEffects[i]; if (EntityType.FromString(effects.MunitionType).MatchPattern(munition)) { if (effects.ParticleSystem != null) { effects.ParticleSystem.Stop(); effects.ParticleSystem.Play(); } if (effects.AudioSource != null) { effects.AudioSource.Stop(); effects.AudioSource.Play(); } break; } } }
private void fireInteraction(FireInteraction fireInteraction) { //FireInteractionSubscribers foreach (var subscriber in FireInteractionSubscribers) { subscriber(fireInteraction); } }
public void CreateNewFire(FireInteraction fireInteraction) { string munitionType = fireInteraction.munitionType.ToString(); GameObject reflectedPrefab = null; foreach (var reflectedModelPair in ReflectedModels) { if (reflectedModelPair.MunitionType == munitionType) { reflectedPrefab = reflectedModelPair.ReflectedPrefab; break; } } if (reflectedPrefab == null) { return; } GameObject currentFire = Instantiate(reflectedPrefab); currentFire.transform.position = new Vector3((float)fireInteraction.location.X, (float)fireInteraction.location.Y, (float)fireInteraction.location.Z); if (PublishedEntity != null && fireInteraction.attacker == PublishedEntity.MyEntityId) { currentFire.GetComponent <AudioSource>().spatialBlend = 0.0f; } //this is the reflected projectile model, if (currentFire.transform.childCount > 0) { ReflectedProjectile refProjectile = currentFire.GetComponentInChildren <ReflectedProjectile>(); if (null != refProjectile) { refProjectile.Init(ExerciseConnection, fireInteraction); refProjectile.transform.SetParent(null, true); } } AudioSource asrc = currentFire.GetComponent <AudioSource>(); if (null != asrc && null != AudioListener) { asrc.Stop(); asrc.playOnAwake = false; if (PublishedEntity != null && fireInteraction.attacker == PublishedEntity.MyEntityId) { asrc.spatialBlend = 0f; //asrc.volume = 1; //asrc.spread = 360; //asrc.minDistance = 10000; //asrc.transform.position += 0.001f * Vector3.one; } //a delay of the distance to the shot over the speed of sound will delay the shot as if the sound was travelling at the speed of sound asrc.PlayDelayed(Vector3.Distance(currentFire.transform.position, AudioListener.transform.position) * OneOverSpeedOfSound); } }
public void Init(ExerciseConnection ExerciseConnection, FireInteraction Fire) { if (!ShowOnLocal) { foreach (PublishedEntity entity in ExerciseConnection.LocalPublishedEntities) { if (entity.MyEntityId == Fire.attacker) { Destroy(gameObject); return; } } } rigidbody = GetComponent <Rigidbody>(); rigidbody.velocity = Fire.linVelocity; Destroy(gameObject, 12); }
public EventID SendFireInteraction(FireInteraction fireInteraction) { return(NetSimAgent.Instance.SendFireInteraction(ExerciseConnectionPtr, fireInteraction)); }
public extern static EventID SendFireInteraction(IntPtr exConnPtr, FireInteraction fireInteraction);