Ejemplo n.º 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;
            }
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        myTransform = transform;
        spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();

        //Change y pos
        myTransform.position = new Vector3(1205.0f, Random.Range(-300.0f, 300.0f), myTransform.position.z);
    }
Ejemplo n.º 3
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;
    }
Ejemplo n.º 4
0
    void Start()
    {
        //Cache
        myTransform = transform;
        myCollider = collider;
        runner = GameObject.FindGameObjectWithTag ("Player");
        spawner = GameObject.FindGameObjectWithTag ("Spawner").GetComponent<SpawnObstacles> ();
        topBorder = GameObject.FindGameObjectWithTag("Top");
        bottomBorder = GameObject.FindGameObjectWithTag("Bottom");
        runnerScore = GameObject.FindGameObjectWithTag ("Score").GetComponent<RunnerScoring>();
        runnerScoreMulti = GameObject.FindGameObjectWithTag ("ScoreMulti").GetComponent<RunnerScoringMulti>();

        //Positioning initialization
        if(gameObject.CompareTag("BottomGate"))
        {
            speedVarBottomTop = speedVar * Random.Range(0.2f, 0.4f);
            myTransform.position = new Vector3 (590.0f, bottomBorder.collider.bounds.max.y, 0.0f);
        }

        if(gameObject.CompareTag("TopGate"))
        {
            speedVarBottomTop = speedVar * Random.Range(0.2f, 0.4f);
            myTransform.position = new Vector3 (590.0f, topBorder.collider.bounds.min.y, 0.0f);
        }

        if(gameObject.CompareTag("CenterGate"))
        {
            myTransform.position = new Vector3 (590.0f, 0.0f, 0.0f);
        }

        if(gameObject.CompareTag("regGate"))
        {
            myTransform.position = new Vector3 (590.0f, topBorder.collider.bounds.min.y - myCollider.bounds.extents.y, 0.0f);
        }

        if(gameObject.CompareTag("MovingGate"))
        {
            myTransform.position = new Vector3 (590.0f, myTransform.position.y, 0.0f);
            myTransform.localScale = new Vector3(myTransform.localScale.x, Random.Range(100, 250), myTransform.localScale.z);
            speedVarMovingGate = speedVar * Random.Range(0.5f, 0.7f);
            if (Random.Range (0, 2) == 1 )
            {
                speedVarMovingGate *= -1;
            }
        }

        //Scoring initialization
        allowScoreOnPass = true;
    }
Ejemplo n.º 5
0
 public void SetSpawnScript(SpawnObstacles script)
 {
     m_spawnScript = script;
 }
Ejemplo n.º 6
0
 void Start()
 {
     renderer.enabled = false;
     myTransform = transform;
     allowFirstMove = false;
     allowSecondMove = false;
     clearScreen = false;
     screenEdgeLeft = GameObject.FindGameObjectWithTag("Top").GetComponent<Transform>().collider.bounds.min.x;
     resetPosition = new Vector3(1205.0f, 0.0f, 2.0f);
     spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();
     speed = spawner.getSpeedVar();
 }
Ejemplo n.º 7
0
 // Start is called before the first frame update
 void Start()
 {
     screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z));
     manager      = FindObjectOfType <SpawnObstacles>();
 }
Ejemplo n.º 8
0
 public void SetSpawnObstaclesScript(SpawnObstacles spawnObstacles)
 {
     m_spawnObjectsScript = spawnObstacles;
 }
Ejemplo n.º 9
0
 // Start is called before the first frame update
 void Start()
 {
     instance = this;
     gameOverText.SetActive(false);
     gameRestartText.SetActive(false);
 }
Ejemplo n.º 10
0
 void Start()
 {
     gameController = FindObjectOfType <GameController>();
     spawnObstacles = GetComponentInParent <SpawnObstacles>();
 }
Ejemplo n.º 11
0
    void Start()
    {
        myTransform = transform;

        if(PlayerPrefs.HasKey("volumeFX"))
        {
            if(GetComponent<AudioSource>() != null)
            {
                AudioSource audio = GetComponent<AudioSource>();
                audio.volume = (float)PlayerPrefs.GetInt("volumeFX")/10;
            }
        }

        //Positioning
        screenEdgeOffset = gameObject.renderer.bounds.size.x/2;
        screenEdgeR = GameObject.FindGameObjectWithTag("Top").GetComponent("Transform").collider.bounds.max.x;
        mySpawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();
        allowAudio = true;

        //Only position parent
        if (tag == "Orb")
        {
            myTransform.position = new Vector3(screenEdgeR +  screenEdgeOffset ,Random.Range(-295,295), -10);
            shakeAmount = 3.0f;
        }

        StartCoroutine(DestroyOverTime());
    }
Ejemplo n.º 12
0
    void Start()
    {
        //Object access
        pMovement = gameObject.GetComponent<RunnerScript> ();
        myTransform = transform;
        collisionBoundOffset = pMovement.collider.bounds.size.y / 4.0f;
        score = GameObject.FindGameObjectWithTag("Score").GetComponent<RunnerScoring>();
        scoreMulti = GameObject.FindGameObjectWithTag("ScoreMulti").GetComponent<RunnerScoringMulti>();
        detector = GameObject.FindGameObjectWithTag("Recognizer").GetComponent<TapDetector>();
        spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();
        myBonusBehaviorDown = GameObject.FindGameObjectWithTag("BonusDown").GetComponent<BonusDownBehavior>();

        //Respawn variables
        respawn = false;
        gameRestart = false;

        //Scoring & bonus
        allowScoring = true;
        allowScoringMultiplier = true;
        allowBonusDown = true;
        numGatesHit = 0;

        //Camera control
        myCamera = GameObject.FindGameObjectWithTag ("MainCamera");

        //Acheivement variables
        closeCallStart = false;
        closeCallEnd = false;
    }
Ejemplo n.º 13
0
    void Start()
    {
        myTransform = transform;
        spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();
        myCollider = gameObject.GetComponent<SphereCollider>();
        topBorder = GameObject.FindGameObjectWithTag("Top");
        bottomBorder = GameObject.FindGameObjectWithTag("Bottom");
        doOnce = false;

        //Add to volume control
        if(PlayerPrefs.HasKey("volumeFX"))
        {
            if(GetComponent<AudioSource>() != null)
            {
                AudioSource audio = GetComponent<AudioSource>();
                audio.volume = (float)PlayerPrefs.GetInt("volumeFX")/10;
            }
        }

        flip = GetComponent<exSprite>();

        //Offsets will use opposite border max/min because this object has a spehere colider, not a box collider
        if(Random.Range(0, 100) > 50)
        {
            offsetY = (topBorder.collider.bounds.max.y - gameObject.collider.bounds.size.y/1.5f);
            flip.VFlip();
            myCollider.center = -myCollider.center;
            Destroy(myTransform.FindChild("Buzzparticlebot").gameObject);

        }

        else
        {
            offsetY = (bottomBorder.collider.bounds.min.y + gameObject.collider.bounds.size.y/1.5f);
            Destroy(myTransform.FindChild("Buzzparticletop").gameObject);
        }

        myTransform.position = new Vector3(myTransform.position.x, offsetY, 0.0f);
    }
Ejemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        //If not title screen
        if(Application.loadedLevel != 0 )
        {
            myTransform = transform;
            myTransform.localScale = new Vector3(Camera.main.orthographicSize * 3, Camera.main.orthographicSize * 2, 1.0f);
            spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();
            rCollision = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerCollision>();
            cam = GameObject.FindGameObjectWithTag("MainCamera").camera;
            score2 = GameObject.FindGameObjectWithTag("Score").GetComponent<RunnerScoring>();
            lObjectSign = GameObject.FindGameObjectWithTag("lastObject").GetComponent<LevelFinishScroll>();

            //Populate background pillars
            backBackgroundObjects = GameObject.FindGameObjectsWithTag("BackBackground");
            frontBackgroundObjects = GameObject.FindGameObjectsWithTag("FrontBackground");
        }
    }