Exemplo n.º 1
0
    private static int SyncJump(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 11);
            JumpBase jumpBase      = (JumpBase)ToLua.CheckObject(L, 1, typeof(JumpBase));
            int      dir           = (int)LuaDLL.luaL_checknumber(L, 2);
            int      type          = (int)LuaDLL.luaL_checknumber(L, 3);
            float    vertSpeed     = (float)LuaDLL.luaL_checknumber(L, 4);
            float    horizSpeed    = (float)LuaDLL.luaL_checknumber(L, 5);
            float    horizAccSpeed = (float)LuaDLL.luaL_checknumber(L, 6);
            float    endHorizSpeed = (float)LuaDLL.luaL_checknumber(L, 7);
            float    curX          = (float)LuaDLL.luaL_checknumber(L, 8);
            float    curY          = (float)LuaDLL.luaL_checknumber(L, 9);
            float    curZ          = (float)LuaDLL.luaL_checknumber(L, 10);
            float    curTimer      = (float)LuaDLL.luaL_checknumber(L, 11);
            jumpBase.SyncJump(dir, type, vertSpeed, horizSpeed, horizAccSpeed, endHorizSpeed, curX, curY, curZ, curTimer);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemplo n.º 2
0
 public void StartPlotJump(int doorNo, int endMap, Action onJumpFinished)
 {
     if (this.curIndex == 0)
     {
         this.gateNo   = doorNo;
         this.endMapId = endMap;
         this.InitJumpData(doorNo);
         JumpBase[] components = this._self.GetComponents <JumpBase>();
         for (int i = 0; i < components.Length; i++)
         {
             if (components[i] is PlotJump)
             {
                 PlotJump x = (PlotJump)components[i];
                 if (x != null)
                 {
                     this.plotJumpSystem         = x;
                     this.plotJumpSystem.enabled = true;
                 }
             }
             else
             {
                 this.normalJumpSystem         = components[i];
                 this.normalJumpSystem.enabled = false;
             }
         }
     }
     else if (this.curIndex == this.targetPosition.Count)
     {
         this.plotJumpSystem.PlotJumpClear();
         this.plotJumpSystem.enabled   = false;
         this.normalJumpSystem.enabled = true;
         if (onJumpFinished != null)
         {
             onJumpFinished();
         }
         onJumpFinished = null;
         if (this._self.entityType == RoleManager.EntityType.EntityType_Self)
         {
             Singleton <RoleManager> .Instance.cf.CameraTargetToSelf(false);
         }
         this.SendPlotJumpOver();
         UnityEngine.Object.Destroy(this);
         return;
     }
     if (this.plotJumpSystem != null)
     {
         this._self.move.StopPath();
         this.plotJumpSystem.StartPlotJump(this.targetPosition[this.curIndex], this.startVerSpeed[this.curIndex], this.vertAccSpeed[this.curIndex], this.actionIndex[this.curIndex], delegate
         {
             this.curIndex++;
             this.StartPlotJump(doorNo, endMap, onJumpFinished);
         });
     }
 }
Exemplo n.º 3
0
    private static int StopJump(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            JumpBase jumpBase = (JumpBase)ToLua.CheckObject(L, 1, typeof(JumpBase));
            jumpBase.StopJump();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemplo n.º 4
0
    private static int set_offsetX(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            JumpBase jumpBase = (JumpBase)obj;
            float    offsetX  = (float)LuaDLL.luaL_checknumber(L, 2);
            jumpBase.offsetX = offsetX;
            result           = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index offsetX on a nil value");
        }
        return(result);
    }
Exemplo n.º 5
0
    private static int set__self(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            JumpBase    jumpBase = (JumpBase)obj;
            SceneEntity self     = (SceneEntity)ToLua.CheckUnityObject(L, 2, typeof(SceneEntity));
            jumpBase._self = self;
            result         = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index _self on a nil value");
        }
        return(result);
    }
Exemplo n.º 6
0
    private static int get_endHorizSpeed(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            JumpBase jumpBase      = (JumpBase)obj;
            float    endHorizSpeed = jumpBase.endHorizSpeed;
            LuaDLL.lua_pushnumber(L, (double)endHorizSpeed);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index endHorizSpeed on a nil value");
        }
        return(result);
    }
Exemplo n.º 7
0
    private static int get_startPos(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            JumpBase jumpBase = (JumpBase)obj;
            Vector3  startPos = jumpBase.startPos;
            ToLua.Push(L, startPos);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index startPos on a nil value");
        }
        return(result);
    }
Exemplo n.º 8
0
    private static int get_jumpMode(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            JumpBase jumpBase = (JumpBase)obj;
            int      jumpMode = jumpBase.jumpMode;
            LuaDLL.lua_pushinteger(L, jumpMode);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index jumpMode on a nil value");
        }
        return(result);
    }
Exemplo n.º 9
0
    private static int get__self(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            JumpBase    jumpBase = (JumpBase)obj;
            SceneEntity self     = jumpBase._self;
            ToLua.Push(L, self);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index _self on a nil value");
        }
        return(result);
    }
Exemplo n.º 10
0
    private static int get_plotJumpSystem(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            Move     move           = (Move)obj;
            JumpBase plotJumpSystem = move.plotJumpSystem;
            ToLua.Push(L, plotJumpSystem);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index plotJumpSystem on a nil value");
        }
        return(result);
    }
Exemplo n.º 11
0
    private static int set_plotJumpSystem(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            Move     move           = (Move)obj;
            JumpBase plotJumpSystem = (JumpBase)ToLua.CheckUnityObject(L, 2, typeof(JumpBase));
            move.plotJumpSystem = plotJumpSystem;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index plotJumpSystem on a nil value");
        }
        return(result);
    }
Exemplo n.º 12
0
    private static int UpdateJump(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 4);
            JumpBase jumpBase      = (JumpBase)ToLua.CheckObject(L, 1, typeof(JumpBase));
            bool     isGrounded    = LuaDLL.luaL_checkboolean(L, 2);
            Vector3  finalPosition = ToLua.ToVector3(L, 3);
            bool     shakeCamera   = LuaDLL.luaL_checkboolean(L, 4);
            jumpBase.UpdateJump(isGrounded, finalPosition, shakeCamera);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemplo n.º 13
0
    private static int RoleJump(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 6);
            JumpBase jumpBase      = (JumpBase)ToLua.CheckObject(L, 1, typeof(JumpBase));
            float    vertSpeed     = (float)LuaDLL.luaL_checknumber(L, 2);
            float    horizSpeed    = (float)LuaDLL.luaL_checknumber(L, 3);
            float    dashIncFactor = (float)LuaDLL.luaL_checknumber(L, 4);
            float    horizAccSpeed = (float)LuaDLL.luaL_checknumber(L, 5);
            float    horizEndSpeed = (float)LuaDLL.luaL_checknumber(L, 6);
            jumpBase.RoleJump(vertSpeed, horizSpeed, dashIncFactor, horizAccSpeed, horizEndSpeed);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemplo n.º 14
0
    private static int OnJumpFinished(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 7);
            JumpBase jumpBase = (JumpBase)ToLua.CheckObject(L, 1, typeof(JumpBase));
            int      x        = (int)LuaDLL.luaL_checknumber(L, 2);
            int      z        = (int)LuaDLL.luaL_checknumber(L, 3);
            float    realX    = (float)LuaDLL.luaL_checknumber(L, 4);
            float    realY    = (float)LuaDLL.luaL_checknumber(L, 5);
            float    realZ    = (float)LuaDLL.luaL_checknumber(L, 6);
            float    timer    = (float)LuaDLL.luaL_checknumber(L, 7);
            jumpBase.OnJumpFinished(x, z, realX, realY, realZ, timer);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemplo n.º 15
0
    private void Update()
    {
        if (!Singleton <RoleManager> .Instance.mainRole)
        {
            return;
        }
        if (this.cameraTarget == Singleton <RoleManager> .Instance.mainRole)
        {
            return;
        }
        SceneEntity mainRole = Singleton <RoleManager> .Instance.mainRole;

        if (this.cameraTarget.position != mainRole.transform.position)
        {
            float num = Vector3.Distance(this.cameraTarget.position, mainRole.transform.position);
            if (num > 10f)
            {
                this.CameraTargetToSelf(true);
                return;
            }
            this.reset = (!mainRole.move.InMoving() && mainRole.move.jumpMode == 0);
            if (this.jumpMode != 0 && this.reset)
            {
                this.jumpMode = 0;
            }
            if (num > 0.8f || ((this.reset || this.jumpMode != 0) && this.startMove))
            {
                if (!this.startMove)
                {
                    this.startMove = true;
                }
                this.cameraTarget.rotation = mainRole.transform.rotation;
                if (this.jumpMode == 0)
                {
                    float num2 = mainRole.move.speed * mainRole.move.speedFactor;
                    if (num > 1.5f)
                    {
                        num2 *= 1.5f;
                    }
                    float   maxDistanceDelta = num2 * Time.deltaTime;
                    Vector3 position         = Vector3.MoveTowards(this.cameraTarget.transform.position, mainRole.transform.position, maxDistanceDelta);
                    this.cameraTarget.position = position;
                }
                else
                {
                    JumpBase jumpSystem = mainRole.move.jumpSystem;
                    if (this.startPos == Vector3.zero)
                    {
                        if (this.cameraTarget.position.y - mainRole.transform.position.y > 0.1f)
                        {
                            this.startPos = mainRole.transform.position;
                        }
                        else
                        {
                            this.startPos = this.cameraTarget.position;
                        }
                        this.curVertSpeed = mainRole.move.jumpSystem.startVertSpeed;
                    }
                    else
                    {
                        Vector3 vector = this.cameraTarget.forward * jumpSystem.offsetX;
                        if (this.jumpMode != 2)
                        {
                            if (this.jumpMode != 3 || this.cameraTarget.position.y >= mainRole.transform.position.y + 0.3f)
                            {
                                this.curVertSpeed -= this.gravity * Time.deltaTime;
                                this.offsetY      += this.curVertSpeed * Time.deltaTime;
                            }
                        }
                        this.cameraTarget.position = new Vector3(this.startPos.x + vector.x, this.startPos.y + this.offsetY, this.startPos.z + vector.z);
                    }
                }
            }
        }
        else
        {
            if (this.startPos != Vector3.zero)
            {
                this.startPos = Vector3.zero;
            }
            if (this.reset)
            {
                this.reset = false;
            }
            if (this.startMove)
            {
                this.startMove = false;
            }
        }
    }