Пример #1
0
    void Start()
    {
        // retrieve rigidbody for player
        rb = gameObject.GetComponent <Rigidbody2D>();

        // get the levelloader script
        ll = FindObjectOfType <LevelLoader>();

        //return current level
        currentscene = ll.CurrentLevel();         // 1, 2, 3, etc
        currentlevel = float.Parse(currentscene); // convert to float

        // set points for that level
        // get the strength value for that level
        // update the points on the UI for that level
        // update the strength on the UI for that level
        if (currentlevel == 1)
        {
            points   = L1;
            strength = getStrength(points);
            UIManager.Instance.UpdateHitCount(points);
            UIManager.Instance.UpdateStrength(strength);
            agility = getAgility(points);
            UIManager.Instance.UpdateAgility(agility);
        }
        else if (currentlevel == 2)
        {
            transform.localScale += new Vector3(0.3f, 0.3f, 0);
            points = L2;
            UIManager.Instance.UpdateHitCount(points);
            strength = getStrength(points);
            UIManager.Instance.UpdateStrength(strength);
            agility = getAgility(points);
            UIManager.Instance.UpdateAgility(agility);
        }
        else if (currentlevel == 3)
        {
            transform.localScale += new Vector3(1f, 1f, 0);
            points = L3;
            UIManager.Instance.UpdateHitCount(points);
            spideyHealth = 1000f;
            strength     = getStrength(points);
            UIManager.Instance.UpdateStrength(strength);
            agility = getAgility(points);
            UIManager.Instance.UpdateAgility(agility);
        }

        // send new level data to spidey control
        spiderControl spiderControl = spider.GetComponent <spiderControl>();

        spiderControl.setSpideySpeed(currentlevel);
    }