Beispiel #1
0
 // 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);
 }
Beispiel #3
0
 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);
     }
 }
Beispiel #5
0
 /// <summary>
 /// 销毁本攻击对象
 /// </summary>
 /// <param name="attackObj">发出销毁请求的对方</param>
 /// <returns>是否销毁成功</returns>
 public abstract bool TryDestroy(AttackAbs attackObj);
 void Awake()
 {
     myAbs = this.gameObject.GetComponent <AttackAbs>();
 }