Add more interactive effects to inventory menu

This commit is contained in:
2024-09-10 19:40:19 -07:00
parent 081bde1d9a
commit d854f159b4
21 changed files with 279 additions and 112 deletions

View File

@@ -84,7 +84,7 @@ namespace GameJamDungeon
public void Setup()
{
Settings = new PlayerLogic.Settings(RotationSpeed, MoveSpeed);
Settings = new PlayerLogic.Settings() { RotationSpeed = RotationSpeed, MoveSpeed = MoveSpeed };
PlayerLogic = new PlayerLogic();
PlayerLogic.Set(this as IPlayer);
@@ -136,8 +136,13 @@ namespace GameJamDungeon
public override void _UnhandledInput(InputEvent @event)
{
if (Input.IsActionJustPressed(GameInputs.Attack))
if (@event.IsActionPressed(GameInputs.Attack))
PlayerLogic.Input(new PlayerLogic.Input.Attack());
if (@event.IsActionPressed(GameInputs.Sprint))
Settings.MoveSpeed *= 4;
if (@event.IsActionReleased(GameInputs.Sprint))
Settings.MoveSpeed /= 4;
}
private void OnEnemyHitBoxEntered(Area3D area)

View File

@@ -7,13 +7,13 @@ namespace GameJamDungeon
public partial class PlayerStatInfo : Resource, ICharacterStats
{
[Export]
public double CurrentHP { get => _currentHP.Value; set => _currentHP.OnNext(value); }
public double CurrentHP { get => _currentHP.Value; set => _currentHP.OnNext(Mathf.Min(MaximumHP, value)); }
[Export]
public double MaximumHP { get => _maximumHP.Value; set => _maximumHP.OnNext(value); }
[Export]
public int CurrentVT { get => _currentVT.Value; set => _currentVT.OnNext(value); }
public int CurrentVT { get => _currentVT.Value; set => _currentVT.OnNext(Mathf.Min(MaximumVT, value)); }
[Export]
public int MaximumVT { get => _maximumVT.Value; set => _maximumVT.OnNext(value); }
@@ -29,13 +29,13 @@ namespace GameJamDungeon
public int EXPToNextLevel { get => _expToNextLevel.Value; set => _expToNextLevel.OnNext(value); }
[Export]
public int CurrentAttack { get => _currentAttack.Value; set => _currentAttack.OnNext(value); }
public int CurrentAttack { get => _currentAttack.Value; set => _currentAttack.OnNext(Mathf.Min(MaxAttack, value)); }
[Export]
public int MaxAttack { get => _maxAttack.Value; set => _maxAttack.OnNext(value); }
[Export]
public int CurrentDefense { get => _currentDefense.Value; set => _currentDefense.OnNext(value); }
public int CurrentDefense { get => _currentDefense.Value; set => _currentDefense.OnNext(Mathf.Min(CurrentDefense, value)); }
[Export]
public int MaxDefense { get => _maxDefense.Value; set => _maxDefense.OnNext(value); }
@@ -49,25 +49,25 @@ namespace GameJamDungeon
public double Luck { get => _luck.Value; set => _luck.OnNext(value); }
// AutoProp backing data
private readonly AutoProp<double> _currentHP = new AutoProp<double>(0);
private readonly AutoProp<double> _maximumHP = new AutoProp<double>(0);
private readonly AutoProp<double> _currentHP = new AutoProp<double>(double.MaxValue);
private readonly AutoProp<double> _maximumHP = new AutoProp<double>(double.MaxValue);
private readonly AutoProp<int> _currentVT = new AutoProp<int>(0);
private readonly AutoProp<int> _maximumVT = new AutoProp<int>(0);
private readonly AutoProp<int> _currentVT = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _maximumVT = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _currentExp = new AutoProp<int>(0);
private readonly AutoProp<int> _expToNextLevel = new AutoProp<int>(0);
private readonly AutoProp<int> _currentLevel = new AutoProp<int>(0);
private readonly AutoProp<int> _currentExp = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _expToNextLevel = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _currentLevel = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _currentAttack = new AutoProp<int>(0);
private readonly AutoProp<int> _currentDefense = new AutoProp<int>(0);
private readonly AutoProp<int> _currentAttack = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _currentDefense = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _maxAttack = new AutoProp<int>(0);
private readonly AutoProp<int> _maxDefense = new AutoProp<int>(0);
private readonly AutoProp<int> _maxAttack = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _maxDefense = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _bonusAttack = new AutoProp<int>(0);
private readonly AutoProp<int> _bonusDefense = new AutoProp<int>(0);
private readonly AutoProp<int> _bonusAttack = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<int> _bonusDefense = new AutoProp<int>(int.MaxValue);
private readonly AutoProp<double> _luck = new AutoProp<double>(0.0);
private readonly AutoProp<double> _luck = new AutoProp<double>(double.MaxValue);
}
}

View File

@@ -2,8 +2,11 @@
{
public partial class PlayerLogic
{
public record Settings(
float RotationSpeed,
float MoveSpeed);
public record Settings
{
public float MoveSpeed { get; set; }
public float RotationSpeed { get; set; }
}
}
}

View File

@@ -23,12 +23,6 @@ namespace GameJamDungeon
transform.Basis = new Basis(Vector3.Up, settings.RotationSpeed * -rawInput.X) * transform.Basis;
var velocity = player.Basis * new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z) * settings.MoveSpeed;
if (Godot.Input.IsActionPressed(GameInputs.Sprint))
velocity *= 3;
if (Godot.Input.IsActionJustPressed(GameInputs.Throw))
Output(new Output.ThrowItem());
Output(new Output.MovementComputed(transform.Basis, velocity));
return ToSelf();