private void Die(Bio killer) { this._script?.Call(Script.S_ON_ENTITY_DIE); killer?.OnKillTarget(this); int count = this._buffStates.Count; for (int i = 0; i < count; i++) { this._buffStates[i].OnDie(killer); } while (this._buffStates.Count > 0) { this.DestroyBuffStateImmediately(this._buffStates[0]); } this.UpdateVelocity(Vec3.zero); this.sensorySystem.Clear(); this.property.Add(Attr.Gold, -this.goldBountyAwarded); SyncEventHelper.ChangeState(this.rid, FSMStateType.Dead); this.ChangeState(FSMStateType.Dead); this.brain.Rearbitrate(); this.brain.enable = false; SyncEventHelper.EntityDie(this.rid, killer == null ? string.Empty : killer.rid); }