Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        manager = GameObject.Find("gameManager").GetComponent <gameManagerScript>();
        manager.towerList.Add(this);

        store       = GameObject.Find("gameManager").GetComponent <storeScript>();
        this.damage = store.currentTowerDamage;
        this.speed  = store.currentTowerSpeed;

        if (direction == "")
        {
            direction = "right";
            dVector   = new Vector3(1, 0);
        }

        currentTime = fireRate / 2.0f;

        DetermineDirection();
    }
Пример #2
0
    // Use this for initialization
    void Awake()
    {
        cores = new List <GameObject>();

        playerScript = GameObject.Find("Player").GetComponent <playerScript>();
        strScrpt     = GameObject.Find("gameManager").GetComponent <storeScript>();
        score        = 0;
        scoreText    = GameObject.Find("ScoreText").GetComponent <Text>();
        waveText     = GameObject.Find("WaveText").GetComponent <Text>();
        gameOverText = GameObject.Find("GameOverText");
        gameOverText.SetActive(false);


        restartButton       = GameObject.Find("Restart Button");
        fireRateButton      = GameObject.Find("Projectile Speed Button");
        damageUpgradeButton = GameObject.Find("Projectile Damage Button");

        restartButton.SetActive(false);
        fireRateButton.SetActive(false);
        damageUpgradeButton.SetActive(false);

        waveNumber    = 0;
        waveText.text = "Wave " + waveNumber;

        spawnLocation = Vector2.zero;
        spawnTimer    = 0;

        nextWaveButton = GameObject.Find("NextWaveButton");

        //this method call will be moved later once we have a game loop that continually generates waves once the previous is beaten
        setupWave();

        enemyList = new List <GameObject>();
        //cores = new List<GameObject>();
        towerList = new List <towerScript>();
    }