static int SetState(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2) { MatchStateMachine obj = (MatchStateMachine)LuaScriptMgr.GetNetObjectSelf(L, 1, "MatchStateMachine"); MatchState.State arg0 = (MatchState.State)LuaScriptMgr.GetNetObject(L, 2, typeof(MatchState.State)); bool o = obj.SetState(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 3) { MatchStateMachine obj = (MatchStateMachine)LuaScriptMgr.GetNetObjectSelf(L, 1, "MatchStateMachine"); MatchState.State arg0 = (MatchState.State)LuaScriptMgr.GetNetObject(L, 2, typeof(MatchState.State)); bool arg1 = LuaScriptMgr.GetBoolean(L, 3); bool o = obj.SetState(arg0, arg1); LuaScriptMgr.Push(L, o); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: MatchStateMachine.SetState"); } return(0); }
public bool SetState(MatchState.State eNewState, bool bForceChange) { if (m_curState != null && m_curState.m_eState == eNewState && !bForceChange) { return(true); } if (m_curState != null) { m_curState.OnExit(); } if (m_curState != null) { Debug.Log(string.Format("MatchState from state: {0} to state: {1}", m_curState.m_eState, eNewState)); } MatchState lastState = m_curState; m_curState = m_arStateList[(int)eNewState]; if (m_curState == null) { Debug.LogError(string.Format("Can not find state: {0}", eNewState)); return(false); } m_matchStateListeners.ForEach(delegate(MatchStateMachine.Listener lsn) { lsn.OnMatchStateChange(lastState, m_curState); }); m_curState.OnEnter(lastState); return(true); }
void _OnRebound() { if (!m_toReboundBall) { return; } if (m_ball.m_owner != null) { m_ball.m_owner.DropBall(m_ball); } if (m_ball.m_actor != null && m_ball.m_actor.m_team != m_player.m_team) { MatchState.State curState = m_match.m_stateMachine.m_curState.m_eState; if (curState == MatchState.State.ePlaying) { PlaySoundManager.Instance.PlaySound(MatchSoundEvent.Rebound); } } m_player.GrabBall(m_ball); m_player.mStatistics.SkillUsageSuccess(m_curExecSkill.skill.id, true); PlaySoundManager.Instance.PlaySound(MatchSoundEvent.GrabBall); m_player.eventHandler.NotifyAllListeners(PlayerActionEventHandler.AnimEvent.eRebound); Debug.Log(m_player.m_id + " rebound success and grab ball"); m_toReboundBall = false; }
void LateUpdate() { if (m_curMatch == null || m_curMatch.m_stateMachine == null || m_curMatch.m_stateMachine.m_curState == null) { return; } MatchState.State curState = m_curMatch.m_stateMachine.m_curState.m_eState; if (curState == MatchState.State.eOpening || curState == MatchState.State.eOver) { return; } /* * if( m_PositionImmediately ) * { * Positioning(true); * m_PositionImmediately = false; * } * else * Positioning(false); */ if (!m_PositionImmediately && !Mathf.Approximately(Time.deltaTime, 0f)) { Positioning(false); } }
public MatchState GetState(MatchState.State state) { if ((int)state > (int)MatchState.State.eMax) { return(null); } return(m_arStateList[(int)state]); }
static int IntToEnum(IntPtr L) { int arg0 = (int)LuaDLL.lua_tonumber(L, 1); MatchState.State o = (MatchState.State)arg0; LuaScriptMgr.Push(L, o); return(1); }
static int GetState(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); MatchStateMachine obj = (MatchStateMachine)LuaScriptMgr.GetNetObjectSelf(L, 1, "MatchStateMachine"); MatchState.State arg0 = (MatchState.State)LuaScriptMgr.GetNetObject(L, 2, typeof(MatchState.State)); MatchState o = obj.GetState(arg0); LuaScriptMgr.PushObject(L, o); return(1); }
static bool _FilterOutMsgByMatchState() { GameMatch match = GameSystem.Instance.mClient.mCurMatch; if (match == null || match.m_stateMachine.m_curState == null) { return(true); } MatchState.State curState = match.m_stateMachine.m_curState.m_eState; if (curState == MatchState.State.eOpening || curState == MatchState.State.eOverTime || curState == MatchState.State.eOver) { return(true); } return(false); }
static int _CreateMatchStatePlot(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2) { MatchStateMachine arg0 = (MatchStateMachine)LuaScriptMgr.GetNetObject(L, 1, typeof(MatchStateMachine)); MatchState.State arg1 = (MatchState.State)LuaScriptMgr.GetNetObject(L, 2, typeof(MatchState.State)); MatchStatePlot obj = new MatchStatePlot(arg0, arg1); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: MatchStatePlot.New"); } return(0); }
public void Update(IM.Number deltaTime) { if (rebounders.Count == 0) { return; } GameMatch match = GameSystem.Instance.mClient.mCurMatch; UBasketball ball = match.mCurScene.mBall; if (!closed) { validTime -= deltaTime; if (validTime < IM.Number.zero) //close { closed = true; //select rebounder rebounders.Sort((info1, info2) => { if (info1.reboundValue < info2.reboundValue) { return(-1); } else if (info1.reboundValue > info2.reboundValue) { return(1); } else { return(0); } }); Info selectedRebounder = null; if (rebounders.Count > 0) { uint totalValue = 0; foreach (Info info in rebounders) { totalValue += info.reboundValue; } uint value = (uint)IM.Random.Range(0, totalValue); Debug.Log("rebound value: " + value); foreach (Info pl in rebounders) { Debug.Log("player :" + pl.player.m_id + " rebound : " + pl.reboundValue); } uint finalOdd = 0; foreach (Info pl in rebounders) { finalOdd += pl.reboundValue; if (value < finalOdd) { selectedRebounder = pl; break; } } } if (selectedRebounder != null) { foreach (Info info in rebounders) { bool canPick = (selectedRebounder == info && ball.m_ballState == BallState.eRebound && ball.m_picker == null); if (canPick) { ball.m_picker = selectedRebounder.player; PlayerState_Rebound stateRebound = ball.m_picker.m_StateMachine.GetState(PlayerState.State.eRebound) as PlayerState_Rebound; if (ball.m_picker.m_StateMachine.m_curState.m_eState == PlayerState.State.eRebound && !stateRebound.m_toReboundBall) { stateRebound.m_toReboundBall = true; } else { MatchState.State eCurState = match.m_stateMachine.m_curState.m_eState; if (eCurState == MatchState.State.ePlaying || eCurState == MatchState.State.eTipOff) { if (ball.m_owner != null) { Debug.LogError("can not grab ball."); } ball.m_picker.GrabBall(ball); } } } string trace = "Rebound: player: " + info.player.m_id + " " + info.player.m_name + " value:" + info.reboundValue + " canPick:" + canPick; Debugger.Instance.m_steamer.message += "\n" + trace + "\n"; Debug.Log(trace); } } } } if (ball.m_ballState != BallState.eRebound) { rebounders.Clear(); closed = false; } }
public bool SetState(MatchState.State eNewState) { return(SetState(eNewState, false)); }