public void Process(EntityParent entity, params object[] args) { deadFx = entity.Transform.GetComponent <_2dxFX_DesintegrationFX>(); if (deadFx != null) { deadFx.ForceMaterial = entity.Transform.GetComponent <MeshRenderer>().material; deadFx.enabled = true; } entity.animator.CrossFade("Dead", 0.0f); entity.bIsDead = true; entity.entityActor.moveDir = Vector3.zero; entity.LeaveLevel(); DataEntityList data = DataEntityList.dataMap[entity.type]; AudioType type = AudioType.纹身男死亡; switch (data.Name) { case "纹身男": type = AudioType.纹身男死亡; break; case "胖子男": type = AudioType.胖子男死亡; break; } //播放死亡音效 AudioManagerBase.Instance.LogicPlaySoundByClip(entity.audioSource, ResourcePoolManager.singleton.GetAudioClip(type)); }
public void Clear() { if (this is EntityMyself && PlayerManager.singleton.MySelf == null) { return; } if (this.timer.Count != 0) { foreach (var id in timer) { TimerManager.DelTimer(id); } this.timer.Clear(); } if (this.Effcets.Count != 0) { foreach (var effect in this.Effcets) { PoolManager.Pools[PoolManager.EffectPoolName].Despawn(effect.transform); } this.Effcets.Clear(); } PoolManager.Pools[PoolManager.EffectPoolName].Despawn(Transform); this.collider2d.enabled = false; this.entityActor.enabled = false; this.animator = null; this.fsmMotion = null; _2dxFX_DesintegrationFX deadFx = this.GameObject.GetComponent <_2dxFX_DesintegrationFX>(); if (deadFx != null) { deadFx.Desintegration = 0; } this.entityActor = null; this.audioSource.clip = null; this.audioSource = null; }
public override void OnInspectorGUI() { m_object.Update(); DrawDefaultInspector(); _2dxFX_DesintegrationFX _2dxScript = (_2dxFX_DesintegrationFX)target; Texture2D icon = Resources.Load("2dxfxinspector") as Texture2D; if (icon) { Rect r; float ih = icon.height; float iw = icon.width; float result = ih / iw; float w = Screen.width; result = result * w; r = GUILayoutUtility.GetRect(ih, result); EditorGUI.DrawTextureTransparent(r, icon); } EditorGUILayout.PropertyField(m_object.FindProperty("ActiveUpdate"), new GUIContent("Active Update", "Active Update, for animation / Animator only")); EditorGUILayout.PropertyField(m_object.FindProperty("ForceMaterial"), new GUIContent("Shared Material", "Use a unique material, reduce drastically the use of draw call")); if (_2dxScript.ForceMaterial == null) { _2dxScript.ActiveChange = true; } else { if (GUILayout.Button("Remove Shared Material")) { _2dxScript.ForceMaterial = null; _2dxScript.ShaderChange = 1; _2dxScript.ActiveChange = true; _2dxScript.CallUpdate(); } EditorGUILayout.PropertyField(m_object.FindProperty("ActiveChange"), new GUIContent("Change Material Property", "Change The Material Property")); } if (_2dxScript.ActiveChange) { EditorGUILayout.BeginVertical("Box"); Texture2D icone = Resources.Load("2dxfx-icon-value") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("Desintegration"), new GUIContent("Desintegration Value", icone, "Change the desintragration value")); icone = Resources.Load("2dxfx-icon-color") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Color"), new GUIContent("Change the Color", icone, "Change the color the sprite")); icone = Resources.Load("2dxfx-icon-value") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("Seed"), new GUIContent("Seed", icone, "Change the random seed")); EditorGUILayout.BeginVertical("Box"); icone = Resources.Load("2dxfx-icon-fade") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Alpha"), new GUIContent("Fading", icone, "Fade from nothing to showing")); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); } m_object.ApplyModifiedProperties(); }