In my 2d dungeon crawling game, I am implementing different “abilities” for different characters (dash, rage, slow time, freeze, invisibility, etc.). For the “Slow Time” ability, what I wanted was to slow all the enemies and their bullets in the room but have the player and their bullets be unaffected for a few seconds. What I did was just set the Time.timeScale to 0.5 but in order to keep the player from also being slowed I have to multiply the player movement speed and player bullet speed by 2. The problem I am getting though is while the ability is active, the player moves very jaggedly (as if framerates are dropping kinda look). Is there a way to slow everything in the room without having to individually assign new values to each enemy and their bullets while the bool timeSlowed is true? The timeScale functions works beautifully, except for trying to make the player still be normal speed.
Here is my slow time function:
public void SlowTime()
{
if (abilityCoolCounter <= 0 && abilityCounter <= 0)
{
abilityCounter = slowLength;
Time.timeScale = 0.5f;
activeMoveSpeed = moveSpeed * 2;
timeSlowed = true;
abilityCooldown = slowCooldown;
//anim.SetTrigger("dash");
//AudioManager.instance.PlaySFX(8);
}
}
(The player bullets and player are handled in different scripts, but I do have the player bullet speed being multiplied by 2 when timeSlowed is true)