Изменение логики работы фонарика
This commit is contained in:
parent
b0caf99373
commit
7c9a71504c
3 changed files with 10 additions and 8 deletions
|
@ -10,5 +10,6 @@ public static class Constants
|
|||
public const float MaxFlashlightDistance = 96;
|
||||
public const float MinFlashlightDistance = 16;
|
||||
public const float MaxFlashlightEnergy = 100;
|
||||
public const float FlashlightEnergyPerCharge = 5;
|
||||
public const float FlashlightEnergyPerCharge = 40;
|
||||
public const float FlashlightDischargeModifier = 10;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public partial class Flashlight : Node
|
|||
[Export] public AudioStreamPlayer CrankSoundPlayer;
|
||||
|
||||
private float FlashlightRadius = Constants.MaxFlashlightRadius;
|
||||
private float FlashlightEnergy = Constants.MaxFlashlightEnergy;
|
||||
private float FlashlightEnergy = 0;
|
||||
private float FlashlightChargeTimeout = 1;
|
||||
|
||||
public override void _Ready()
|
||||
|
@ -86,7 +86,8 @@ public partial class Flashlight : Node
|
|||
CrankSoundPlayer.Play();
|
||||
}
|
||||
|
||||
FlashlightEnergy = Mathf.Clamp(FlashlightEnergy - (float)delta, 0, Constants.MaxFlashlightEnergy);
|
||||
FlashlightEnergy = Mathf.Clamp(FlashlightEnergy - (float)delta * Constants.FlashlightDischargeModifier,
|
||||
0, Constants.MaxFlashlightEnergy);
|
||||
FlashlightGroup.Modulate =
|
||||
new Color(BrightnessCurve.Sample(FlashlightEnergy / Constants.MaxFlashlightEnergy), 1, 1, 1);
|
||||
CollisionCircle.Disabled = CollisionPlayerCircle.Disabled = CollisionPolygon.Disabled = FlashlightEnergy < 10;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue