// Update is called once per frame void Update() { if (!isDead && enemyHealth.getHealth() <= 0) { isDead = true; nextLevel.SetActive(true); Destroy(gameObject, 3f); } }
// Update is called once per frame void Update() { float width = Mathf.Max( 0, healthToWatch.getHealth() * maxSize / healthToWatch.getMaxHealth() ); Vector2 newSize = new Vector2(width, transform.localScale.y); transform.localScale = newSize; }
// Update is called once per frame void Update() { if (playerHealth.getHealth() > 0) { return; } Destroy(gameObject); sceneLoader.loadSceneFromName("GameOver", timeBeforeGameOver); }
// Update is called once per frame void Update() { if (playerHealth.getHealth() > 0) { return; } Destroy(gameObject); Instantiate(explosion, transform.position, transform.rotation); sceneLoader.loadSceneFromName("GameOver", timeBeforeGameOver); }
// Update is called once per frame void Update() { if (enemyHealth.getHealth() > 0) { return; } gameSession.addPoints(points); Destroy(gameObject); Instantiate(explosion, transform.position, transform.rotation); bool spawnBonus = Random.Range(0, 100) < bonusProbability; if (spawnBonus) { bonusSpawner.spawn(transform.position); } }
// Update is called once per frame void Update() { if (!isDead && enemyHealth.getHealth() <= 0) { isDead = true; notify(); if (saveable != null) { saveable.save(); } DamageDealer dd = GetComponent <DamageDealer>(); if (dd == null) { dd = GetComponentInChildren <DamageDealer>(); } if (dd != null) { dd.deactivate(); } Destroy(gameObject); } }
void updateWidth() { float healthRatio = actorHealth.getHealth() / (float)actorHealth.getMaxHealth(); transform.localScale = new Vector2(healthRatio, transform.localScale.y); }