Пример #1
0
    // Use this for initialization
    void Start()
    {
        intro       = true;
        gameStarted = false;
        gameOver    = false;

        musicTracks      = GetComponents <AudioSource> ();
        soundtrack       = musicTracks[0];
        theme            = musicTracks [1];
        introMusicPlayed = false;

        score       = GameObject.Find("Score");
        scoreText   = score.GetComponent <Text> ();
        spawner     = GameObject.Find("EnemySpawner").GetComponent <SpawnerScript> ();
        health      = GameObject.Find("Health");
        healthText  = health.GetComponent <Text> ();
        gloveHealth = GameObject.Find("glove").GetComponent <GloveHealth> ();
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        rb    = GetComponent <Rigidbody2D> ();
        anim  = GetComponent <Animator> ();
        shake = Camera.main.GetComponent <Animator> ();

        level = GameObject.Find("EnemySpawner").GetComponent <SpawnerScript> ().level;

        gameManager = GameObject.Find("GameManager").GetComponent <GameManager> ();

        //the minimum Y value for the enemy should be determined by the player's "safe zone" size
        targetYMin = gameManager.safeZoneMax;

        selectRandomTarget();

        timer       = timeToAttack;
        attacking   = false;
        glove       = GameObject.Find("glove");
        gloveRb     = glove.GetComponent <Rigidbody2D> ();
        gloveHealth = glove.GetComponent <GloveHealth> ();
    }