Пример #1
0
 void Start()
 {
     if (movementSpeed == 0)
     {
         movementSpeed = 0.5f;
     }
     if (jumpDistance == 0)
     {
         jumpDistance = 3f;
     }
     if (smoothnessInRun == 0)
     {
         smoothnessInRun = 0.1f;
     }
     canJump = true;
     rb      = transform.GetComponent <Rigidbody2D>();
     uIGamePlayScreenController = UIGamePlayScreenManager.Instance();
     isInvisible      = false;
     score            = 0f;
     anim             = GetComponent <Animator>();
     limitXDir        = Camera.main.ViewportToWorldPoint(Vector3.one).x - 0.2f;
     soundManager     = SoundManager.Instance();
     expressionText   = UtilFunctions.GetGameObjectWithTagRecursive(gameObject, TagHolder.PLAYER_EXPRESSION_TEXT);
     expressionCanvas = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.PLAYER_TEXT_CANVAS);
     SetExpression();
 }
 public void LoadNextLevel()
 {
     if (levelProperty.levelNumber == 3)
     {
         UtilFunctions.GetGameObjectWithTagRecursive(gameObject, "text").GetComponent <TextMeshProUGUI>().text = "Game Completed, Please provide your comments";
         return;
     }
     if (isInitialized)
     {
         uILevelScreenManager.LoadNextLevel(levelProperty);
     }
 }
 internal void Initiate(LevelProperty prop)
 {
     paused                = false;
     levelProperty         = prop;
     uIManager             = UIManager.Instance();
     isInitialized         = true;
     uILevelScreenManager  = UILevelScreenManager.Instance();
     pauseButtonGameObject = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.PAUSE_BUTTON);
     pauseButtonGameObject.GetComponent <Button>().onClick.AddListener(OnPauseClicked);
     homeButtonOject = UtilFunctions.GetGameObjectWithTagRecursive(gameObject, TagHolder.HOME_BUTTON);
     homeButtonOject.GetComponent <Button>().onClick.AddListener(GoHome);
     textField             = UtilFunctions.GetGameObjectWithTagRecursive(gameObject, TagHolder.TEXT_FIELD);
     nextLevelButtonObject = UtilFunctions.GetGameObjectWithTagRecursive(gameObject, TagHolder.NEXT_LEVEL_BUTTON);
     nextLevelButtonObject.GetComponent <Button>().onClick.AddListener(LoadNextLevel);
     gameOverImage = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.GAME_OVER_IMAGE);
     gameOverImage.SetActive(false);
 }
 internal void Initiate()
 {
     paused                = false;
     uIManager             = UIManager.Instance();
     soundManager          = SoundManager.Instance();
     isInitialized         = true;
     gamePlayGameObject    = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.GAME_PLAY_IMAGE);
     pauseButtonGameObject = UtilFunctions.GetChildGameObjectWithTag(gamePlayGameObject, TagHolder.PAUSE_BUTTON);
     pauseButtonGameObject.GetComponent <Button>().onClick.AddListener(OnPauseClicked);
     textField          = UtilFunctions.GetGameObjectWithTagRecursive(gamePlayGameObject, TagHolder.TEXT_FIELD);
     gameOverGameObject = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.GAME_OVER_IMAGE);
     gameOverGameObject.SetActive(false);
     gamePlayGameObject.SetActive(true);
     UtilFunctions.GetChildGameObjectWithTag(gameOverGameObject, TagHolder.RETRY_BUTTON).GetComponent <Button>().onClick.AddListener(ReloadGame);
     UtilFunctions.GetChildGameObjectWithTag(gameOverGameObject, TagHolder.HOME_BUTTON).GetComponent <Button>().onClick.AddListener(GoHome);
     highScoreText    = UtilFunctions.GetChildGameObjectWithTag(gameOverGameObject, TagHolder.HIGH_SCORE_TEXT).GetComponent <TextMeshProUGUI>();
     currentScoreText = UtilFunctions.GetChildGameObjectWithTag(gameOverGameObject, TagHolder.CURRENT_SCORE_TEXT).GetComponent <TextMeshProUGUI>();
 }