Наследование: MonoBehaviour
Пример #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()
 {
     runner1 = GameObject.FindGameObjectWithTag("Player1").GetComponent <RunnerScript>();
     runner2 = GameObject.FindGameObjectWithTag("Player2").GetComponent <RunnerScript3>();
     runner3 = GameObject.FindGameObjectWithTag("Player3").GetComponent <RunnerScript4>();
     runner4 = GameObject.FindGameObjectWithTag("Player4").GetComponent <RunnerScript2>();
 }
Пример #3
0
 void Awake()
 {
     instance    = this;
     triggered   = false;
     goal        = false;
     trySolution = false;
     timeElapsed = 0;
     startPos    = transform.position;
     startRot    = transform.rotation;
 }
    void Start()
    {
        runner = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerScript> ();
        speedFromSpawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>().getSpeedVar();
        myTransform = transform;
        bonusStartPosition = new Vector3 (runner.collider.bounds.min.x, runner.transform.position.y, runner.transform.position.z);
        myTransform.position = bonusStartPosition;
        allowMove = true;

        //Hide on start
        renderer.enabled = false;
    }
Пример #5
0
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log("DEAD!");

        Movement     player = other.gameObject.GetComponentInParent <Movement>();
        RunnerScript ghost  = other.gameObject.GetComponent <RunnerScript>();

        if (player)
        {
            player.Reset();
        }
    }
Пример #6
0
    public void Reset()
    {
        gameObject.transform.rotation = rotQ;
        gameObject.transform.position = startPosition;
        rb.velocity        = Vector3.zero;
        rb.angularVelocity = Vector3.zero;

        RunnerScript ghost = GameObject.FindObjectOfType <RunnerScript>();

        if (ghost)
        {
            ghost.Reset();
        }
    }
Пример #7
0
 // Use this for initialization
 void Awake()
 {
     objectQueue = new Queue <Transform>(numberOfObjects);
     nextPos     = startPos;
     //spawn the objects that will make up the "infinite" running surface
     for (int i = 0; i < numberOfObjects; i++)
     {
         Vector3   spawnPos   = new Vector3(startPos.x + (surfaceWidth * i), startPos.y, startPos.z);
         Transform newSurface = (Transform)Instantiate(surface, spawnPos, Quaternion.identity);
         objectQueue.Enqueue(newSurface);
         nextPos = spawnPos;
     }
     cat          = GameObject.Find("Cat");
     runnerScript = cat.GetComponent <RunnerScript>();
     retryButton  = GameObject.Find("RetryButton");
     retryButton.SetActive(false);
 }
Пример #8
0
    private void OnTriggerEnter(Collider other)
    {
        Movement player = other.gameObject.GetComponentInParent <Movement>();

        if (player)
        {
            if (!HasReachedAlready)
            {
                HasReachedAlready = true;
                Debug.Log("Checkpoint Saved!");
                player.startPosition = transform.position + new Vector3(0, 2, 1);

                RunnerScript ghost = GameObject.FindObjectOfType <RunnerScript>();
                if (ghost)
                {
                    ghost.startPosition = ghost.gameObject.transform.position;
                }
            }
        }
    }
Пример #9
0
 // Use this for initialization
 void Start()
 {
     runscpt = this.gameObject.GetComponent <RunnerScript>();
 }
Пример #10
0
    // 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;
    }
Пример #11
0
    void Start()
    {
        //Object access
        runner = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerScript>();
        runnerCol = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerCollision>();
        spriteFont = GetComponent<exSpriteFont>();

        //Initiated by swipeDetector.cs
        hasStarted = false;

        //Set in runnerCollision
        scoreMultiplier = 1;

        //acheivs
        achieve1 = false;
        achieve2 = false;
        delay = 1.0f;

        //Gate Scoring
        gateScore = 0;
        gateScoreMulti = 1;
    }
Пример #12
0
 void Start()
 {
     blinkTime = 0.0f;
     buttonTimer = 20.0f;
     buttonTimerLimit = 20.0f;
     canUsePowerUp = true;
     rCollision = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerCollision>();
     runner = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerScript>();
     pause = GameObject.FindGameObjectWithTag("PauseButton").GetComponent<PauseButton>();
     typeIsSet = false;
     onStart = true;
     type = tag;
     collider.enabled = false;
     renderer.enabled = false;
 }
 void Start()
 {
     //If not title screen
     if (Application.loadedLevel != 0)
         player = GameObject.FindGameObjectWithTag("Player").GetComponent<RunnerScript>();
 }
Пример #14
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;
    }