Ejemplo n.º 1
0
 public void RemovePlayer(Player p)
 {
     m_PlayersRanking.Remove(p);
 }
Ejemplo n.º 2
0
 public void AddPlayer(Player p)
 {
     if (!m_PlayersRanking.Contains(p))
         m_PlayersRanking.Add(p);
 }
Ejemplo n.º 3
0
 public bool CompareMesh(Player p)
 {
     return (Mesh)(p.GetVehicle()) == m;
 }
Ejemplo n.º 4
0
        public Player CreatePlayer(UInt32 uID)
        {
            Player newPlayer = GetPlayerByID(uID);

            if (newPlayer != null)
            {
                // the id already in use!! Something is wrong!
                return null;
            }

            newPlayer = new Player();
            m_PlayerList.Add(newPlayer);

            TextComponent rank = new TextComponent(10, 10 + 30*(m_Ranking.Count+1), "", "kartsFont");
            m_Ranking.Add(rank);
            Gui.GetInstance().AddComponent(rank);

            return newPlayer;
        }
Ejemplo n.º 5
0
 public bool CompareID(Player p)
 {
     return p.Local && p.LocalPlayerIndex  == localIndex;
 }
Ejemplo n.º 6
0
 public bool CompareID(Player p)
 {
     return p.GetID() == uID;
 }
Ejemplo n.º 7
0
            public int Compare(Player p1, Player p2)
            {
                if (p1 == null || p2 == null || p1 == p2)
                    return 0;

                Player.CircuitState state1 = p1.GetCircuitState();
                Player.CircuitState state2 = p2.GetCircuitState();

                //Debug.Print("Laps " + state1.iLaps + ", " + state2.iLaps);
                if (state1.iLaps > state2.iLaps)
                {
                    //Debug.Print("Laps: Player " + p1.GetName() + " before than " + p2.GetName());
                    return -1;
                }
                else if (state1.iLaps == state2.iLaps)
                {
                    //Debug.Print("CP: " + state1.iCheckPoint + ", " + state2.iCheckPoint);
                    if (state1.iCheckPoint > state2.iCheckPoint)
                    {
                        //Debug.Print("CP: Player " + p1.GetName() + " before than " + p2.GetName());
                        return -1;
                    }
                    else if (state1.iCheckPoint == state2.iCheckPoint)
                    {
                        //Debug.Print("Dist: " + state1.fSqCheckpointDist + ", " + state2.fSqCheckpointDist);
                        if (state1.fSqCheckpointDist <= state2.fSqCheckpointDist)
                        {
                            //Debug.Print("Dist: Player " + p1.GetName() + " before than " + p2.GetName());
                            return -1;
                        }
                    }
                }

                //Debug.Print("Player " + p2.GetName() + " before than " + p1.GetName());
                return 1;
            }
Ejemplo n.º 8
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;
        }
Ejemplo n.º 9
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;
            }
        }