Merge branch 'master' of https://git.sjkillen.ca/sjkillen/hurrmmm into sjkillen
This commit is contained in:
commit
726de6e49b
|
@ -50,29 +50,31 @@ public partial class TASable : Node
|
||||||
public virtual void OnFrameIncremented(int newFrame)
|
public virtual void OnFrameIncremented(int newFrame)
|
||||||
{
|
{
|
||||||
this.SaveState(newFrame);
|
this.SaveState(newFrame);
|
||||||
GD.Print($"Frame advanced to {newFrame}, called from node {this.AssignedRigidBody3D.Name}");
|
// GD.Print($"Frame advanced to {newFrame}, called from node {this.AssignedRigidBody3D.Name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnFramesAdvanced(int startFrame, int endFrame)
|
public virtual void OnFramesAdvanced(int startFrame, int endFrame)
|
||||||
{
|
{
|
||||||
this.LoadState(endFrame);
|
this.LoadState(endFrame);
|
||||||
GD.Print($"Frames advanced from {startFrame} to {endFrame}, called from node {this.AssignedRigidBody3D.Name}");
|
// GD.Print($"Frames advanced from {startFrame} to {endFrame}, called from node {this.AssignedRigidBody3D.Name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnFramesRegressed(int startFrame, int endFrame)
|
public virtual void OnFramesRegressed(int startFrame, int endFrame)
|
||||||
{
|
{
|
||||||
this.LoadState(endFrame);
|
this.LoadState(endFrame);
|
||||||
GD.Print($"Frames regressed from {startFrame} to {endFrame}, called from node {this.AssignedRigidBody3D.Name}");
|
// GD.Print($"Frames regressed from {startFrame} to {endFrame}, called from node {this.AssignedRigidBody3D.Name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnStartedIncrementing()
|
public virtual void OnStartedIncrementing()
|
||||||
{
|
{
|
||||||
this.AssignedRigidBody3D.Freeze = false;
|
this.AssignedRigidBody3D.Freeze = false;
|
||||||
|
this.AssignedRigidBody3D.LockRotation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnStoppedIncrementing()
|
public virtual void OnStoppedIncrementing()
|
||||||
{
|
{
|
||||||
this.AssignedRigidBody3D.Freeze = true;
|
this.AssignedRigidBody3D.Freeze = true;
|
||||||
|
this.AssignedRigidBody3D.LockRotation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnFramesReset()
|
public virtual void OnFramesReset()
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public partial class TimescaleSystem : Node
|
||||||
|
{
|
||||||
|
[Export] public double SlowLength = 1.0;
|
||||||
|
[Export] public double SlowMagnitude = 0.2;
|
||||||
|
|
||||||
|
Node controller;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
controller = GetNode<Node>("/root/ControllerEventBus");
|
||||||
|
|
||||||
|
Callable callable = new Callable(this, MethodName.OnControllerContact);
|
||||||
|
|
||||||
|
controller.Connect("new_target", callable);
|
||||||
|
|
||||||
|
this.OnControllerContact(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OnControllerContact(Node node)
|
||||||
|
{
|
||||||
|
GD.Print("toUCHED!");
|
||||||
|
|
||||||
|
Engine.TimeScale = this.SlowMagnitude;
|
||||||
|
|
||||||
|
Timer timer = new Timer();
|
||||||
|
timer.Name = "SlowTimer";
|
||||||
|
|
||||||
|
this.AddChild(timer);
|
||||||
|
|
||||||
|
timer.WaitTime = this.SlowLength * this.SlowMagnitude;
|
||||||
|
timer.OneShot = true;
|
||||||
|
|
||||||
|
timer.Timeout += () => {
|
||||||
|
GD.Print("TimE!");
|
||||||
|
Engine.TimeScale = 1.0;
|
||||||
|
timer.QueueFree();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
timer.Start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bs3yqnctxfwaa"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Timescale_System/TimescaleSystem.cs" id="1_6tt5j"]
|
||||||
|
|
||||||
|
[node name="TimescaleSystem" type="Node"]
|
||||||
|
script = ExtResource("1_6tt5j")
|
|
@ -3,3 +3,4 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://bsge8trc5uwb0" path="res://grape.glb" id="1_jlfas"]
|
[ext_resource type="PackedScene" uid="uid://bsge8trc5uwb0" path="res://grape.glb" id="1_jlfas"]
|
||||||
|
|
||||||
[node name="grape" instance=ExtResource("1_jlfas")]
|
[node name="grape" instance=ExtResource("1_jlfas")]
|
||||||
|
continuous_cd = true
|
||||||
|
|
|
@ -20,6 +20,7 @@ config/icon="res://icon.svg"
|
||||||
ControllerEventBus="*res://controller_event_bus.gd"
|
ControllerEventBus="*res://controller_event_bus.gd"
|
||||||
TAS_System="*res://TAS_system/TAS_System.tscn"
|
TAS_System="*res://TAS_system/TAS_System.tscn"
|
||||||
MouseControl="*res://mouse_control.gd"
|
MouseControl="*res://mouse_control.gd"
|
||||||
|
TimescaleSystem="*res://Timescale_System/TimescaleSystem.tscn"
|
||||||
|
|
||||||
[dotnet]
|
[dotnet]
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.98064, 0.385236)
|
||||||
|
|
||||||
[node name="grape2" parent="." index="6" instance=ExtResource("3_kg8e8")]
|
[node name="grape2" parent="." index="6" instance=ExtResource("3_kg8e8")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.94627, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.94627, 0)
|
||||||
continuous_cd = true
|
|
||||||
|
|
||||||
[node name="TAS UI" parent="." index="7" instance=ExtResource("4_jskxr")]
|
[node name="TAS UI" parent="." index="7" instance=ExtResource("4_jskxr")]
|
||||||
|
|
Loading…
Reference in New Issue