void Update() { if (justAttacked) //if the player was just attacked by the enemy, start the counter { nextAttackCounter -= Time.deltaTime; } if (nextAttackCounter <= 0f) //if the counter ends, the enemy did not just attack and the counter is reset { justAttacked = false; nextAttackCounter = storeAttackCounter; } if (characterSelector.GetCharacterActive()) //checks if the character is active { charge = characterSelector.GetCharacterObject().GetComponentInChildren <Charge>(); //retrieved from the player's weapon roll = characterSelector.GetCharacterObject().GetComponentInChildren <Roll>(); chargeInvulnerable = charge.GetInvulnerable(); rollInvulnerable = roll.GetInvulnerable(); } }