protected override void OnHealthDamageTaken(HealthComponent bodyPart, float damageTaken, Transform damageOriginPosition) { if (CurrentHealth < (MaxHealth * 0.75f) && CurrentHealth > (MaxHealth * 0.5f)) { stationLightDamage.Invoke(); } else if (CurrentHealth < (MaxHealth * 0.5f) && CurrentHealth > (MaxHealth * 0.25f)) { stationModerateDamage.Invoke(); } else if (CurrentHealth < (MaxHealth * 0.25f) && CurrentHealth > 0) { stationHeavyDamage.Invoke(); } else if (CurrentHealth <= 0.0f) { stationDestroyedEvent.Invoke(); LaneTargetDestroyedEventInfo ltdei = new LaneTargetDestroyedEventInfo(gameObject, this); EventCoordinator.ActivateEvent(ltdei); ParticleEventInfo psei = new ParticleEventInfo(gameObject, "Particles", DestroyedParticles, transform.position, transform.rotation); EventCoordinator.ActivateEvent(psei); TextLogEventInfo tlei = new TextLogEventInfo(gameObject, name + " has been destroyed!"); EventCoordinator.ActivateEvent(tlei); VoiceLineEventInfo vlei = new VoiceLineEventInfo(gameObject, deathVoiceline); EventCoordinator.ActivateEvent(vlei); } }
void Fire() { timer = 0; ProjectileBase projB = Instantiate(projectile, spawnpoint.position, spawnpoint.rotation).GetComponent <ProjectileBase>(); projB.Velocity = spawnpoint.forward * musVelocity; projB.Damage = damage; projB.DmgType = type; currentAmmo -= 1; if (hitAudioSources != null && hitAudioSources.Length > 0) { projB.audioSource = hitAudioSources[currentHitAudio]; } if (hitAudioSources.Length == ++currentHitAudio) { currentHitAudio = 0; } if (audio.isPlaying) { audio.Stop(); } audio.Play(); ParticleEventInfo psei = new ParticleEventInfo(gameObject, "Particles", fireParticles, spawnpoint.position, spawnpoint.rotation); EventCoordinator.ActivateEvent(psei); //SoundEventInfo sei = new SoundEventInfo(gameObject, "Firesound", fireSound, spawnpoint.position); //EventCoordinator.ActivateEvent(sei); }
//此函数被反射调用的,不能删 public void OnPlayParticle(MoveEditor.MoveAnimationEvent e) { //ParticleEventInfo evt = new MoveEditor.ParticleEventInfo(e.stringParameter); ParticleEventInfo evt = e.EventRef as ParticleEventInfo; PlayParticle(evt._particleProperties); }
public void OnPlayParticleEx(ParticleEventInfo pe, bool target = false, Vector3 tarPos = new Vector3(), Animator tarAimator = null, Vector3 tarOrgPos = new Vector3(), Vector3 tarHitPos = new Vector3()) { PlayParticle(pe._particleProperties, 0, false, target, tarPos, tarAimator, tarOrgPos, tarHitPos); }