Esempio n. 1
0
    private void Start()
    {
        if (IsNotInCutScene())
        {
            gameMaster        = GameObject.Find("GameMaster");
            deathManager      = gameMaster.GetComponent <DeathManager>();
            pauseManager      = gameMaster.GetComponent <PauseManager>();
            soulsCounter      = gameMaster.GetComponent <SoulsCounter>();
            buildManager      = gameMaster.GetComponent <BuildManager>();
            towerManager      = gameMaster.GetComponent <TowerManager>();
            mouseCursorManage = gameMaster.GetComponent <MouseCursorManager>();
            ShopGObj          = GameObject.Find("Shop");
            if (IsInCorrectScene())
            {
                ShopGObj.SetActive(false);
                shop = ShopGObj.GetComponent <Shop>();
            }
            icosphereLight           = GetComponent <Light>();
            icosphereLight.intensity = initialIntensity;

            if (IsInCorrectScene() == false)
            {
                return;
            }
            masterTowerTowerScript = GameObject.FindWithTag("GameMaster").
                                     GetComponent <InstancesManager>().
                                     GetMasterTowerObj().
                                     GetComponent <TowerScript>();
        }
    }
Esempio n. 2
0
 //Instantiate and initialize
 private void Start()
 {
     gameMaster   = GameObject.Find("GameMaster");
     buildManager = gameMaster.GetComponent <BuildManager> ();
     soulsCounter = gameMaster.GetComponent <SoulsCounter> ();
     scoreCounter = gameMaster.GetComponent <ScoreCounter> ();
     towerManager = gameMaster.GetComponent <TowerManager>();
     shopManager  = gameMaster.GetComponent <ShopManager>();
 }
Esempio n. 3
0
 private void Start()
 {
     SetSouls(initialSouls);
     scoreConstant = initialScoreConst;
     instance      = this;
     scoreCounter  = this.GetComponent <ScoreCounter> ();
     soulsText     = GameObject.Find("SoulsNum").GetComponent <Text> ();
     waveSpawner   = gameObject.GetComponent <WaveSpawner>();
     actionManager = gameObject.GetComponent <ActionManager>();
 }
Esempio n. 4
0
    private void InitializeVariables()
    {
        gameMaster   = GameObject.FindWithTag("GameMaster");
        shopManager  = gameMaster.GetComponent <ShopManager>();
        soulsCounter = gameMaster.GetComponent <SoulsCounter>();

        description        = gameObject.transform.GetChild(1).GetChild(0).gameObject;
        shopTowerItemImage = gameObject.transform.GetChild(1).GetChild(1).GetChild(1).gameObject;
        AttackTowerValues  = description.transform.GetChild(3).GetChild(0).gameObject;
        upgradeProperty    = description.transform.GetChild(2).gameObject;
    }
Esempio n. 5
0
 private void Start()
 {
     masterTower       = GameObject.Find("MasterTower");
     soulsConter       = this.GetComponent <SoulsCounter> ();
     masterTowerScript = masterTower.GetComponent <MasterTowerScript> ();
     actionManager     = gameObject.GetComponent <ActionManager>();
     baseSpeed         = baseSpeedConst;
     baseHP            = baseHPConst;
     if (IsInCorrectScene() == false)
     {
         return;
     }
     waveNumberText    = GameObject.Find("wave").GetComponent <Text>();
     waveCountdownText = GameObject.Find("CooldownNum").GetComponent <Text>();
     warningWaveText   = GameObject.Find("WaveWarningNum").GetComponent <Text>();
 }
Esempio n. 6
0
 void Start()
 {
     if (IsInCorrectScene())
     {
         gameMaster         = GameObject.FindGameObjectWithTag("GameMaster");
         sphereShop         = GameObject.FindGameObjectWithTag("Icosphere").GetComponent <SphereShop>();
         mouseCursorManager = gameMaster.GetComponent <MouseCursorManager>();
         deathManager       = gameMaster.GetComponent <DeathManager>();
         buildManager       = gameMaster.GetComponent <BuildManager>();
         towerManager       = gameMaster.GetComponent <TowerManager>();
         shopScript         = gameMaster.GetComponent <InstancesManager>().GetShopGObj().GetComponent <Shop>();
         soulsCounter       = SoulsCounter.instance;
         scoreCounter       = ScoreCounter.instance;
         towerToBuild       = null;
         isAlreadBuilt      = false;
     }
 }
Esempio n. 7
0
    void Start()
    {
        isDead = false;

        actionManager = GameObject.FindWithTag("GameMaster").GetComponent <ActionManager>();

        enemy = gameObject.GetComponent <Enemy> ();

        // Setting current HP to maximumHP
        HP            = enemy.getHP();
        maximumHealth = HP;

        SetHPTextOnHealthBar();

        // Rotating enemy UI (health bar) at beginning and desactivating it
        enemyHealthBar.transform.rotation = GameObject.FindGameObjectWithTag("MainCamera").gameObject.transform.rotation;
        enemyHealthBar.SetActive(false);

        soulsCounter = SoulsCounter.instance;
    }
Esempio n. 8
0
    public virtual void Start()
    {
        name = gameObject.name;

        gameMaster   = GameObject.FindGameObjectWithTag("GameMaster");
        soulsCounter = gameMaster.GetComponent <SoulsCounter>();
        scoreCounter = gameMaster.GetComponent <ScoreCounter>();

        currentTowerProperties = gameObject.GetComponentInParent <PropertiesManager>();

        perkButton = gameObject.GetComponentInChildren <Button>();
        if (perkButton == null)
        {
            Debug.LogWarning("There are perks without reference to their buttons");
        }

        perkButton.onClick.AddListener(LevelUp);

        Text[] aux = gameObject.GetComponentsInChildren <Text>();

        foreach (Text t in aux)
        {
            if (t.gameObject.name == "TowerName")
            {
                t.text = name;
            }

            if (t.gameObject.name == "Price")
            {
                t.text = cost.ToString() + " Souls";
            }

            if (t.gameObject.name == "UpgradeProperty")
            {
                t.text = description;
            }

            if (t.gameObject.name == "Level")
            {
                t.text = "Level: " + level.ToString() + "/" + maxLevel.ToString();
            }

            if (t.gameObject.name == "MinWave")
            {
                t.text = "Min wave: " + minWaveToActivate.ToString();
            }
        }

        Image[] aux_ = gameObject.GetComponentsInChildren <Image>();

        foreach (Image i in aux_)
        {
            if (i.gameObject.name == "ShopTowerItem")
            {
                i.sprite = upgradeIcon;
            }
        }

        /* // If you wanna set automatically, try this. In our case, we choose not because of Canvas Horizontal Layout Group
         * Perk[] _childs = gameObject.GetComponentsInChildren<Perk> ();
         * foreach (Perk p in _childs) {
         *  if (p.transform.parent != this.transform)
         *      _childs[Array.FindIndex (_childs, perk => perk == p)] = null;
         * }
         *
         * childs = new List<Perk> ();
         *
         * foreach (Perk p in _childs) {
         *  if (p != null) {
         *      childs.Add (p);
         *  }
         * }
         */
    }
Esempio n. 9
0
 private void Awake()
 {
     towerToBuildIndex = 0;
     towerToBuild      = null;
     soulsCounter      = gameObject.GetComponent <SoulsCounter> ();
 }