Hello, I have this custom HitStop node that is set to emulate a fighting game hitstop effect. Currently its set to slow down the TimeScale, but that's too heavy; instead I want it to just slow down/stop the enemy according to a value I set. Is this possible?

using GamingIsLove.Makinom;
using Unity.VisualScripting;
using GamingIsLove.Makinom.Schematics;
using GamingIsLove.Makinom.Schematics.Nodes;
using UnityEngine;

namespace _GAME._CUSTOM_ASSETS.ORK.Nodes
{
// The 'EditorHelp' attribute manages the name and description of the node.
[EditorHelp("HitStop Effect", "This node causes a hitstop effect for a specified duration.", "")]
// The 'NodeInfo' attribute manages in which section the node can be found in the add node selection.
[NodeInfo("Combat/Hit Effects")]
public class HitstopNode : BaseSchematicNode
{
// Declare node properties
[Tooltip("The duration of the hitstop effect in seconds.")]
public float Duration;
[Tooltip("The timescale to set after the hitstop effect ends.")]
public float TimeScale;

public HitstopNode()
{
Duration = 0.05f;
TimeScale = 1f;
}

// Execute node
public override void Execute(Schematic schematic)
{
// Pause game
Time.timeScale = 0f;

// Wait for duration
float pauseEndTime = Time.realtimeSinceStartup + Duration;
while (Time.realtimeSinceStartup < pauseEndTime)
{
schematic.Yield();
}

// Unpause game
Time.timeScale = TimeScale;

// Tell schematic what to do next
schematic.NodeFinished(this.next);
}

// Node details
public override string GetNodeDetails()
{
return "This node causes a hitstop effect for a specified duration.";
}

// Node color
public override Color EditorColor
{
get { return Color.red; }
}
}
}
  • Well, this isn't possible without having individual time scales for each game object, which also needs to be implemented in all other code moving that game object.

    Easiest way would probably be to just change the animation speed instead, making it look slower (and if e.g. schematics animating actions are based on animation duration wait times, also slow them down).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.