| | |
| | | /// </summary> |
| | | public override void Remove() |
| | | { |
| | | GameObject prefab = Resources.Load<GameObject>("Prefabs/Endless/AgentDeathEffect"); |
| | | GameObject obj = Poolable.TryGetPoolable(prefab); |
| | | obj.transform.position = transform.position; |
| | | ParticleSystem ps = obj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | ps?.Play(); |
| | | |
| | | // 统一管理器内删除当前的Agent: |
| | | AgentInsManager.instance.removeAgent(this); |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessAgentDead, this); |
| | |
| | | return; |
| | | } |
| | | |
| | | float atime = 0; |
| | | |
| | | /// <summary> |
| | | /// 更新动作信息. |
| | | /// </summary> |
| | |
| | | ActionState = state; |
| | | if (ActionAnimator != null) |
| | | ActionAnimator.SetInteger(paramName, (int)state); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检查自身血量 |
| | | /// </summary> |
| | | private void CheckHealth() |
| | | { |
| | | if (this.healthVal <= 0.1) |
| | | { |
| | | Die(); |
| | | |
| | | //Debug.Log("删除多余的攻击Agent."); |
| | | } |
| | | } |
| | | |
| | | private void Die() |
| | | { |
| | | // 统一管理器内删除当前的Agent: |
| | | AgentInsManager.instance.removeAgent(this); |
| | | this.Remove(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | public override void PlayDeath() |
| | | { |
| | | if (bInDeathAct) return; |
| | | |
| | | if (isPoison) |
| | | { |
| | | isPoison = false; |
| | |
| | | } |
| | | } |
| | | |
| | | ChangeState(AgentActionState.Death); |
| | | // 统一管理器内删除当前的Agent: |
| | | AgentInsManager.instance.removeAgent(this); |
| | | bInDeathAct = true; |
| | | Remove(); |
| | | } |
| | | |
| | | /// <summary> |