static int InitState(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); PlayerState_DefenseCross obj = (PlayerState_DefenseCross)LuaScriptMgr.GetNetObjectSelf(L, 1, "PlayerState_DefenseCross"); obj.InitState(); return(0); }
static int Update(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); PlayerState_DefenseCross obj = (PlayerState_DefenseCross)LuaScriptMgr.GetNetObjectSelf(L, 1, "PlayerState_DefenseCross"); 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_DefenseCross obj = (PlayerState_DefenseCross)LuaScriptMgr.GetNetObjectSelf(L, 1, "PlayerState_DefenseCross"); PlayerState arg0 = (PlayerState)LuaScriptMgr.GetNetObject(L, 2, typeof(PlayerState)); obj.OnEnter(arg0); return(0); }
void _DoDefenseCross(Player defender) { PlayerState_DefenseCross state = defender.m_StateMachine.GetState(State.eDefenseCross) as PlayerState_DefenseCross; state.targetPos = targetPos; state.time = m_player.animMgr.GetDuration(m_curAction) / m_player.animMgr.GetSpeed(m_curAction) - m_time; state.crosser = m_player; state.InitState(); defender.m_StateMachine.SetState(state); m_bDefenderOp = true; }
//public override bool PreEnter() //{ // if (m_player.m_vVelocity == Vector3.zero) // { // return false; // } // else // { // Vector3 dirPlayerToBasket = GameUtils.HorizonalNormalized(m_match.mCurScene.mBasket.m_vShootTarget, m_player.position); // float moveAngle = Quaternion.FromToRotation(dirPlayerToBasket, m_player.m_vVelocity).eulerAngles.y; // if (135f < moveAngle && moveAngle < 225f) // { // return false; // } // } // return true; //} override public void OnEnter(PlayerState lastState) { base.OnEnter(lastState); m_player.forward = GameUtils.HorizonalNormalized(m_basket.m_vShootTarget, m_player.position); IM.Vector3 targetPos = GetEndPos(); Debugger.Instance.DrawSphere("CutInEndPos", (Vector3)targetPos, Color.green); Player defender = m_player.GetDefender(); if (defender != null && (defender.m_StateMachine.m_curState.m_eState == State.eStand || defender.m_StateMachine.m_curState.m_eState == State.eDefense || defender.m_StateMachine.m_curState.m_eState == State.eRun || defender.m_StateMachine.m_curState.m_eState == State.eRush)) { IM.Number crossRate = CalcCrossRate(m_player, defender); bool sumValue = random.AdjustRate(ref crossRate); IM.Number crossValue = IM.Random.value; bool crossed = crossValue < crossRate; Debugger.Instance.m_steamer.message = "CutIn succeed: " + crossed + " Rate: " + crossRate + " Value: " + crossValue; //should use sendmessage if (crossed) { if (sumValue) { random.SumValue(); } m_player.mStatistics.SkillUsageSuccess(m_curExecSkill.skill.id, true); } else { PlayerState_DefenseCross state = defender.m_StateMachine.GetState(State.eDefenseCross) as PlayerState_DefenseCross; state.targetPos = targetPos; state.time = m_player.animMgr.GetDuration(m_curAction) / m_player.animMgr.GetSpeed(m_curAction); state.crosser = m_player; state.InitState(); defender.m_StateMachine.SetState(state); } } m_player.animMgr.Play(m_curAction, true); }
static int _CreatePlayerState_DefenseCross(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_DefenseCross obj = new PlayerState_DefenseCross(arg0, arg1); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: PlayerState_DefenseCross.New"); } return(0); }
static int get_targetPos(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); PlayerState_DefenseCross obj = (PlayerState_DefenseCross)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name targetPos"); } else { LuaDLL.luaL_error(L, "attempt to index targetPos on a nil value"); } } LuaScriptMgr.PushValue(L, obj.targetPos); return(1); }
static int set_collideToDown(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); PlayerState_DefenseCross obj = (PlayerState_DefenseCross)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name collideToDown"); } else { LuaDLL.luaL_error(L, "attempt to index collideToDown on a nil value"); } } obj.collideToDown = LuaScriptMgr.GetBoolean(L, 3); return(0); }
static int set_speed(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); PlayerState_DefenseCross obj = (PlayerState_DefenseCross)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name speed"); } else { LuaDLL.luaL_error(L, "attempt to index speed on a nil value"); } } obj.speed = (IM.Number)LuaScriptMgr.GetNetObject(L, 3, typeof(IM.Number)); return(0); }