Пример #1
0
    public virtual void OnForceToMove(MVCommand ev)
    {
        StopPathFinding();
        Vector2 delta = ev.Delta;

        CacheTransform.LookAt(new Vector3(CacheTransform.position.x + delta.x, CacheTransform.position.y, CacheTransform.position.z + delta.y));
        mCharacter.SimpleMove(mCharacter.transform.forward * mCurrAttr.Speed);
        this.mActorAction.Play("Walk", null, true);
    }
Пример #2
0
        ////麻痹
        //protected virtual CommandReplyType CheckPalsy(MBCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_PARALY, cmd);
        //    return CommandReplyType.YES;
        //}

        ////睡眠
        //protected virtual CommandReplyType CheckSleep(SPCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_SLEEP, cmd);
        //    return CommandReplyType.YES;
        //}

        ////致盲
        //protected virtual CommandReplyType CheckBlind(ZMCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_BLIND, cmd);
        //    return CommandReplyType.YES;
        //}

        ////恐惧
        //protected virtual CommandReplyType CheckFear(FRCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_FEAR, cmd);
        //    return CommandReplyType.YES;
        //}

        ////定身
        //protected virtual CommandReplyType CheckFixBody(FBCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    SendStateMessage(ActorFsmStateType.FSM_FIXBODY, cmd);
        //    return CommandReplyType.YES;
        //}

        ////受击
        //protected virtual CommandReplyType CheckWound(WDCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    cmd.LastTime = mActorAction.GetAnimLength("hit");
        //    SendStateMessage(ActorFsmStateType.FSM_WOUND, cmd);
        //    return CommandReplyType.YES;
        //}

        ////击退
        //protected virtual CommandReplyType CheckBeatBack(BBCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_BEATBACK, cmd);
        //    return CommandReplyType.YES;
        //}

        ////击飞
        //protected virtual CommandReplyType CheckBeatFly(BFCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    cmd.LastTime = mActorAction.GetAnimLength("fly");
        //    SendStateMessage(ActorFsmStateType.FSM_BEATFLY, cmd);
        //    return CommandReplyType.YES;
        //}

        ////击倒
        //protected virtual CommandReplyType CheckBeatDown(BDCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    cmd.LastTime = mActorAction.GetAnimLength("down");
        //    SendStateMessage(ActorFsmStateType.FSM_BEATDOWN, cmd);
        //    return CommandReplyType.YES;
        //}

        ////浮空
        //protected virtual CommandReplyType CheckFly(FLCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_FLOATING, cmd);
        //    return CommandReplyType.YES;
        //}

        ////被勾取
        //protected virtual CommandReplyType CheckHook(HKCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_HOOK, cmd);
        //    return CommandReplyType.YES;
        //}

        ////被抓取
        //protected virtual CommandReplyType CheckGrab(GBCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_GRAB, cmd);
        //    return CommandReplyType.YES;
        //}

        ////变形
        //protected virtual CommandReplyType CheckVariation(VACommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Divine) == true)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    mActorSkill.Clear();
        //    SendStateMessage(ActorFsmStateType.FSM_VARIATION, cmd);
        //    return CommandReplyType.YES;
        //}

        ////骑乘
        //protected virtual CommandReplyType CheckRide(ERCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (Launcher.Instance.GetCurrSceneType() != ESceneType.City)
        //    {
        //        ShowWarning("300002");
        //        return CommandReplyType.NO;
        //    }
        //    if (m_ActorFsm == ActorFsmStateType.FSM_RUN || m_ActorFsm == ActorFsmStateType.FSM_WALK || m_ActorFsm == ActorFsmStateType.FSM_SKILL)
        //    {
        //        ShowWarning("300003");
        //        return CommandReplyType.NO;
        //    }
        //    if (mActorCard.GetMountID() == 0)
        //    {
        //        ShowWarning("300004");
        //        return CommandReplyType.NO;
        //    }
        //    OnBeginRide();
        //    return CommandReplyType.YES;
        //}

        //private CommandReplyType CheckReborn(RBCommand cmd)
        //{
        //    cmd.LastTime = mActorAction.GetAnimLength("fuhuo");
        //    SendStateMessage(ActorFsmStateType.FSM_REBORN, cmd);
        //    return CommandReplyType.YES;
        //}

        ////跳跃
        //protected virtual CommandReplyType CheckJump(JPCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (GetActorEffect(EActorEffect.Is_Ride) == true)
        //    {
        //        ShowWarning("100011");
        //        return CommandReplyType.NO;
        //    }
        //    SendStateMessage(ActorFsmStateType.FSM_JUMP);
        //    return CommandReplyType.YES;
        //}

        ////隐身
        //protected virtual CommandReplyType CheckSteal(YSCommand cmd)
        //{
        //    if (m_ActorFsm != ActorFsmStateType.FSM_IDLE ||
        //       m_ActorFsm != ActorFsmStateType.FSM_RUN ||
        //       m_ActorFsm != ActorFsmStateType.FSM_WALK)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    this.OnBeginStealth(cmd.LastTime);
        //    return CommandReplyType.YES;
        //}

        ////交互
        //private CommandReplyType CheckInterActive(ITCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (m_ActorFsm == ActorFsmStateType.FSM_DEAD)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (cmd.AnimName == "idle")
        //    {
        //        cmd.LastTime = 1;
        //    }
        //    else
        //    {
        //        cmd.LastTime = mActorAction.GetAnimLength(cmd.AnimName);
        //    }
        //    SendStateMessage(ActorFsmStateType.FSM_INTERACTIVE, cmd);
        //    return CommandReplyType.YES;
        //}

        //private CommandReplyType CheckMine(CJCommand cmd)
        //{
        //    if (CannotControlSelf())
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    if (m_ActorFsm == ActorFsmStateType.FSM_DEAD)
        //    {
        //        return CommandReplyType.NO;
        //    }
        //    cmd.LastTime = mActorAction.GetAnimLength("miss");
        //    SendStateMessage(ActorFsmStateType.FSM_INTERACTIVE, cmd);
        //    return CommandReplyType.YES;
        //}

        #endregion

        #region Action

        /// <summary>
        /// 强制移动
        /// </summary>
        public virtual void OnForceToMove(MoveCommand ev)
        {
            StopPathFinding();
            Vector3 delta = ev.Delta;
            int     speed = 5; //Attrbute.GetValue(ActorAttributeType.Speed);

            CacheTransform.LookAt(new Vector3(CacheTransform.position.x + delta.x, CacheTransform.position.y,
                                              CacheTransform.position.z + delta.y));
            m_CharacterController.SimpleMove(delta * speed);
            this.m_AnimController.Play("run", null, true);
        }
Пример #3
0
 public virtual void OnAttack()
 {
     if (this.ActorType == EActorType.MONSTER)
     {
         StopPathFinding();
         CacheTransform.LookAt(this.mTarget.CacheTransform);
         this.mActorAction.Play("Gun", GotoEmptyFSM, true);
     }
     else
     {
         this.mActorAction.Play("Knife2", GotoEmptyFSM, false);
     }
 }
Пример #4
0
    public void LookAtEnemy()
    {
        if (mTarget == null || mTarget.IsDead()) //|| !IsEnemy(mTarget) || mTarget.GetActorEffect(EActorEffect.IS_Stealth) == true)
        {
            mTarget = null;
        }
        Actor enemy = GetNearestEnemy(mActorAI.WARDIST);

        this.SetTarget(enemy);
        if (mTarget != null)
        {
            CacheTransform.LookAt(new Vector3(mTarget.Pos.x, Pos.y, mTarget.Pos.z));
        }
    }
Пример #5
0
 public virtual void SetTarget(ActorBase actor)
 {
     if (actor == null)
     {
         m_Target = null;
         return;
     }
     if (m_Target == actor)
     {
         return;
     }
     m_Target = actor;
     CacheTransform.LookAt(m_Target.CacheTransform);
 }
Пример #6
0
        public override void Execute()
        {
            base.Execute();
            CacheTransform.LookAt(m_DestPosition);
            float distance = GTTools.GetHorizontalDistance(CacheTransform.position, m_DestPosition);

            if (m_VAngle != 0 || m_HAngle != 0)
            {
                float percent = Mathf.Min(1, distance / m_DistanceToTarget);
                float v       = percent * m_VAngle;
                float h       = percent * m_HAngle;
                CacheTransform.rotation *= Quaternion.Euler(Mathf.Clamp(v, -60, 60), Mathf.Clamp(h, -60, 60), 0);
            }
            CacheTransform.position += CacheTransform.forward * mMoveSpeed * Time.deltaTime;
        }
Пример #7
0
        protected void LookAtEnemy()
        {
            if (m_Target == null || m_Target.IsDead || !IsEnemy(m_Target) || m_Target.CheckActorState(ActorStateType.IsStealth))
            {
                m_Target = null;
            }

            ActorBase enemy = GetNearestEnemy(m_ActorAI.WaringDist);

            this.SetTarget(enemy);
            if (m_Target != null)
            {
                CacheTransform.LookAt(new Vector3(m_Target.Pos.x, Pos.y, m_Target.Pos.z));
            }
        }
Пример #8
0
        /// <summary>
        /// 转向
        /// </summary>
        public virtual void OnTurnTo(TurnToCommand ev)
        {
            Vector3 pos = new Vector3(ev.LookDirection.x, CacheTransform.position.y, ev.LookDirection.z);

            CacheTransform.LookAt(pos);
        }