// Use this for initialization void Start() { structure = this.GetComponent <UnitStructure>(); structure.HP = 2000; structure.HPMax = 2000; UnitsBuilt = new Transform[5]; if (gameObject.tag == "Enemy") { structure.healthBar = GameObject.Find("HealthBarforEnemyBase"); } else { structure.healthBar = GameObject.Find("HealthBarforBase"); } structure.HP_Bar = structure.healthBar.GetComponent <Slider>(); structure.HP_Bar.minValue = 0; structure.HP_Bar.maxValue = 2000; structure.HP_Bar.value = structure.HP; structure.BaseUnit = this; if (this.tag != "Enemy") { infos = new Text[7]; InfoPanel = GameObject.Find("InfoPanel"); //int i = 0; Traverse(InfoPanel, 0); } }
// Use this for initialization void Start() { structure = this.GetComponent<UnitStructure>(); structure.HP = 2000; structure.HPMax = 2000; UnitsBuilt = new Transform[5]; if (gameObject.tag == "Enemy") structure.healthBar = GameObject.Find("HealthBarforEnemyBase"); else structure.healthBar = GameObject.Find("HealthBarforBase"); structure.HP_Bar = structure.healthBar.GetComponent<Slider>(); structure.HP_Bar.minValue = 0; structure.HP_Bar.maxValue = 2000; structure.HP_Bar.value = structure.HP; structure.BaseUnit = this; if (this.tag != "Enemy") { infos = new Text[7]; InfoPanel = GameObject.Find("InfoPanel"); //int i = 0; Traverse(InfoPanel, 0); } }
// Use this for initialization void Start() { if (localPlayerAuthority) { structure = this.GetComponent <UnitStructure>(); structure.HP = 500; structure.HPMax = 500; attributeCosts(); //Debug.Log (structure.costs [0]); structure.colorUnit = gameObject.GetComponent <Renderer>().material.color; structure.isInConstruction = true; StartCoroutine(structure.waitConstruction(20f, structure.colorUnit)); //BaseManager.resources -= structure.costs [0]; structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name); structure.HP_Bar = structure.healthBar.GetComponent <Slider>(); structure.HP_Bar.minValue = 0; structure.HP_Bar.maxValue = structure.HPMax; structure.HP_Bar.value = structure.HP; structure.theName = "Defensive Unit"; //GameObject temp = GameObject.Find("Base"); GameObject temp = GameObject.Find("Base(Clone)"); structure.BaseUnit = temp.GetComponent <BaseManager>(); tempName = gameObject.name.Substring(0, 9); //Debug.Log(tempName); structure.panel = GameObject.Find("BuildPanelfor" + tempName); changePanel(); structure.panel.SetActive(activeMarker); disorientDuration = 10f; rockCooldown = 60; } }
// Use this for initialization void Start() { if (localPlayerAuthority) { resourceFields = new GameObject[3]; resourceFields = GameObject.FindGameObjectsWithTag("resource"); structure = this.GetComponent <UnitStructure>(); structure.HP = 200; structure.HPMax = 200; attributeCosts(); structure.colorUnit = gameObject.GetComponent <Renderer>().material.color; structure.isInConstruction = true; structure.statusUpdater = status(); //Debug.Log(structure.statusUpdater); StartCoroutine(structure.waitConstruction(20f, structure.colorUnit)); BaseManager.resources -= structure.costs[0]; structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name); structure.HP_Bar = structure.healthBar.GetComponent <Slider>(); structure.HP_Bar.minValue = 0; structure.HP_Bar.maxValue = structure.HPMax; structure.HP_Bar.value = structure.HP; structure.theName = "Special Unit"; //GameObject temp = GameObject.Find("Base"); GameObject temp = GameObject.Find("Base(Clone)"); structure.BaseUnit = temp.GetComponent <BaseManager>(); tempName = gameObject.name.Substring(0, 9); //Debug.Log(tempName); structure.panel = GameObject.Find("BuildPanelfor" + tempName); changePanel(); structure.panel.SetActive(activeMarker); upgradeDuration = 30f; repDur = 30f; repCD = 60f; } }
void updateText() { gatheringSpeed = 0; for (int i = 0; i <= 6; i++) { if (infos [i]) { if (i == 0) { infos [i].text = "Status: Alive & Ready \n" + "Health: " + structure.HP + "\n Shield: " + shieldPower; } if (i >= 1 && i <= 5) { if (UnitsBuilt [i - 1]) { UnitStructure temp = UnitsBuilt [i - 1].GetComponent <UnitStructure>(); Debug.Log(temp.tag); infos [i].text = "Unit" + i + ": " + temp.theName + "\n" + "Health: " + temp.HP + "\n" + "Status: " + temp.statusUpdater; Debug.Log(temp.statusUpdater); if (temp.GetComponent <SpecialUnit>()) { gatheringSpeed += temp.GetComponent <SpecialUnit>().lastGathered; Debug.Log(temp.GetComponent <SpecialUnit>().lastGathered); } } } if (i == 6) { infos [i].text = "Resources: " + resources + " " + notEnough + " " + "\n Gathering Speed: " + gatheringSpeed; } } } }
//bool throwingRocks = false; // Use this for initialization void Start() { if (localPlayerAuthority && hasAuthority) { Debug.Log("BOOM! Attacking Unit Arrived Setting vars!"); structure = this.GetComponent <UnitStructure>(); structure.HP = 250; structure.HPMax = 250; //attributeCosts (); structure.colorUnit = gameObject.GetComponent <Renderer>().material.color; structure.isInConstruction = true; StartCoroutine(structure.waitConstruction(20f, structure.colorUnit)); //needs to be 20; structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name); structure.HP_Bar = structure.healthBar.GetComponent <Slider>(); structure.HP_Bar.minValue = 0; structure.HP_Bar.maxValue = structure.HPMax; structure.theName = "Attacking Unit"; //GameObject temp = GameObject.Find("Base"); GameObject temp = GameObject.Find("Base(Clone)"); structure.BaseUnit = temp.GetComponent <BaseManager>(); tempName = gameObject.name.Substring(0, 9); // Debug.Log(tempName); structure.panel = GameObject.Find("BuildPanelfor" + tempName); changePanel(); structure.panel.SetActive(activeMarker); targets = new Transform[3]; RocksMin = 20; RocksMax = 40; startAngle = gameObject.transform.rotation.z; co = rockFlurr(); } }
//bool throwingRocks = false; // Use this for initialization void Start() { if (localPlayerAuthority && hasAuthority) { Debug.Log("BOOM! Attacking Unit Arrived Setting vars!"); structure = this.GetComponent<UnitStructure>(); structure.HP = 250; structure.HPMax = 250; //attributeCosts (); structure.colorUnit = gameObject.GetComponent<Renderer>().material.color; structure.isInConstruction = true; StartCoroutine(structure.waitConstruction(20f, structure.colorUnit)); //needs to be 20; structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name); structure.HP_Bar = structure.healthBar.GetComponent<Slider>(); structure.HP_Bar.minValue = 0; structure.HP_Bar.maxValue = structure.HPMax; structure.theName = "Attacking Unit"; //GameObject temp = GameObject.Find("Base"); GameObject temp = GameObject.Find("Base(Clone)"); structure.BaseUnit = temp.GetComponent<BaseManager>(); tempName = gameObject.name.Substring(0, 9); // Debug.Log(tempName); structure.panel = GameObject.Find("BuildPanelfor" + tempName); changePanel(); structure.panel.SetActive(activeMarker); targets = new Transform[3]; RocksMin = 20; RocksMax = 40; startAngle = gameObject.transform.rotation.z; co = rockFlurr(); } }
// Use this for initialization void Start() { if (localPlayerAuthority) { resourceFields = new GameObject[3]; resourceFields = GameObject.FindGameObjectsWithTag("resource"); structure = this.GetComponent<UnitStructure>(); structure.HP = 200; structure.HPMax = 200; attributeCosts(); structure.colorUnit = gameObject.GetComponent<Renderer>().material.color; structure.isInConstruction = true; structure.statusUpdater = status(); //Debug.Log(structure.statusUpdater); StartCoroutine(structure.waitConstruction(20f, structure.colorUnit)); BaseManager.resources -= structure.costs[0]; structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name); structure.HP_Bar = structure.healthBar.GetComponent<Slider>(); structure.HP_Bar.minValue = 0; structure.HP_Bar.maxValue = structure.HPMax; structure.HP_Bar.value = structure.HP; structure.theName = "Special Unit"; //GameObject temp = GameObject.Find("Base"); GameObject temp = GameObject.Find("Base(Clone)"); structure.BaseUnit = temp.GetComponent<BaseManager>(); tempName = gameObject.name.Substring(0, 9); //Debug.Log(tempName); structure.panel = GameObject.Find("BuildPanelfor" + tempName); changePanel(); structure.panel.SetActive(activeMarker); upgradeDuration = 30f; repDur = 30f; repCD = 60f; } }
// Use this for initialization void Start() { if (localPlayerAuthority) { structure = this.GetComponent<UnitStructure>(); structure.HP = 500; structure.HPMax = 500; attributeCosts(); //Debug.Log (structure.costs [0]); structure.colorUnit = gameObject.GetComponent<Renderer>().material.color; structure.isInConstruction = true; StartCoroutine(structure.waitConstruction(20f, structure.colorUnit)); //BaseManager.resources -= structure.costs [0]; structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name); structure.HP_Bar = structure.healthBar.GetComponent<Slider>(); structure.HP_Bar.minValue = 0; structure.HP_Bar.maxValue = structure.HPMax; structure.HP_Bar.value = structure.HP; structure.theName = "Defensive Unit"; //GameObject temp = GameObject.Find("Base"); GameObject temp = GameObject.Find("Base(Clone)"); structure.BaseUnit = temp.GetComponent<BaseManager>(); tempName = gameObject.name.Substring(0, 9); //Debug.Log(tempName); structure.panel = GameObject.Find("BuildPanelfor" + tempName); changePanel(); structure.panel.SetActive(activeMarker); disorientDuration = 10f; rockCooldown = 60; } }