Exemple #1
0
    public bool MoveTo(float x, float y, float z)
    {
        this.SetTargetPos(x, y, z);
        Nr3DCharBase nr3DCharBase = this.m_pkChar.Get3DChar();

        if (nr3DCharBase == null)
        {
            return(false);
        }
        if (!nr3DCharBase.IsCreated() || !nr3DCharBase.Is3DCharActive())
        {
            return(false);
        }
        NrCharDefine.eMoveTargetReason eMoveTargetReason = this.IsMovableArea(x, z);
        if (eMoveTargetReason != NrCharDefine.eMoveTargetReason.MTR_SUCCESS)
        {
            Vector3 lhs = Vector3.zero;
            lhs = this.FindMovableDestination(this.m_vTargetPos, eMoveTargetReason);
            if (lhs == Vector3.zero)
            {
                this.SetTargetPos(0f, 0f, 0f);
                return(false);
            }
            this.SetTargetPos(lhs.x, lhs.y, lhs.z);
        }
        if (this.m_vCharPos.x == this.m_vTargetPos.x && this.m_vCharPos.z == this.m_vTargetPos.z)
        {
            return(true);
        }
        this.MoveStart();
        return(true);
    }