private void Start() { minionSpeed = enemyModel.movementSpeed; casteHealth = GameObject.FindGameObjectWithTag("Castle").GetComponent <CastleHealth>(); UILog = GameObject.FindGameObjectWithTag("Canvas").GetComponentInChildren <Text>(true); EventManager.TriggerEvent(enemyName + "born"); }
//activated the barrel trap collider public static void Activated(GameObject currentObject) { b_Collider = currentObject.GetComponent <Collider> (); b_Collider.enabled = true; CastleHealth.DealDamage(5f); activated = true; }
// Update is called once per frame void Update() { HealthShow = Health; Tijd += 1 * Time.deltaTime; if (transform.position.x < 12) { //update position to a new vector3(x,y,z). the x variable determines the speed of the object transform.position = transform.position + new Vector3(speed * Time.deltaTime, 0, 0); } if (transform.position.x >= 12) { GameObject w = GameObject.Find("Castle"); CastleHealth castleHealth = w.GetComponent <CastleHealth>(); castleHealth.currentwallHP -= 0.5f * Time.deltaTime; castleHealth.healthText.text = "Health: " + castleHealth.currentwallHP.ToString("0") + "%"; if (castleHealth.currentwallHP <= 0) { castleHealth.healthText.text = "Game over."; GameObject s = GameObject.Find("Spawner"); SpawnScript spawnScript = s.GetComponent <SpawnScript>(); spawnScript.stopSpawning = true; } } if (Health <= 0) { //destroy gameobject attached to this script Destroy(this.gameObject); } }
private void Awake() { if (instance != null) { return; } instance = this; }
public void LoadUIData() { GameObject gameUI = GameObject.FindGameObjectWithTag("Castle"); CastleHealth tempCasteHealth = gameUI.GetComponent <CastleHealth>(); tempCasteHealth.timeRemaining = Game.current.UI_Data.timer; tempCasteHealth.currentHealth = Game.current.UI_Data.currentHealth; }
void doDamage() { if (dead != true && isEnded == true) { Levels.Play(); CastleHealth.DealDamage(damage); } }
public void saveUIData() { GameObject gameUI = GameObject.FindGameObjectWithTag("Castle"); CastleHealth tempCasteHealth = gameUI.GetComponent <CastleHealth>(); UI_Data.currentHealth = tempCasteHealth.currentHealth; UI_Data.timer = tempCasteHealth.timeRemaining; //UI_Data.score = tempCasteHealth.s }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
private IEnumerator timer() { CastleHealth.GainHealth(hp); foreach (GameObject particle in particleChildren) { Destroy(particle); } Shoot.Play(); yield return(new WaitForSeconds(2)); Destroy(Parent); }
//private Target target; void OnTriggerEnter(Collider other) { damageSound.Play(); Debug.Log("Damage!"); castle = FindObjectOfType <CastleHealth>(); castle.CastleDam(); //target = FindObjectOfType<Target>(); Instantiate(explosion, transform.position, transform.rotation); Destroy(other.gameObject); Destroy(gameObject); //target.damage += 1; }
public void Init(GameObject tower) { // ShowTowerPopup window = ScriptableObject.CreateInstance<ShowTowerPopup>(); // window.position = new Rect(Screen.width / 2 + 100, Screen.height / 2 - 50, 300, 300); // GetComponent<Canvas> ().enabled = true; castle = GameObject.Find("Castle").GetComponent <CastleHealth>(); uGen = Camera.main.GetComponent <UnitGenerator>(); cFire = tower.transform.FindChild("Turret").GetComponent <CannonFire>(); // pause game previousTimeScale = Time.timeScale; Time.timeScale = 0; }
void Start() { health = GetComponent <Health>(); rangeCollider = GetComponentInChildren <RangeCollider>(); TryGetComponent <Shooter>(out myShooter); audioManager = AudioManager.instance; anim = GetComponent <Animator>(); castleHealth = CastleHealth.instance; sr = transform.GetComponentInChildren <SpriteRenderer>(); startingBluntDamage = bluntDamage; startingSlashDamage = slashDamage; startingPiercingDamage = piercingDamage; startingFireDamage = fireDamage; StartCoroutine(Movement()); }
// Use this for initialization void Start() { castle = GameObject.Find("Castle").GetComponent <CastleHealth>(); //GetComponent<Canvas> ().enabled = false; GameObject.Find("TrainingWindow").GetComponent <Canvas>().enabled = false; GameObject.Find("TrainButton").GetComponent <Button> () .onClick.AddListener(delegate { if (castle.canPurchase(price)) { train(); GetComponent <Canvas> ().enabled = false; } else if (!castle.canPurchase(price)) { Debug.Log("Not enough money"); } else if (getTotalUnits() == 0) { Debug.Log("No units to train!"); } }); }
void Start() { castleHealth = CastleHealth.instance; }
// Update the current health value at health bar void Update() { record.text = "Castle Health: " + CastleHealth.currentHealthLevel + "/200"; CastleHealthBar.value = CastleHealth.CalculateHealth(); }
// Use this for initialization void Start() { money = GameObject.Find("Castle").GetComponent <CastleHealth>(); amountMoney.text = "$" + money.curMoney; }
// Use this for initialization void Start() { buildingPlacement = GetComponent <BuildingPlacement>(); buildingPlacement.SetManager(this); castle = GameObject.Find("Castle").GetComponent <CastleHealth>(); }
// Use this for initialization void Start() { castle = GameObject.Find("Castle").GetComponent<CastleHealth>(); //GetComponent<Canvas> ().enabled = false; GameObject.Find("TrainingWindow").GetComponent<Canvas>().enabled = false; GameObject.Find ("TrainButton").GetComponent<Button> () .onClick.AddListener (delegate { if(castle.canPurchase(price)) { train(); GetComponent<Canvas> ().enabled = false; } else if(!castle.canPurchase(price)) { Debug.Log("Not enough money"); } else if(getTotalUnits() == 0) { Debug.Log("No units to train!"); } }); }
public void Init(GameObject tower) { // ShowTowerPopup window = ScriptableObject.CreateInstance<ShowTowerPopup>(); // window.position = new Rect(Screen.width / 2 + 100, Screen.height / 2 - 50, 300, 300); // GetComponent<Canvas> ().enabled = true; castle = GameObject.Find("Castle").GetComponent<CastleHealth>(); uGen = Camera.main.GetComponent<UnitGenerator>(); cFire = tower.transform.FindChild("Turret").GetComponent<CannonFire>(); // pause game previousTimeScale = Time.timeScale; Time.timeScale = 0; }
// Use this for initialization void Start() { buildingPlacement = GetComponent<BuildingPlacement>(); buildingPlacement.SetManager (this); castle = GameObject.Find("Castle").GetComponent<CastleHealth>(); }
// Update is called once per frame void Update() { money = GameObject.Find("Castle").GetComponent<CastleHealth>(); amountMoney.text = "$" + money.curMoney; }
// Use this for initialization void Start() { health = GameObject.Find("Castle").GetComponent <CastleHealth>(); amountHealth.text = (int)(health.curHealth * 100) + "/100"; }
void Start() { castleHealth = GetComponent <CastleHealth>(); }
// Update is called once per frame void Update() { health = GameObject.Find("Castle").GetComponent <CastleHealth>(); amountHealth.text = (int)Mathf.Round((health.curHealth * 100)) + "/100"; }