Exemple #1
0
 void Start()
 {
     gplay      = GameObject.Find("SceneManager(Clone)").GetComponent <GPlayclass>();
     childrenTr = GetComponentsInChildren <Transform>();
     thisBox    = GetComponent <BoxCollider2D>();
     textColor  = childrenTr[1].GetComponent <TextMesh>();
 }
 static void CheckAchievement()
 {
     if (buttons.Count == 7)
     {
         GPlayclass.UnlockAchievement("CgkI-Meyi84DEAIQBw");
     }
 }
Exemple #3
0
 void Start()
 {
     logObjects   = GetComponentsInChildren <Transform>();
     gPlay        = GameObject.Find("SceneManager(Clone)").GetComponent <GPlayclass>();
     thisBox      = GetComponent <BoxCollider2D>();
     achievements = GameObject.Find("achievements").GetComponent <ShowAchievements>();
 }
 void deleteSavedData()
 {
     lvlmanager.lastUnlockedlvl = 0;
     EndGameVariables.UpdateData("");
     GPlayclass.UpdateCloudLevel(0);
     GPlayclass.UpdateTimeAndDeaths("");
 }
Exemple #5
0
 public void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Death")
     {
         StartCoroutine(Reset(true));
         GPlayclass.UnlockAchievement("CgkI-Meyi84DEAIQBA");
     }
 }
    /// <summary>
    /// Actualiza el número de la escena actual en la variable sceneNumber
    /// </summary>
    /// <param name="level"></param>
    public void OnLevelWasLoaded()
    {
        SetScene();

        if (GPlayclass.GetIsFirstTime() && SceneManager.GetActiveScene().buildIndex == 1)
        {
            Instantiate(hand);
        }
    }
Exemple #7
0
    public IEnumerator OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            yield return(new WaitForSeconds(3));

            GPlayclass.UnlockAchievement("CgkI-Meyi84DEAIQAw"); //stuck achievement
        }
    }
    public static void UpdateLevel()
    {
        GameObject go = GameObject.Find("SceneManager(Clone)");

        lvlManag = go.GetComponent <lvlManager>();

        Int32.TryParse(SceneManager.GetActiveScene().name, out lvlCount);
        lvlManag.UpdateLevel(lvlCount);

        GPlayclass.UpdateCloudLevel(lvlManag.lastUnlockedlvl); //almacena el numero del nivel en una variable que es guardada en la nube
    }
Exemple #9
0
    void UpdateTimer()
    {
        timeText.text = ConvertSecsToString(timeInSec);

        if (countDown)
        {
            timeInSec--;
        }

        else
        {
            timeInSec++;
        }

        if (countDown && timeInSec == 9)
        {
            watch.color    = Color.red;
            timeText.color = Color.red;
            ChangeToColor(red);
        }

        if (countDown && timeInSec < 0)
        {
            timerActive = false;
            GPlayclass.UnlockAchievement("CgkI-Meyi84DEAIQCA");
            StartCoroutine(DeathScript.Reset(false));
        }

        if (timeInSec > 3599)
        {
            StartCoroutine(DeathScript.Reset(false));
        }

        if (timeInSec == 180)
        {
            GPlayclass.UpdateEvent("CgkI-Meyi84DEAIQCQ", 1);
        }

        else if (timeInSec == 360)
        {
            GPlayclass.UpdateEvent("CgkI-Meyi84DEAIQCQ", 2);
        }
    }
Exemple #10
0
    public void UnlockNextPack(int sceneNo)
    {
        bool exists = false;

        for (int i = 0; i < playedCount; i++)
        {
            if (playedMaps[i] == sceneNo)
            {
                exists = true;
            }
        }
        if (playedCount + 1 != playedMaps.Length)
        {
            playedMaps[playedCount++] = sceneNo;
        }

        if (!exists && (currentPNo * lvlCount) + sceneNo > lastUnlockedlvl)
        {
            lastUnlockedlvl++;
        }

        if (lastUnlockedlvl >= 20)
        {
            GPlayclass.UnlockAchievement("CgkI-Meyi84DEAIQAA");
        }
        if (lastUnlockedlvl >= 40)
        {
            GPlayclass.UnlockAchievement("CgkI-Meyi84DEAIQAQ");
        }
        if (lastUnlockedlvl >= 60)
        {
            GPlayclass.UnlockAchievement("CgkI-Meyi84DEAIQAg");
        }

        GPlayclass.UpdateCloudLevel(lastUnlockedlvl); //almacena el numero de nivel en una variable de la nube
    }
Exemple #11
0
 /// <summary>
 /// Comprueba si los datos pertenecen a un nuevo nivel o a uno antiguo
 /// </summary>
 /// <returns></returns>
 static bool IsNewLevel()
 {
     return((lvlmanager.lastUnlockedlvl - 1) * CharsPerLevel >= data.Length && (GPlayclass.GetLevel() == (currentPack * lvlManager.lvlCount) + currentLvl));
 }
Exemple #12
0
 /// <summary>
 /// Actualiza el string de datos en la variable de la nube
 /// </summary>
 static void UpdateCloudData()
 {
     GPlayclass.UpdateTimeAndDeaths(data);
 }
Exemple #13
0
    /// <summary>
    /// El Update se encarga del movimiento del personaje y de comprobar si ha llegado a la meta
    /// </summary>
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            GameEnded();
        }

        if (isMovActive && infoNotActive)
        {
            timeMoving = 0;
            PosUpdate();
            AnimationPlay(false);

            if (Input.GetKeyDown(KeyCode.D))
            {
                playerDir = Direction.rightMov;
                setMov(false);
            }

            else if (Input.GetKeyDown(KeyCode.W))
            {
                playerDir = Direction.upMov;
                setMov(false);
            }

            else if (Input.GetKeyDown(KeyCode.S))
            {
                playerDir = Direction.downMov;
                setMov(false);
            }

            else if (Input.GetKeyDown(KeyCode.A))
            {
                playerDir = Direction.leftMov;
                setMov(false);
            }
        }

        else
        {
            AnimationPlay(true);
            GetObstacle();
            count      += Time.deltaTime;
            timeMoving += Time.deltaTime;

            if (count > timeToGo)
            {
                if (playerDir == Direction.rightMov)
                {
                    //rb.velocity = new Vector2(speed, 0);
                    tr.position = new Vector3(tr.position.x + space, tr.position.y);
                }

                else if (playerDir == Direction.upMov)
                {
                    //rb.velocity = new Vector2(0, speed);
                    tr.position = new Vector3(tr.position.x, tr.position.y + space);
                }

                else if (playerDir == Direction.downMov)
                {
                    //rb.velocity = new Vector2(0, -speed);
                    tr.position = new Vector3(tr.position.x, tr.position.y - space);
                }

                else if (playerDir == Direction.leftMov)
                {
                    //rb.velocity = new Vector2(-speed, 0);
                    tr.position = new Vector3(tr.position.x - space, tr.position.y);
                    GPlayclass.UpdateEvent("CgkI-Meyi84DEAIQCg", 1);
                }
                count = 0;
            }
        }
    }
Exemple #14
0
 void DelObject()
 {
     GPlayclass.DisableFirstTime();
     Destroy(this.gameObject);
 }