public void ActivateEffect(PeEntity peEntity) { if (peEntity.HPPercent <= m_hpPercent && !peEntity.IsDeath()) { if (m_effect == null && m_Request == null) { m_Request = EffectBuilder.Instance.Register(m_effectID, null, peEntity.tr); m_Request.SpawnEvent += OnSpawned; m_auCtrl = AudioManager.instance.Create(peEntity.position, m_AudioID, null, true, false); } if (m_effect != null && !m_effect.activeSelf) { m_effect.SetActive(true); if (m_auCtrl != null) { m_auCtrl.PlayAudio(2.0f); } } } else { if (m_effect != null && m_effect.activeSelf) { m_effect.SetActive(false); if (m_auCtrl != null) { m_auCtrl.StopAudio(2.0f); } } } }
public TowerEffect(float argHpPercent, int argEffectID, int argAudioID) { m_hpPercent = argHpPercent; m_effectID = argEffectID; m_AudioID = argAudioID; m_effect = null; m_Request = null; m_auCtrl = null; }
public override void Do() { Clear(); for (int i = 0; i < effectID.Length; ++i) { EffectBuilder.EffectRequest request = EffectBuilder.Instance.Register(effectID[i], null, entity.biologyViewCmpt.modelTrans); request.SpawnEvent += OnSpawn; } m_PlayEffect = true; }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); if (effectId > 0) { m_Request = EffectBuilder.Instance.Register(effectId, null, animator.transform); m_Request.SpawnEvent += OnEffectSpawned; } }
public void Destroy() { if (m_effect != null) { GameObject.Destroy(m_effect); } if (m_auCtrl != null) { m_auCtrl.Delete(); } m_auCtrl = null; m_Request = null; }
void SetupEffect(IntVector4 node) { Vector3 position = node.ToVector3(); position += new Vector3(Random.Range(0.0f, VoxelTerrainConstants._numVoxelsPerAxis << node.w), 0.0f, Random.Range(0.0f, VoxelTerrainConstants._numVoxelsPerAxis << node.w)); int height = VoxelTerrainConstants._numVoxelsPerAxis << node.w; RaycastHit hitInfo; if (Physics.Raycast(position + Vector3.up * height, Vector3.down, out hitInfo, height, GameConfig.GroundLayer)) { float waterHeight; int type1 = -1; int type2 = -1; if (PETools.PEUtil.GetWaterSurfaceHeight(hitInfo.point, out waterHeight)) { if (Random.value < 0.3f) { type1 = 0; position = new Vector3(hitInfo.point.x, waterHeight, hitInfo.point.z); } else { type1 = 1; position = hitInfo.point + Vector3.up * Random.Range(0.0f, waterHeight - hitInfo.point.y); } } else { type1 = 2; position = hitInfo.point + Vector3.up * Random.Range(0.5f, 5.0f); } type2 = CalculateType(position); int effectID = AISpawnDataStory.GetEnvEffectID(GetMapID(position), type1, type2); Transform parent = mEffectPoint != null ? mEffectPoint.transform : null; EffectBuilder.EffectRequest req = EffectBuilder.Instance.Register(effectID, null, position, Quaternion.identity, parent); req.SpawnEvent += OnEffectSpawned; } }
void StartEffect(int effectID = 0) { EffectBuilder.EffectRequest request = EffectBuilder.Instance.Register(effectID, null, viewCmpt.modelTrans); request.SpawnEvent += OnEffectSpawn; }