// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); if (!_attack) { _attack = gameObject.GetComponent <AttackAbs>(); Debug.Assert(_attack, $"{this}: Attacking component missing on {gameObject.name}."); } }
public override bool TryDestroy(AttackAbs attackObj) { if (attackObj == this) { gameObject.SendMessage(GameobjBase.TryDestroyFUNC); //Destroy(gameObject); } return(true); }
public bool DestrotyGameObj(AttackAbs attackObj) { if (TryDestroy(attackObj)) { UnityEventCenter.SendMessage <DestroyEvent>(new DestroyEvent(gameObject, gameObject)); return(true); } else { return(false); } }
public override bool TryDestroy(AttackAbs attackObj) { if (attackObj.getAttackLevel() > getGuardLevel()) { gameObject.SendMessage(GameobjBase.TryDestroyFUNC); //Destroy(gameObject); return(true); } else { return(false); } }
/// <summary> /// 销毁本攻击对象 /// </summary> /// <param name="attackObj">发出销毁请求的对方</param> /// <returns>是否销毁成功</returns> public abstract bool TryDestroy(AttackAbs attackObj);
void Awake() { myAbs = this.gameObject.GetComponent <AttackAbs>(); }