void Start() { deathBehavior = GetComponent <DeathBehaviour>(); if (!deathBehavior) { Debug.LogWarning("Health does not have access to a DeathBehaviour component - unit with never dye (health will just become negitive)."); } }
protected override ErrorCode doStart(ActionInitParam param) { ActionDieInitParam initParam = param as ActionDieInitParam; if (!mOwner.IsDead()) { return(ErrorCode.LogicError); } // 禁止攻击/移动/使用技能, 并停止当前的此类Action. mOwner.AddActiveFlag(ActiveFlagsDef.DisableAttack, true, true); mOwner.AddActiveFlag(ActiveFlagsDef.DisableMovement, true, true); mOwner.AddActiveFlag(ActiveFlagsDef.DisableSkillUse, true, true); mOwner.AddActiveFlag(ActiveFlagsDef.DisableRotate, true, true); mOwner.AddActiveFlag(ActiveFlagsDef.Inviolability, true, false); mDeathBehaviour = new DeathBehaviour(); mDeathBehaviour.Start(mOwner, initParam.damageType, initParam.attackerAttr); return(base.doStart(param)); }
void Start() { deathBehavior = GetComponent<DeathBehaviour>(); if( ! deathBehavior ) Debug.LogWarning( "Health does not have access to a DeathBehaviour component - unit with never dye (health will just become negitive)." ); }