예제 #1
0
    void Start()
    {
        //Object Access
        myTransform = transform;
        spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();
        rCollision = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerCollision>();
        spriteFont = GetComponent<exSpriteFont>();

        speed = 1200;

        fPercent = 100 - (100 * ( (float)rCollision.getNumGatesHit() / (float)spawner.getNumGatesInLevel() ));
        DisplayGradeLetter();
        //Text to display
        statusText = "Level " + spawner.getLevelCount()
                         +"\nGates: " + spawner.getNumGatesInLevel()
                         +"\nGates Hit: " + rCollision.getNumGatesHit()
                         +"\nGrade:"+"\n"+"\n"+"\n"
                         +"\nTap to Start"
                         +"\n";

        spriteFont.text = statusText;

        //Add to volume control
        if(PlayerPrefs.HasKey("volumeFX"))
        {
            if(GetComponent<AudioSource>() != null)
            {
                AudioSource audio = GetComponent<AudioSource>();
                audio.volume = (float)PlayerPrefs.GetInt("volumeFX")/10;
            }
        }
    }
예제 #2
0
    void Start()
    {
        if(PlayerPrefs.HasKey("volumeFX"))
        {
            if(GetComponent<AudioSource>() != null)
            {
                AudioSource audio = GetComponent<AudioSource>();
                audio.volume = (float)PlayerPrefs.GetInt("volumeFX")/10;
            }
        }

        spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();
        spriteFont = GetComponent<exSpriteFont>();
        statusText = "Level " + spawner.getLevelCount()
                         +"\nGates: " + spawner.getNumGates()
                         +"\nGates Hit: " + "6"
                         +"\nGrade:"+"\n"+"\n"+"\n"
                         +"\nTap to Start"
                         +"\n";

        spriteFont.text = statusText;
    }