// Update is called once per frame void Update() { HandleRepairInput(); HandleJumpInput(); if (isAI) { DoAI(); } if (startedRepairing) { sfx.StartRepairing(); currentHealEffect.SetActive(true); //currentHealEffect.transform.position = transform.position; } if (interruptRepairing) { sfx.InterruptRepairing(); currentHealEffect.SetActive(false); } if (repairValue > 0f && currentState == PlayerState.Normal) { GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject gameObjectToTest in gameObjects) { if (gameObjectToTest == gameObject) { continue; } else { if (Vector2.Distance(gameObjectToTest.transform.position, gameObject.transform.position) < healDistance) { gameObjectToTest.GetComponent <PlayerController>().ReceiveHealing(healAmount * Time.deltaTime); } } } } CheckIsGrounded(); if (currentState == PlayerState.Disabled) { DoDisabledLogic(); } if (currentState == PlayerState.Normal) { DoNormalPlayerLogic(); } UpdateTimers(); CheckIsLanded(); oldVelocity = rb.velocity; oldGrounded = isGrounded; // Repair needs to be button bashed //repairValue = 0f; //Debug.Log("Old repair " + oldRepairValue); //Debug.Log("repair value " + repairValue); oldRepairValue = repairValue; interruptRepairing = false; startedRepairing = false; // repairValue = 0; }