public PoolGameReplayData(BasePoolGame game)
        {
            Game = game;

            BallReplayDataList = new List <BaseReplayData>();

            for (int i = 0; i < Game.Balls.Count; i++)
            {
                BallReplayDataList.Add(Game.Balls[i].GetReplayData());
            }


            PlayerReplayData = Game.Player.GetReplayData();
        }
Beispiel #2
0
        private void Play(GameMode mode)
        {
            Game = PoolGameFactory.Create(mode);
            Game.transform.parent = transform;

            // başka oyuncular da eklenebilir.
            var playerData = new PlayerDataContext("aliozer")
            {
                Name = "Ali"
            };

            UIManager.AddPlayer(playerData);

            Game.AddPlayer(playerData);

            playerData = new PlayerDataContext("ezgi")
            {
                Name          = "Ezgi",
                CuePrefabName = "BlueCue"
            };

            UIManager.AddPlayer(playerData);
            Game.AddPlayer(playerData);

            foreach (var player in Game.GetPlayers())
            {
                player.BallHit     += Player_BallHit;
                player.ShotStarted += Player_ShotStarted;
            }


            Game.AddFinishingRule(new TotalPointFinishingRule(Game.GetPlayers(), 5));
            // aşağıdaki gibi başka bitirme kuralları da eklenebilir.
            // Game.AddFinishingRule(new PlayerFirstMaxPointFinishingRule(CurrentGame.GetPlayers(), 25));

            Game.ShotCompleted += Game_ShotCompleted;
            Game.Completed     += Game_Completed;
            Game.Started       += Game_Started;
            Game.ChangePlayer  += Game_ChangePlayer;


            Game.Play();

            ClockTimer.StartTime();

            UIManager.GamePlayingState();
        }