Example #1
0
    public void loadCustoms()
    {
        LevelStats stats = MainController.instance.getStats();

        Debug.Log("loadCustom");
        for (int i = 0; i < stats.collectedFruits.Length; i++)
        {
            Debug.Log("i" + " " + i + " " + stats.collectedFruits[i]);
        }
        string      str    = JsonUtility.ToJson(stats);
        HeroRefugee player = HeroRefugee.instance;

        LivesPanel.instance.setPause();

        PlayerPrefs.SetString(currentLevelName, str);
        PlayerPrefs.SetInt("health", LivesPanel.instance.getAmountOfHealth());
        x = player.transform.position.x;
        PlayerPrefs.SetFloat("x", x);
        y = player.transform.position.y;
        PlayerPrefs.SetFloat("y", y);
        z = player.transform.position.z;
        PlayerPrefs.SetFloat("z", z);

        PlayerPrefs.Save();

        SceneManager.LoadScene("Customs");
    }
Example #2
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        HeroRefugee refugee = collider.GetComponent <HeroRefugee>();

        if (refugee)
        {
            refugee.triggerCought(true);
            showLosePopUp();
        }
    }
Example #3
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        HeroRefugee refugee = collider.GetComponent <HeroRefugee>();

        if (refugee)
        {
            MainController.instance.addFruit(this.getId());
            LivesPanel.instance.addHealth(5);
            Destroy(this.gameObject);
        }
    }
Example #4
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        HeroRefugee refugee = collider.GetComponent <HeroRefugee>();

        if (refugee)
        {
            onPlay();
            Destroy(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
Example #5
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        HeroRefugee refugee = collider.GetComponent <HeroRefugee>();

        if (refugee)
        {
            Dictionary <President, Country> dict = MainController.instance.getList();
            foreach (KeyValuePair <President, Country> entry in dict)
            {
                if (entry.Value == country)
                {
                    entry.Key.run();
                }
            }
        }
    }
Example #6
0
    void OnTriggerExit2D(Collider2D collider)
    {
        HeroRefugee refugee = collider.GetComponent <HeroRefugee>();

        if (refugee)
        {
            Dictionary <President, Country> dict = MainController.instance.getList();
            foreach (KeyValuePair <President, Country> entry in dict)
            {
                if (entry.Value == country)
                {
                    entry.Key.goHome();
                }
            }
            if (refugee.getEscapedCountries() == 7)
            {
                loadCustoms();
            }
        }
    }
Example #7
0
    void Start()
    {
        string str = PlayerPrefs.GetString(currentLevelName, null);

        LivesPanel.instance.health = PlayerPrefs.GetInt("health", 100);
        this.stat = JsonUtility.FromJson <LevelStats>(str);
        Fruit.setCountZero();
        if (stat == null)
        {
            this.stat = new LevelStats();
        }

        HeroRefugee player = HeroRefugee.instance;

        if (PlayerPrefs.HasKey("x") && PlayerPrefs.HasKey("y") && PlayerPrefs.HasKey("z"))
        {
            x = PlayerPrefs.GetFloat("x");
            y = PlayerPrefs.GetFloat("y");
            z = PlayerPrefs.GetFloat("z");
            Vector3 posVec = new Vector3(x, y, z);
            player.transform.position = posVec;
        }
    }
Example #8
0
 void Awake()
 {
     instance = this;
     triggerCought(false);
 }