Ejemplo n.º 1
0
        public static void OnLoadStart()
        {
            LevelPlayground.SetLevelState(LevelPlayground.LevelState.Unknown);
            Scenes.GoToScene(Scenes.Types.Start);

            Server.Report(Server.ReportComands.RestartLevel);
        }
Ejemplo n.º 2
0
    private void OnLose()
    {
        Destroy(gameObject);

        LevelPlayground.SetLevelState(LevelPlayground.LevelState.LoseLevel);

        Scenes.GoToScene(Scenes.Types.Result);
    }
Ejemplo n.º 3
0
        public static void OnLoadLevel()
        {
            if (Scenes.PreviousScene == Scenes.Types.Result)
            {
                LevelPlayground.Resetlevels();
            }

            Scenes.GoToScene(Scenes.Types.Level);
        }
Ejemplo n.º 4
0
        public static void OnContinueLevelByMoney()
        {
            GameData.ReduceCurrency(Configs.Balance.PaymentForContinue);
            LevelPlayground.SetLevelState(LevelPlayground.LevelState.Unknown);

            Server.Report(Server.ReportComands.NextLevelByMoney);

            Scenes.GoToScene(Scenes.Types.Level);
        }
Ejemplo n.º 5
0
        public static void OnContinueLevel()
        {
            LevelPlayground.Resetlevels();
            LevelPlayground.SetLevelState(LevelPlayground.LevelState.Unknown);

            Server.Report(Server.ReportComands.NextLevel);

            Scenes.GoToScene(Scenes.Types.Level);
        }
Ejemplo n.º 6
0
 public static void OnSceneLoading()
 {
     LevelPlayground.LoadLevels();
     LevelPlayground.LoadPrefabs();
     LevelPlayground.CreateWheel();
     LevelPlayground.CreateBullets();
     LevelPlayground.CreatePrizes();
     LevelPlayground.CreateBarriers();
     LevelPlayground.RenderPoints();
 }
Ejemplo n.º 7
0
        public static void OnNextBullet()
        {
            var state = LevelPlayground.GetLevelState();

            if (state == LevelPlayground.LevelState.LoseLevel)
            {
                return;
            }

            LevelPlayground.SetNextBulletAsActive();
        }
Ejemplo n.º 8
0
        public static void OnSceneLoading()
        {
            var textResult  = GameObject.Find("TextResult").GetComponent <Text>();
            var textBody    = GameObject.Find("TextBody").GetComponent <Text>();
            var textPlay    = GameObject.Find("TextPlay").GetComponent <Text>();
            var buttonDeny  = GameObject.Find("ButtonDeny");
            var prize       = GameObject.Find("CounterSmallPrize");
            var counterText = GameObject.Find("CounterSmallText");

            buttonDeny.GetComponentInChildren <Text>().text = Configs.Strings.GetString("no_thanks");

            var levelState = LevelPlayground.GetLevelState();

            if (levelState == LevelPlayground.LevelState.WinLevel)
            {
                Color newColor = new Color();
                ColorUtility.TryParseHtmlString("#6DC248", out newColor);

                textResult.color = newColor;
                textResult.text  = Configs.Strings.GetString("victory");

                textBody.color = newColor;
                textBody.text  = Configs.Strings.GetString("reward");

                textPlay.text = Configs.Strings.GetString("go_on");

                counterText.GetComponent <Text>().text = Configs.Balance.LevelReward.ToString();

                GameData.AddedCurrency = Configs.Balance.LevelReward;
                Events.LaunchEvent(Events.Types.IncreaseCurrency);

                buttonDeny.SetActive(false);
                prize.SetActive(false);
            }
            else if (levelState == LevelPlayground.LevelState.LoseLevel)
            {
                Color newColor = new Color();
                ColorUtility.TryParseHtmlString("#CB6176", out newColor);

                textResult.color = newColor;
                textResult.text  = Configs.Strings.GetString("loss");

                textBody.color = newColor;
                textBody.text  = Configs.Strings.GetString("total");

                textPlay.text = Configs.Strings.GetString("continue");

                var paymentText = GameObject.Find("CounterPayment").GetComponent <Text>();
                paymentText.text = Configs.Balance.PaymentForContinue.ToString();

                counterText.GetComponent <Text>().text = GameData.GetCurrency().ToString();
            }
        }
Ejemplo n.º 9
0
    public void GoOut()
    {
        Audio.Play();

        if (LevelPlayground.GetCurrentLevel() == LevelPlayground.NumberOfLevels)
        {
            Invoke("GoToResult", Audio.clip.length / 3);
        }
        else
        {
            Invoke("RestartLevel", Audio.clip.length / 3);
        }
    }
Ejemplo n.º 10
0
    public static void RestartGame()
    {
        Scenes.ResetManager();
        Configs.ResetManager();
        Profile.ResetManager();
        Events.ResetManager();
        Sounds.ResetManager();
        Server.ResetManager();

        LevelPlayground.SetLevelState(LevelPlayground.LevelState.Unknown);
        Scenes.GoToScene(Scenes.Types.Start);

        Debug.Log("Game restarted");
    }
Ejemplo n.º 11
0
 public void GoToLevel()
 {
     if (LevelPlayground.GetLevelState() == LevelPlayground.LevelState.LoseLevel)
     {
         if (GameData.IsEnoughCurrency(Configs.Balance.PaymentForContinue))
         {
             Events.LaunchEvent(Events.Types.ContinueLevelByMoney, Scenes.ActiveScene);
         }
         else
         {
             Events.LaunchEvent(Events.Types.NotEnoughMoneyToContinue, Scenes.ActiveScene);
         }
     }
     else
     {
         Events.LaunchEvent(Events.Types.ContinueLevel, Scenes.ActiveScene);
     }
 }
Ejemplo n.º 12
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (mIsFired)
        {
            return;
        }

        if (other.gameObject.name == "Wheel")
        {
            OnTriggerWheel(other.gameObject);
            Events.LaunchEvent(Events.Types.NextBullet, Scenes.ActiveScene);
        }
        else if (other.gameObject.name == "barrier" || other.gameObject.name == "bullet")
        {
            LevelPlayground.SetLevelState(LevelPlayground.LevelState.LoseLevel);
            LevelPlayground.ActiveBulletIndex = 0;
            OnTriggerBarrier(other.gameObject);
        }
    }
Ejemplo n.º 13
0
        public static void OnBlockWin()
        {
            LevelPlayground.OnBlockWin();

            Server.Report(Server.ReportComands.BlockFinished);
        }
Ejemplo n.º 14
0
        public static void OnLevelWin()
        {
            LevelPlayground.OnLevelWin();

            Server.Report(Server.ReportComands.LevelFinished);
        }