// Update is called once per frame void Update() { if (isRepair) { //Debug.Log ("fixing myself"); repairTime -= Time.deltaTime; //fHealth += (int)(2 * Time.deltaTime); if (repairTime <= 0.0f) { gameObject.GetComponent <SpriteRenderer>().DOColor(Color.gray, 0.5f); //Debug.Log ("Im done fixing!"); isRepair = false; isWorking = true; reCheck = false; checkResource(); ApplyEfficiency(); _healthHandler.Reset(); _healthHandler.Health = MaximumHealth; _healthHandler.MaximumHealth = MaximumHealth; repairTime = repairCap; } } if (!isWorking) { return; } if (isActivated) { if (!scanned) { if (facilityType == type.Combat || facilityType == type.Magic) { scanForTarget(); } } startFacility(); } // Always be checking for the resources }
public void reset() { //Debug.Log ("Reseting!"); heightChangeTimer = 5.0f; speed = player.GetComponent <Ship> ().ShipSpeed; heightAscent = randomOffset(2, -1); _closenessThreshold = randomOffset(2, 4); //currentHealth = 100;_healthHandler.Reset(); _healthHandler.Reset(); _healthHandler.Health = currentHealth; _spriteFeedback.SetActive(false); targeted = false; isChasing = true; _chaseTime = Random.Range(2, 4); position = gameObject.transform.position; destination = new Vector3(player.transform.position.x - _closenessThreshold, player.transform.position.y + randomOffset(-5, 5), 0); }