Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
 private void Start()
 {
     uIGamePlayScreenController = UIGamePlayScreenManager.Instance();
     uIMainScreenController     = UIMainScreenManager.Instance();
     uIGamePlayGameObject       = UtilFunctions.GetChildGameObjectWithTag(MainCanvas, TagHolder.UI_GAME_PLAY_SCREEN);
     uIMainScreenGameObject     = UtilFunctions.GetChildGameObjectWithTag(MainCanvas, TagHolder.UI_MAIN_SCREEN);
     uIMainScreenController.AssignGameObject(uIMainScreenGameObject);
     Time.timeScale = 1f;
     Initiate();
 }
 public void Initiate()
 {
     uIManager = UIManager.Instance();
     if (levelsGameObject == null)
     {
         Debug.LogWarning("LevelGameObject not assigned");
     }
     levelContentDisplay           = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.LEVEL_CONTENT);
     totalLevels                   = levelsGameObject.transform.childCount;
     remainingNumberOfLevelsButton = totalLevels;
     listOfLevelProperty           = new List <LevelProperty>();
     ResizeLevelContentDisplay();
 }
Ejemplo n.º 4
0
 internal void Initiate()
 {
     startButtonGameobject = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.START_BUTTON);
     startButtonGameobject.GetComponent <Button>().onClick.AddListener(StartClicked);
     audioButtonGameobject = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.AUDIO_BUTTON);
     SetAudioState();
     audioButtonGameobject.GetComponent <Button>().onClick.AddListener(AudioClicked);
     if (GameStateHolder.restartClicked)
     {
         StartClicked();
         GameStateHolder.restartClicked = false;
     }
 }
Ejemplo n.º 5
0
 // Start is called before the first frame update
 public void Initiate()
 {
     uIGamePlayScreenController = UIGamePlayScreenManager.Instance();
     uIMainScreenController     = UIMainScreenManager.Instance();
     uILevelScreenManager       = UILevelScreenManager.Instance();
     uIGamePlayGameObject       = UtilFunctions.GetChildGameObjectWithTag(MainCanvas, TagHolder.UI_GAME_PLAY_SCREEN);
     uIMainScreenGameObject     = UtilFunctions.GetChildGameObjectWithTag(MainCanvas, TagHolder.UI_MAIN_SCREEN);
     uILevelScreenGameObject    = UtilFunctions.GetChildGameObjectWithTag(MainCanvas, TagHolder.UI_LEVEL_SCREEN);
     uIGamePlayGameObject.SetActive(false);
     uILevelScreenGameObject.SetActive(false);
     uIMainScreenGameObject.SetActive(true);
     Time.timeScale = 1f;
     uIMainScreenController.AssignGameObject(uIMainScreenGameObject);
     uIMainScreenController.Initiate();
 }
Ejemplo n.º 6
0
    private IEnumerator PlayerDied()
    {
        soundManager.PlayAudio(SoundManager.AUDIO_LIST.METEO_HIT_AUTIO);
        transform.GetComponent <SpriteRenderer>().enabled = false;
        transform.GetComponent <Rigidbody2D>().velocity   = Vector2.zero;
        transform.GetComponent <BoxCollider2D>().enabled  = false;

        expressionCanvas.SetActive(false);
        GameObject deathParticle = UtilFunctions.GetChildGameObjectWithTag(transform.parent.gameObject, TagHolder.DEATH_PARTICLE_EFFECT);

        deathParticle.transform.position = new Vector3(transform.position.x, transform.position.y, deathParticle.transform.position.z);
        deathParticle.SetActive(true);
        yield return(new WaitForSeconds(0.5f));

        Time.timeScale = 0f;
        uIGamePlayScreenController.GameOver(Mathf.Floor(score));
    }
 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>();
 }
 private void CreateLevelButtons(GameObject clonePanel, float levelsPerPanel)
 {
     for (int i = 0; i < levelsPerPanel; i++)
     {
         if (remainingNumberOfLevelsButton > 0)
         {
             GameObject button = Instantiate(LevelButton);
             button.transform.SetParent(clonePanel.transform);
             button.SetActive(true);
             LevelProperty prop = button.AddComponent <LevelProperty>();
             prop.levelNumber = totalLevels - remainingNumberOfLevelsButton + 1;
             prop.isCompleted = true;
             prop.isLocked    = GameStateManager.GetLevelLockedState(prop.levelNumber) == "Locked";
             button.GetComponent <Button>().onClick.AddListener(prop.OnLevelButtonPressed);
             UtilFunctions.GetChildGameObjectWithTag(button, "LockButtonImage").SetActive(prop.isLocked);
             UtilFunctions.GetChildGameObjectWithTag(button, "LevelText").GetComponent <TextMeshProUGUI>().text = (prop.levelNumber).ToString();
             UtilFunctions.GetChildGameObjectWithTag(button, "LevelText").SetActive(true);
             listOfLevelProperty.Add(prop);
             remainingNumberOfLevelsButton--;
         }
     }
 }
Ejemplo n.º 10
0
 internal void SetAudioState()
 {
     UtilFunctions.GetChildGameObjectWithTag(audioButtonGameobject, TagHolder.NO_AUDIO_BUTTON).SetActive(!GameStateHolder.audioEnable);
     soundManager.SetMuteState(!GameStateHolder.audioEnable);
 }
 internal void SetText(string v)
 {
     Time.timeScale = 0f;
     UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.GAME_OVER_IMAGE).SetActive(true);
     textField.GetComponent <TextMeshProUGUI>().text = v;
 }
 internal void Initiate()
 {
     startButtonGameobject = UtilFunctions.GetChildGameObjectWithTag(gameObject, TagHolder.START_BUTTON);
     startButtonGameobject.GetComponent <Button>().onClick.AddListener(StartClicked);
 }