target tracer opaque when using item

godot-4.2 2023-09-09
HumanoidSandvichDispenser 2023-09-10 17:29:57 -07:00
parent 6a42816bdb
commit 25694724be
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
1 changed files with 15 additions and 6 deletions

View File

@ -72,15 +72,24 @@ public sealed partial class Player : Character
base._Process(delta); base._Process(delta);
float angle = DesiredTarget.Angle(); float angle = DesiredTarget.Angle();
float deltaTheta = Mathf.Abs(_targetTracer.Rotation - angle);
_targetTracer.Rotation = angle; if (Inventory.IsUsingItem)
{
_targetTracer.Intensity = 1;
}
else
{
// must turn > pi / 4 radians per second to increase intensity // must turn > pi / 4 radians per second to increase intensity
float deltaTheta = Mathf.Abs(_targetTracer.Rotation - angle);
_targetTracer.Intensity = Mathf.Min(_targetTracer.Intensity + _targetTracer.Intensity = Mathf.Min(_targetTracer.Intensity +
deltaTheta, 1); deltaTheta, 1);
_targetTracer.Intensity = Mathf.Max(_targetTracer.Intensity - _targetTracer.Intensity = Mathf.Max(_targetTracer.Intensity -
Mathf.Pi / 4 * (float)delta, 0); Mathf.Pi / 4 * (float)delta, 0);
} }
_targetTracer.Rotation = angle;
}
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)
{ {
if (StateMachine != null) if (StateMachine != null)