// Update is called once per frame public void HealingPulse(CallbackContext ctx) { if (ctx.started && timeSincePulse > pulseCooldown && supplyManager.supplies >= suppliesPerHeal * healPerStep) { pulseRing.gameObject.SetActive(true); pulseCharging = true; timeSinceChargeStart = 0; healFromCurrentCharge = 0; } if (ctx.canceled && pulseCharging == true) { supplyManager.UseSupplies(suppliesUsedByCharge); pulseCharging = false; timeSincePulse = 0; Collider2D[] healingTargets = new Collider2D[20]; int numHealingTargets = Physics2D.OverlapCircle(transform.position, pulseRadius, healableFilter, healingTargets); for (int i = 0; i < numHealingTargets; i++) { PlayerBase healedPlayerBase = healingTargets[i].gameObject.GetComponent <PlayerBase>(); if (healedPlayerBase != null) { healedPlayerBase.ChangeHealth(healFromCurrentCharge); } } mesh.Clear(); StartCoroutine(GrowPulse()); } }
// Update is called once per frame void Update() { if (ReachBase()) { if (Base.Health > 0) { update += Time.deltaTime; if (update > updateCycle) { update = 0.0f; Base.ChangeHealth(-Enemies[type].Damage); } } } else { //transform.position.z = transform.position.y * 0.01f - 2f transform.Translate(dx * Time.deltaTime, dy * Time.deltaTime, 0f); transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.y * 0.01f - 1f); getNextTarget(); } }