protected override void OnUpdate() { base.OnUpdate(); if (unitData == null) { return; } if (!unitData.death && unitData.hp <= 0) { unitData.death = true; } if (_death != unitData.death) { _death = unitData.death; if (_death) { SoliderPoolItem soliderPoolItem = GetComponent <SoliderPoolItem>(); UnitPath unitPath = GetComponent <UnitPath>(); unitPath.state = UnitPathState.Die; if (unitData.isHitFly) { unitAgent.HitFly(); if (soliderPoolItem != null) { // soliderPoolItem.DelayRelease(3F); soliderPoolItem.Release(); } else { delayDestory.delayTime = 3F; delayDestory.enabled = true; } } else { if (soliderPoolItem != null) { soliderPoolItem.Release(); } else { delayDestory.delayTime = 0F; delayDestory.enabled = true; } } } } }
public void OnSteeringRequestSucceeded() { if (unitPath && unitPath.state == UnitPathState.Die) { return; } RelationType relation = unitData.GetRelation(unitData.to.legionId); if (relation == RelationType.Enemy) { if (unitPath.needAround) { if (unitPath.state == UnitPathState.Ining) { unitPath.HitFly(); } } else { unitData.to.unit.GetComponent <BBuildShake>().Play(); Die(); } } else { delayDestory = GetComponent <DelayDestory>(); if (unitData != null && unitData.to != null) { // War.textEffect.PlayHP(unitData.hp, unitData.to.unit); unitData.to.hp += unitData.hp; } SoliderPoolItem soliderPoolItem = GetComponent <SoliderPoolItem>(); if (soliderPoolItem != null) { soliderPoolItem.Release(); } else { delayDestory.delayTime = 0F; delayDestory.enabled = true; } } }