// Update is called once per frame void Update() { if (enemyObjectCount == 0) { destroyTimer += Time.deltaTime; if (destroyTimer > maxSpawnTime) { itemDrop.DropItems(); Destroy(gameObject); } } if (roomLocked) { ActivateSpawns(); } if (activatedSpawns) { timeSinceStart += Time.deltaTime; } GetEnemiesCount(); if (timeSinceStart > 2f) { fightText.text = enemyObjectCount.ToString() + " enemies coming"; } }
private void CheckIfDead() { if (health.IsDead) { colider.enabled = false; rb.isKinematic = true; Destroy(gameObject, 5f); rb.velocity = Vector2.zero; if (!isDying) { drop.DropItems(); isDying = true; } } }
// Update is called once per frame void Update() { if (!hasDropped) { if (isTriggered) { promptText.gameObject.SetActive(true); } else { promptText.gameObject.SetActive(false); } if (Input.GetAxis("Use") != 0) { itemDrop.DropItems(); hasDropped = true; promptText.gameObject.SetActive(false); chestAnim.SetBool("open", true); } } }