コード例 #1
0
    /// <summary>
    /// 走到副本的尽头
    /// </summary>
    /// <returns></returns>
    public BehaviourReturnCode ActionWalkToInstanceEndPosition()
    {
        if (RunningProperty.SelfActor.IsWalking())
        {
            return(BehaviourReturnCode.Success);
        }

        Vector3 endPosition = InstanceHelper.GetAutoRunnerTargetLocation();

        if (Vector3.Equals(endPosition, Vector3.zero))
        {
            return(BehaviourReturnCode.Success);
        }

        if (AIHelper.RoughlyEqual(endPosition, RunningProperty.SelfActorPos))
        {
            RunningProperty.AI.Machine.SwitchToState(BehaviourMachine.State.EMPTY);
            return(BehaviourReturnCode.Success);
        }

        endPosition.y = RoleHelp.GetHeightInScene(RunningProperty.SelfActor.ActorId, endPosition.x, endPosition.z);

        //endPosition = InstanceHelper.ClampInWalkableRange(endPosition);

        RunningProperty.AI.PathWalker.WalkTo(endPosition);

        //         uint instanceType = InstanceManager.Instance.InstanceType;
        //
        //         if (instanceType == GameConst.WAR_TYPE_WILD || instanceType == GameConst.WAR_TYPE_HOLE || instanceType == GameConst.WAR_SUBTYPE_WILD_PUB || instanceType == GameConst.WAR_TYPE_MULTI)
        //         {
        //             RunningProperty.AI.PathWalker.WalkTo(endPosition);
        //         }
        //         else
        //         {
        //             RunningProperty.SelfActor.MoveCtrl.TryWalkTo(endPosition);
        //         }

        RunningProperty.AI.Machine.SwitchToState(BehaviourMachine.State.WALK);

        return(BehaviourReturnCode.Success);
    }
コード例 #2
0
    /// <summary>
    /// 走路到某地-
    /// </summary>
    /// <param name="target"></param>
    public void WalkTo(Vector3 target)
    {
        if (TargetActor != null)
        {
            target.y = RoleHelp.GetHeightInScene(TargetActor.ActorId, target.x, target.z);
            target   = InstanceHelper.ClampInWalkableRange(target, 10);

            if (TargetActor.IsAttacking() == true)
            {
                Skill cur_skill = TargetActor.GetCurSkill();
                if (cur_skill != null)
                {
                    cur_skill.End();
                }
            }
            m_WalkId = TargetActor.MoveCtrl.TryWalkToAlong(target);
        }

        mWalkType  = WalkType.WALK;
        mTargetPos = target;
    }