コード例 #1
0
        public bool DoSpecialMove(SpecialMoveBase NewMoveInstance, bool forceMove)
        {
            if (!forceMove && NewMoveInstance != null && !NewMoveInstance.CanDoSpecialMove(SpecialMove, forceMove))
            {
                NLogger.Instance.WriteString(LogType.Debug, string.Format("[SM] cannot do requested special move {0}", NewMoveInstance.ToString()));
                return(false);
            }

            SpecialMoveBase preSM = SpecialMove;

            if (preSM != null)
            {
                preSM.SpecialMoveEnded();
                OnSepcialMoveEnded(new SpecialMoveEventArgs(preSM));
            }

            SpecialMove = NewMoveInstance;
            if (SpecialMove != null)
            {
                SpecialMove.SpecailMoveStarted(forceMove, preSM);
                OnSepcialMoveStarted(new SpecialMoveEventArgs(SpecialMove));
            }

            return(true);
        }
コード例 #2
0
        public override void SpecailMoveStarted(bool forced, SpecialMoveBase prevMove)
        {
            base.SpecailMoveStarted(forced, prevMove);

            // 播放攻击动画
            this.OwnerCC.Avatar.SetAnim("atck");
            this.OwnerCC.Avatar.PlayAnim(false, 1.0f, 0.0f);
        }
コード例 #3
0
        protected override bool InternalCanDoSpecialMove(SpecialMoveBase oldSM)
        {
            if (this.OwnerCC != null &&
                this.OwnerCC.IsDoingSepcialMove(typeof(SpecialMove_Dead)))
            {
                return(false);
            }

            return(base.InternalCanDoSpecialMove(oldSM));
        }
コード例 #4
0
 /// <summary>
 /// 供外部调用判断是否可以执行
 /// </summary>
 /// <param name="forceCheck"></param>
 /// <returns></returns>
 public bool CanDoSpecialMove(SpecialMoveBase oldSM, bool forceCheck)
 {
     if (OwnerCC != null)
     {
         float currentTimeStamp = NativeEngineHelper.GetTimeSeconds();
         if (forceCheck || currentTimeStamp != LastCanDoSpecialMoveTime)
         {
             LastCanDoSpecialMove     = InternalCanDoSpecialMove(oldSM);
             LastCanDoSpecialMoveTime = currentTimeStamp;
         }
         return(LastCanDoSpecialMove);
     }
     return(false);
 }
コード例 #5
0
        public bool DoSpecialMoveByType(Type NewMove, bool forceMove)
        {
            if (SpecialMove != null && NewMove == SpecialMove.GetType())
            {
                // ignore redundant calls to the same move
                NLogger.Instance.WriteString(LogType.Debug, "[SM] ignoring redundant call.");
                return(false);
            }

            SpecialMoveBase NewMoveInstance = null;

            if (NewMove != null)
            {
                NewMoveInstance = Activator.CreateInstance(NewMove, new object[] { this }) as SpecialMoveBase;
            }
            return(DoSpecialMove(NewMoveInstance, forceMove));
        }
コード例 #6
0
        /// <summary>
        /// SM开始执行时调用
        /// </summary>
        /// <param name="forced">是否强制执行</param>
        /// <param name="prevMove">前一个SM的类型</param>
        public virtual void SpecailMoveStarted(bool forced, SpecialMoveBase prevMove)
        {
            if (OwnerCC == null)
            {
                NLogger.Instance.WriteString(LogType.Warning, "[SM] Invalid owner refrence!");
                return;
            }

            NLogger.Instance.WriteString(LogType.Debug, this.OwnerCC.ToString() + " do SM: " + this.ToString());

            if (RestoreMovement)
            {
                OldAcceleration = OwnerCC.Acceleration;
            }
            if (DisableMovement)
            {
                OwnerCC.Acceleration = Vector3.Zero;
            }
            PreSpecialMove   = RestorePreSpecialMove ? prevMove : null;
            OldSpeedModifier = OwnerCC.SpeedUp;
            OwnerCC.SpeedUp  = this.SpeedModifier;
        }
コード例 #7
0
 /// <summary>
 /// 供子类重载判断是否可以执行当前SpecailMove的接口
 /// </summary>
 /// <returns></returns>
 protected virtual bool InternalCanDoSpecialMove(SpecialMoveBase oldSM)
 {
     return(true);
 }
コード例 #8
0
 public SpecialMoveEventArgs(SpecialMoveBase sm)
 {
     this.SM = SM;
 }