public void betterjumpWhite() { if (white.GetComponent <PlayerMoney>().currentMoney() >= 100 && white.betterjump == false) { white.GetComponent <PlayerMoney>().SubbMoney(100); white.betterjump = true; } else { Debug.Log("brak hajsu"); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "White") { white.GetComponent <PlayerMoney>().addMoney(dropValue); Destroy(gameObject); } if (collision.gameObject.name == "Black") { black.GetComponent <PlayerMoney>().addMoney(dropValue); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "White") { var health = white.GetComponent <Health>(); health.DealDamage(demage); Destroy(gameObject); } if (collision.gameObject.name == "Black") { var health = black.GetComponent <Health>(); health.DealDamage(demage); Destroy(gameObject); } if (collision.gameObject.tag == "kolce") { Destroy(gameObject); } if (collision.gameObject.tag == "KosaDestroyer") { Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { //if (health.currentHealth < health.maxHealth) //{ //} //black if (collision.gameObject.layer == 10) { Destroy(gameObject); zycie = black.GetComponent <Health>().AktualneHP(); black.GetComponent <Health>().odnowienieHP(20); } //white if (collision.gameObject.layer == 9) { Destroy(gameObject); zycie = white.GetComponent <Health>().AktualneHP(); white.GetComponent <Health>().odnowienieHP(20); } }
void Update() { currentHP = white.GetComponent <Health>().AktualneHP(); slider.value = currentHP; }
// Update is called once per frame void Update() { score = white.GetComponent <PlayerMoney>().currentMoney(); textdisplay.text = score.ToString(); // score = player.GetComponents<PlayerMoney>(). }