Пример #1
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();
        }