Exemplo n.º 1
0
 public void StartEmit()
 {
     enabled     = true;
     readyToEmit = true;
     nextPlayerBallConfiguration = ballsEmiter.GetNextBallConfiguration();
     InstantiateNewPlayerBall();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Zwraca losową konfiguracje
        /// </summary>
        /// <returns></returns>
        private BallConfiguration GetRandomBallConfiguration()
        {
            BallConfiguration ballConfiguration = configurations.Random(); //BallConfiguration.RandomConfiguration;

            ballConfigurations[ballConfiguration]++;
            return(ballConfiguration);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sprawdza czy konfiguracja jest poprawna, tzn. czy istnieje jeszcze w logice obiekt o takiej samej
        /// </summary>
        /// <param name="ballConfiguration"></param>
        /// <returns></returns>
        public bool CheckNextBallConfiguration(BallConfiguration ballConfiguration)
        {
            return(ballConfigurations.ContainsKey(ballConfiguration));
//            if (!ballConfigurations.ContainsKey(ballConfiguration))
//                return false;
//            if (ballConfigurations[ballConfiguration] > 1)
//                return true;
//            ballConfigurations.Remove(ballConfiguration);
//            return false;
        }
Exemplo n.º 4
0
        private void InstantiateNewPlayerBall()
        {
            playerBall = ballsEmiter.GetReusedPlayerBall() ?? Instantiate(playerBallPrefab);
            playerBall.transform.SetParent(transform, false);
            if (!ballsEmiter.CheckNextBallConfiguration(nextPlayerBallConfiguration))
            {
                nextPlayerBallConfiguration = ballsEmiter.GetNextBallConfiguration();
            }
            BallConfiguration ballConfiguration = nextPlayerBallConfiguration;

            nextPlayerBallConfiguration = ballsEmiter.GetNextBallConfiguration();
            imgNextPlayerBall.material  = nextPlayerBallConfiguration.material;
            playerBall.Set(ballConfiguration, this);
        }
 public void Set(BallConfiguration ballConfiguration, PlayerBallEmiter emiter)
 {
     this.ballConfiguration = ballConfiguration;
     this.emiter            = emiter;
     image.material         = ballConfiguration.material;
 }
Exemplo n.º 6
0
 public void Set(Vector2Int position, Vector2 anchoredPosition, BallConfiguration ballConfiguration)
 {
     Set(position, anchoredPosition);
     this.ballConfiguration = ballConfiguration;
     image.material         = ballConfiguration.material;
 }