예제 #1
0
    private void OnLobbyServerGameStarted()
    {
        int seed = 0;

        BackgroundSelector.RoomType background = GameObject.FindObjectOfType <BackgroundSelector> ().room;

        eventEmitter.EmitGameStartedEvent(gamePlayers, seed, background);
    }
예제 #2
0
 public void EmitGameStartedEvent(
     List <GameObject> players, int seed, BackgroundSelector.RoomType background
     )
 {
     foreach (IEventHandler handler in handlers)
     {
         handler.OnGameStarted(players, seed, background);
     }
 }
예제 #3
0
 public GameRecord(int seed, BackgroundSelector.RoomType background, DateTime time)
 {
     Background = background;
     Time       = time;
     _seed      = seed;
     _events    = new List <PlayerEvent> ();
     _scores    = new Dictionary <PlayerProfile, int> ();
     _players   = new List <PlayerProfile> ();
 }
예제 #4
0
    public void OnGameStarted(List <GameObject> players, int seed, BackgroundSelector.RoomType background)
    {
        this.players = players;
        List <PlayerProfile> profiles = new List <PlayerProfile> ();

        foreach (GameObject player in players)
        {
            profiles.Add(GetProfile(player));
        }

        recordContainer.InitialiseGame(profiles, seed, background);
    }
예제 #5
0
    /**
     * Initialises a new game record and begins the recording.
     * @param List<PlayerProfile>         players    list of players
     * @param int                         seed       RNG seed
     * @param BackgroundSelector.RoomType background room background.
     */
    public void InitialiseGame(
        List <PlayerProfile> players, int seed, BackgroundSelector.RoomType background
        )
    {
        isRecording = true;
        frame       = 0;
        record      = new GameRecord(seed, background, DateTime.Now);

        foreach (PlayerProfile player in players)
        {
            record.AddPlayer(player);
        }
    }
예제 #6
0
 public void EmitGameStartedEvent(
     List <GameObject> players, int seed, BackgroundSelector.RoomType background
     )
 {
 }
예제 #7
0
 public void OnGameStarted(List <GameObject> players, int seed, BackgroundSelector.RoomType background)
 {
     this.players = players;
 }
예제 #8
0
    public override void Deserialize(NetworkReader reader)
    {
        int seed = reader.ReadInt32();

        BackgroundSelector.RoomType background =
            (BackgroundSelector.RoomType)reader.ReadInt32();
        DateTime time = Convert.ToDateTime(reader.ReadString());

        Game = new GameRecord(seed, background, time);

        Dictionary <int, PlayerProfile> players =
            new Dictionary <int, PlayerProfile> ();

        int count = reader.ReadInt32();

        for (int i = 0; i < count; i++)
        {
            PlayerProfile profile = reader.ReadMessage <PlayerProfileMessage>().Profile;
            players.Add(i, profile);
            Game.AddPlayer(profile);
        }

        for (int i = 0; i < count; i++)
        {
            int number = reader.ReadInt32();
            int score  = reader.ReadInt32();
            Game.UpdateScore(players[number], score);
        }

        count = reader.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            PlayerEvent playerEvent = null;

            PlayerProfile profile = players[reader.ReadInt32()];
            int           frame   = reader.ReadInt32();

            short eventType = reader.ReadInt16();

            switch (eventType)
            {
            case _movementEvent:
                Vector3 position = reader.ReadVector3();
                playerEvent = new PlayerMovementEvent(profile, frame, position);
                break;

            case _droppedItemEvent:
                playerEvent = new PlayerDroppedItemEvent(profile, frame);
                break;

            case _dashStartedEvent:
                playerEvent = new PlayerDashStartedEvent(profile, frame);
                break;

            case _dashStoppedEvent:
                playerEvent = new PlayerDashStoppedEvent(profile, frame);
                break;

            case _quitEvent:
                playerEvent = new PlayerQuitEvent(profile, frame);
                break;
            }

            Game.AddEvent(playerEvent);
        }
    }