public void FloatText(string style, string msg = "") { GameObject text = Instantiate(textFab, new Vector3(0, 0, 0), Quaternion.identity, canvas.transform); DmgTextController textCont = text.GetComponent <DmgTextController>(); textCont.Init(this.transform.position, style, msg); }
public void ActivateButton() { InventoryItem item = activeList[selected]; if (mode == "buying") { if (data.gold >= item.cost * 5) { data.AddToInventory(item.Copy()); data.gold -= item.cost * 5; goldText.text = data.gold.ToString(); // Float cost text GameObject text = Instantiate(textFab, new Vector3(0, 0, 0), Quaternion.identity, gameObject.transform); DmgTextController textCont = text.GetComponent <DmgTextController>(); textCont.Init(goldText.transform.position, "cost", "-" + (item.cost * 5).ToString()); } } else if (mode == "selling") { data.gold += item.cost; goldText.text = data.gold.ToString(); reselectNeeded = data.RemoveFromInventory(selected); // Float cost text GameObject text = Instantiate(textFab, new Vector3(0, 0, 0), Quaternion.identity, gameObject.transform); DmgTextController textCont = text.GetComponent <DmgTextController>(); textCont.Init(goldText.transform.position, "gold", "+" + (item.cost).ToString()); RefreshItems(); } }
void Start() { DmgTextController.Initialize(); player = FindObjectOfType <Player>(); healthBar = GetComponent <Slider>(); playerHealth = maxPlayerHealth; levelManager = FindObjectOfType <LevelManager>(); isDead = false; }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { DmgTextController.CreateFloatingText(damageToGive.ToString(), transform); HealthManager.HurtPlayer(damageToGive); Destroy(gameObject); } }
public virtual void giveDamage(int damageToGive) { if (name == "TowerShot B" || name == "TowerShot R") // Nay I say { enemyHealth -= damageToGive; // oh yeah this gives dmg to something that shouldn´t even have a health system!!! Great for perfomance.... } else { enemyHealth -= damageToGive; DmgTextController.CreateFloatingText(damageToGive.ToString(), transform); } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { Debug.Log("doing dmg"); DmgTextController.CreateFloatingText(damageToGive.ToString(), transform); // HealthManager.HurtPlayer(damageToGive); HealthManager.dodmg = true; // GetComponent<Player>().GetComponent<HealthManager>().giveDamageAtAoe(damageToGive); // GetComponent<HealthManager>().giveDamageAtAoe(damageToGive); } }
public void Damage(int dmg, string style) { GameObject dmgTextFab = Resources.Load("Prefabs/DamageText") as GameObject; GameObject text = Instantiate(dmgTextFab, new Vector3(0, 0, 0), Quaternion.identity, canvas.transform); DmgTextController textCont = text.GetComponent <DmgTextController>(); textCont.Init(this.transform.position, style, dmg.ToString()); if (dmg > 0) { hp -= dmg; if (hp <= 0) { Die(); } } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (Random.Range(1, 101) == 100) { damageToGive = Random.Range(15, 20); } else if (Random.Range(1, 105) == 101) { damageToGive = 0; } else { damageToGive = Random.Range(1, 10); } DmgTextController.CreateFloatingText(damageToGive.ToString(), transform); HealthManager.HurtPlayer(damageToGive); GetComponent <HealthManager>().giveDamageAtAoe(damageToGive); } }
void Start() { if (name == "Champ") { t = Time.time; } baseDmg = 70; if (name == "TowerShot B" || name == "TowerShot R") { } else { healthBar = transform.FindChild("EnemyCanvas").FindChild("HealthBack").FindChild("HealthBar").GetComponent <Slider>(); } clickMe = GetComponent <ClickOnMe>(); tim = GameObject.Find("Timer_Spawner"); anim = GetComponent <Animator>(); dodmg = false; playerCenter = transform.FindChild("Center"); DmgTextController.Initialize(); }
void dmg(int damageToGive) { Debug.Log("continue dmg"); enemyHealth -= damageToGive; DmgTextController.CreateFloatingText(damageToGive.ToString(), transform); }