static int OnExit(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        PlayerState_Skill obj = (PlayerState_Skill)LuaScriptMgr.GetNetObjectSelf(L, 1, "PlayerState_Skill");

        obj.OnExit();
        return(0);
    }
    static int Update(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        PlayerState_Skill obj = (PlayerState_Skill)LuaScriptMgr.GetNetObjectSelf(L, 1, "PlayerState_Skill");

        IM.Number arg0 = (IM.Number)LuaScriptMgr.GetNetObject(L, 2, typeof(IM.Number));
        obj.Update(arg0);
        return(0);
    }
    static int OnEnter(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        PlayerState_Skill obj  = (PlayerState_Skill)LuaScriptMgr.GetNetObjectSelf(L, 1, "PlayerState_Skill");
        PlayerState       arg0 = (PlayerState)LuaScriptMgr.GetNetObject(L, 2, typeof(PlayerState));

        obj.OnEnter(arg0);
        return(0);
    }
    static int _CreatePlayerState_Skill(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2)
        {
            PlayerStateMachine arg0 = (PlayerStateMachine)LuaScriptMgr.GetNetObject(L, 1, typeof(PlayerStateMachine));
            GameMatch          arg1 = (GameMatch)LuaScriptMgr.GetNetObject(L, 2, typeof(GameMatch));
            PlayerState_Skill  obj  = new PlayerState_Skill(arg0, arg1);
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: PlayerState_Skill.New");
        }

        return(0);
    }
    static int set_m_bPersistent(IntPtr L)
    {
        object            o   = LuaScriptMgr.GetLuaObject(L, 1);
        PlayerState_Skill obj = (PlayerState_Skill)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name m_bPersistent");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index m_bPersistent on a nil value");
            }
        }

        obj.m_bPersistent = LuaScriptMgr.GetBoolean(L, 3);
        return(0);
    }
Example #6
0
    bool _MatchAction(Command curCommand, SkillInstance skillInstance, bool bIgnoreDir)
    {
        List <SkillAction> matchedActions = new List <SkillAction>();

        SkillAttr skill = skillInstance.skill;
        int       cnt   = skill.actions.Count;

        for (int idx = 0; idx != cnt; idx++)
        {
            SkillAction action = skill.actions[idx];
            SkillInput  input  = action.inputs[0];
            if (input.cmd != curCommand)
            {
                continue;
            }
            EDirection dir = m_player.m_inputDispatcher.GetMoveDirection(input.inputType);
            if (input.moveDir != dir || (bIgnoreDir && input.moveDir != EDirection.eNone))
            {
                continue;
            }
            matchedActions.Add(action);
        }

        if (matchedActions.Count == 0)
        {
            return(false);
        }

        int         iSelActionIdx = IM.Random.Range(0, matchedActions.Count);
        SkillAction finalAction   = matchedActions[iSelActionIdx];

        PlayerState       curState   = m_player.m_StateMachine.m_curState;
        PlayerState_Skill skillState = curState as PlayerState_Skill;

        if (finalAction.interrupts.Count > 0)
        {
            foreach (SkillInterrupt interrupt in finalAction.interrupts)
            {
                if (!curState.m_lstActionId.Contains(interrupt.id))
                {
                    continue;
                }
                Debug.Log("Interrupt action: " + skillInstance.skill.action_type + " , action id: " + finalAction.id);
                //matched
                skillInstance.curAction     = finalAction;
                skillInstance.matchedKeyIdx = iSelActionIdx;
                return(true);
            }
            return(false);
        }
        else if (skillState == null)
        {
            skillInstance.curAction     = finalAction;
            skillInstance.matchedKeyIdx = iSelActionIdx;
            return(true);
        }
        else if (skillState != null && skillState.m_bPersistent)
        {
            skillInstance.curAction     = finalAction;
            skillInstance.matchedKeyIdx = iSelActionIdx;
            return(true);
        }

        return(false);
    }