void Update() { if (health <= 0) { this.gameObject.SetActive(false); gameOverScene.SetActive(true); } DebugLineController(); MovementController(); UpdateStats(); if (target != null) { if (Vector3.Distance(transform.position, target.transform.position) <= 10f) { if (target.tag == "Enemy" || target.tag == "Asset") { if (attackTimer < 0) { CombatController(); attackTimer = attackCooldown; } else { attackTimer -= Time.deltaTime; } } else if (target.tag == "Item") { if (inventory.Count < inventorySize) { PickUp(target); //Destroy(target); target.SetActive(false); target = null; inventoryController.UpdateInventory(); } else { GameObject GO = (GameObject)Instantiate(popUpText, new Vector3(target.transform.position.x, target.transform.position.y + 5, target.transform.position.z), Quaternion.identity); TextMesh TM = GO.GetComponentInChildren <TextMesh>(); TM.text = "Inventory too full!"; TM.color = Color.red; target = null; } } else if (target.tag == "Ladder") { mapScript.CreateDungeon(); Debug.Log("At ladder"); } } } else { attackTimer = attackCooldown; } UIController(); }