示例#1
0
    void Start()
    {
        AddToScore      = 0;
        respawnSet      = false;
        MaxUpgradeTimer = Random.Range(8.0f, 15.0f);
        MaxRespawnTimer = Random.Range(15f, 60.0f);
        Pool            = GameObject.Find("GameUI").GetComponent <ProgressbarBehaviour>();
        CitiesAlive     = GameObject.Find("City Master").GetComponent <CityMaster>();
        CityRenderer    = GetComponentInChildren <SpriteRenderer>();
        CityCollider    = GetComponentInChildren <CircleCollider2D>();
        CurrentLevel    = 1;                                                                                                            //staden börjar på lvl 1
        UpgradeTimer    = MaxUpgradeTimer;                                                                                              //sätter alla timers + health till sina max values
        CurrentHealth   = MaxHealth;
        RespawnTimer    = MaxRespawnTimer;

        Alive        = transform.GetChild(0);                                                                                           //hämtar komponenterna från de två child objekten
        Dead         = transform.GetChild(1);
        CityAnimator = GetComponentInChildren <Animator>();

        Dead.gameObject.SetActive(false);                                                                                               //sätter den döda till false
        dmgDealer           = GetComponent <DamageDealer>();                                                                            //hämtar komponenterna från damagedealer scriptet
        CityRenderer.sprite = DifferentCities[CurrentLevel - 1];
        ChooseType();                                                                                                                   //callar funktionen ChooseType
        citySoundPlayer.clip = citySoundClips[0];
        citySoundPlayer.Play();
        Instantiate(rippleEffect, transform);
    }
示例#2
0
    void Start()
    {
        WorldProgress = GameObject.Find("GameUI").GetComponent <ProgressbarBehaviour>();
        int index = Random.Range(0, WorldSprite.Length - 1);

        foreach (var renderer in WorldRenderer)
        {
            Color WorldSaturation = renderer.material.color;
            WorldSaturation.a       = 1.0f;
            renderer.material.color = WorldSaturation;
        }
    }
示例#3
0
 void Start()
 {
     Pool          = GameObject.Find("GameUI").GetComponent <ProgressbarBehaviour>();
     CitiesAlive   = GameObject.Find("City Master").GetComponent <CityMaster>();
     CityRenderer  = GetComponentInChildren <SpriteRenderer>();
     CityCollider  = GetComponentInChildren <CircleCollider2D>();
     CurrentHealth = MaxHealth;
     Alive         = transform.GetChild(0);
     Dead          = transform.GetChild(1);
     CityAnimator  = GetComponentInChildren <Animator>();
     Dead.gameObject.SetActive(false);
     dmgDealer = GetComponent <DamageDealer>();
     Instantiate(RippleEffect, transform);
     ChooseType();
     //citySoundPlayer.clip = citySoundClips[0];
     //citySoundPlayer.Play();
 }
示例#4
0
    //private bool SecondWave = false;
    //private bool ThirdWave = false;
    //private bool BossWave = false;
    //int BossSelection;
    //int BossSeed;

    void Start()
    {
        instance    = this;
        currentWave = 1;
        Pool        = GameObject.Find("GameUI").GetComponent <ProgressbarBehaviour>();
        //BossCities = new Transform[AmmountOfBossCities];
        //BossCities[0] = transform.Find("BossCity");
        //BossCities[1] = transform.Find("BossCity (1)");
        //BossCities[2] = transform.Find("BossCity (2)");

        {
            Cities     = new Transform[AmmountOfCities];
            Cities[0]  = transform.Find("CityParent");
            Cities[1]  = transform.Find("CityParent (1)");
            Cities[2]  = transform.Find("CityParent (2)");
            Cities[3]  = transform.Find("CityParent (3)");
            Cities[4]  = transform.Find("CityParent (4)");
            Cities[5]  = transform.Find("CityParent (5)");
            Cities[6]  = transform.Find("CityParent (6)");
            Cities[7]  = transform.Find("CityParent (7)");
            Cities[8]  = transform.Find("CityParent (8)");
            Cities[9]  = transform.Find("CityParent (9)");
            Cities[10] = transform.Find("CityParent (10)");
            Cities[11] = transform.Find("CityParent (11)");
            Cities[12] = transform.Find("CityParent (12)");
            Cities[13] = transform.Find("CityParent (13)");
            Cities[14] = transform.Find("CityParent (14)");
            Cities[15] = transform.Find("CityParent (15)");
            Cities[16] = transform.Find("CityParent (16)");
            Cities[17] = transform.Find("CityParent (17)");
            Cities[18] = transform.Find("CityParent (18)");
            Cities[19] = transform.Find("CityParent (19)");
            Cities[20] = transform.Find("CityParent (20)");
            Cities[21] = transform.Find("CityParent (21)");
            Cities[22] = transform.Find("CityParent (22)");
            Cities[23] = transform.Find("CityParent (23)");
            Cities[24] = transform.Find("CityParent (24)");
        }
        SpawnTimer   = 0;
        respawnTimer = 30;
        for (int i = 0; i < AmmountOfCities; i++)
        {
            Cities[i].gameObject.SetActive(false);
        }
    }
示例#5
0
    void Start()
    {
        WorldProgress = GameObject.Find("GameUI").GetComponent <ProgressbarBehaviour>();
        Blobs         = new Transform[7];
        Blobs[0]      = transform.Find("Blob");
        Blobs[1]      = transform.Find("Blob (1)");
        Blobs[2]      = transform.Find("Blob (2)");
        Blobs[3]      = transform.Find("Blob (3)");
        Blobs[4]      = transform.Find("Blob (4)");
        Blobs[5]      = transform.Find("Blob (5)");
        Blobs[6]      = transform.Find("Blob (6)");

        foreach (var renderer in BlobRenderer)
        {
            Color WorldSaturation = renderer.material.color;
            WorldSaturation.a       = 1.0f;
            renderer.material.color = WorldSaturation;
        }
    }
示例#6
0
 void Start()
 {
     WorldProgress = GameObject.Find("GameUI").GetComponent <ProgressbarBehaviour>();
 }