Exemplo n.º 1
0
        public void OnPlayerForwardCheckpoint(Player p, CheckPoint cp)
        {
            Player.CircuitState PlayerState = p.GetCircuitState();

            int iTotalCP = m_CheckPointList.Count;
            int iLastPlayerCP = PlayerState.iCheckPoint;
            int iCurrCP = cp.GetIndex();

            int iNumLaps = PlayerState.iLaps;

            if (iLastPlayerCP == 0 && iCurrCP == 0)
            {
                PlayerState.iLaps += 1;
            }

            iLastPlayerCP = iLastPlayerCP < 0 ? 0 : iLastPlayerCP;

            int iNextCP = (iLastPlayerCP + 1) % iTotalCP;
            int iPrevCP = (iLastPlayerCP - 1) % iTotalCP;
            iPrevCP = iPrevCP < 0 ? (iTotalCP - 1) : iPrevCP;

            // The player is going on the right direction
            PlayerState.iCheckPoint = iNextCP;
        }
Exemplo n.º 2
0
        public void OnPlayerBackwardCheckpoint(Player p, CheckPoint cp)
        {
            Player.CircuitState PlayerState = p.GetCircuitState();

            int iTotalCP = m_CheckPointList.Count;
            int iLastPlayerCP = PlayerState.iCheckPoint;
            int iCurrCP = cp.GetIndex();

            if (iCurrCP != iLastPlayerCP)
            {
                int iNextCP = (iCurrCP + 1) % iTotalCP;

                // The player is going on the wrong direction (backwards)
                PlayerState.iCheckPoint = iCurrCP;
            }
        }