示例#1
0
 void Start()
 {
     runner = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerScript> ();
     score = GameObject.FindGameObjectWithTag("Score").GetComponent<RunnerScoring> ();
     transform.position = new Vector3 (runner.transform.position.x, runner.transform.position.y, runner.transform.position.z);
     allowTrailRender = true;
 }
示例#2
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;
    }
示例#3
0
    void Start()
    {
        //Object access
        pSys = GameObject.FindGameObjectWithTag("BackgroundEffect").GetComponent<ParticleSystem>();
        screenEdge = GameObject.FindGameObjectWithTag("Top").GetComponent<Collider>().bounds.min.x;
        score = GameObject.FindGameObjectWithTag("Score").GetComponent<RunnerScoring>();
        recognizer = GameObject.FindGameObjectWithTag("Recognizer").GetComponent<TapDetector>();
        rCollision = gameObject.GetComponent<RunnerCollision>();
        pSys = GameObject.FindGameObjectWithTag("BackgroundEffect").GetComponent<ParticleSystem>();
        fadeScreen = GameObject.FindGameObjectWithTag("FadeScreen").GetComponent<RedSpriteFade>();
        myCamera = GameObject.FindGameObjectWithTag ("MainCamera");
        myTransform = transform;

        //Start variables
        startPosition = myTransform.position;
        gravityButton = false;
        recognizer.setOnStart(true);
        setState (State.respawn);

        //Camera effects
        shakeAmount = 1.5f;
        fadeScreen.setRenderer(false);

            //Red UI frames
            change1 = false;
            change2 = false;
            change3 = false;
            change4 = false;
            change5 = false;

        //Animation variables
        flip = GetComponent<exSprite>();
    }
    // Use this for initialization
    void Start()
    {
        levelCount = 0;
        newLevelCount = 30.0f;
        timerLimit = 1.0f;

        //Assign object spawn variables
        counterLimitMin = 1.0f;
        counterLimitMax = counterLimitMin * 5.0f;
        counterLimit = Random.Range(counterLimitMin, counterLimitMax);

        minX = 100.0f;
        myTransform = transform;
        isDead = true;
        startMarker = false;
        score = GameObject.FindGameObjectWithTag("Score").GetComponent<RunnerScoring>();
        sDetector = GameObject.FindGameObjectWithTag("Recognizer").GetComponent<TapDetector>();
        rPlayer = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerScript>();
        rCollision = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerCollision>();

        marker = GameObject.FindGameObjectWithTag("marker").GetComponent<MoveProgressBar>();
        markerStart = new Vector3(-500.0f, 355.0f, -80.0f);
        markerEnd = new Vector3(500.0f, 355.0f, -80.0f);

        numGates = 0;
        numGatesInLevel = 0;

        spawnedFinish = false;
        crossedFinish = false;
        finish = GameObject.FindGameObjectWithTag("lastObject").GetComponent<LevelFinishScroll>();
        levelText = GameObject.FindGameObjectWithTag("LevelText").GetComponent<LevelDisplay>();
        levelText.setTheLevelText(levelCount);

        //Pass speedVar objects
        bonusDown = GameObject.FindGameObjectWithTag("BonusDown");
        backBackgroundObjects = GameObject.FindGameObjectsWithTag("BackBackground");
        frontBackgroundObjects = GameObject.FindGameObjectsWithTag("FrontBackground");

        if (m_prefabChoices == null || m_prefabChoices.Length == 0)
        {
            return;
        }

        //test
        rPlayer.setGravity((rPlayer.getGravity() + speedVar * -0.10f));

        srslyCounterLimit = 10.0f;
    }
    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;
    }
示例#6
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");
        }
    }