private void AddShield(BaseShieldBehaviour shieldBehaviour) { if (LeftHandle != null) { ShieldBehaviour = shieldBehaviour; ShieldBehaviour.OwnerMobileBehaviour = this; ShieldBehaviour.BeforeDefendingEvent += new BeforeDefendingEventHandler(SetDefendSpeedBefore); ShieldBehaviour.AfterDefendEvent += new AfterDefendEventHandler(SetDefendSpeedAfter); } }
public void Defend() { if (CanDefend() && LeftHandle != null && LeftHandle.transform.childCount > 0) { //Debug.Log(Time.time - lastDefendTime); lastDefendTime = Time.time; if (ShieldBehaviour == null) { ShieldBehaviour = RightHandle.GetComponentInChildren <BaseShieldBehaviour>(); if (WeaponBehaviour != null) { lastAttackTime = Time.time; ShieldBehaviour.Defend(); } } else { lastDefendTime = Time.time; ShieldBehaviour.Defend(); } } }