Demon wall implementation time

This commit is contained in:
2025-03-21 00:39:34 -07:00
parent 8df8a85429
commit f69c6b94a1
18 changed files with 397 additions and 265 deletions

View File

@@ -32,8 +32,10 @@ animation = &"ARM 1 IDLE"
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dqcrh"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dqcrh"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bpd8u"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bpd8u"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
[node name="Arm1" type="Node3D"] [node name="Arm1" type="Node3D"]
script = ExtResource("2_w0a5p") script = ExtResource("2_w0a5p")
_enemyStatResource = SubResource("Resource_yfb8x") _enemyStatResource = SubResource("Resource_yfb8x")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM1" parent="." instance=ExtResource("1_3tnuk")] [node name="ARM1" parent="." instance=ExtResource("1_3tnuk")]

View File

@@ -32,8 +32,10 @@ animation = &"ARM 2 IDLE"
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_xj37f"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_xj37f"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jlfdv"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jlfdv"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
[node name="Arm2" type="Node3D"] [node name="Arm2" type="Node3D"]
script = ExtResource("1_jkuo4") script = ExtResource("1_jkuo4")
_enemyStatResource = SubResource("Resource_ni55f") _enemyStatResource = SubResource("Resource_ni55f")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM2" parent="." instance=ExtResource("1_7rfsf")] [node name="ARM2" parent="." instance=ExtResource("1_7rfsf")]

View File

@@ -32,8 +32,10 @@ animation = &"ARM 3 IDLE"
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p21h7"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p21h7"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_1weac"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_1weac"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
[node name="Arm3" type="Node3D"] [node name="Arm3" type="Node3D"]
script = ExtResource("1_fhrhk") script = ExtResource("1_fhrhk")
_enemyStatResource = SubResource("Resource_gcbec") _enemyStatResource = SubResource("Resource_gcbec")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM3" parent="." instance=ExtResource("1_wuuwb")] [node name="ARM3" parent="." instance=ExtResource("1_wuuwb")]

View File

@@ -29,6 +29,7 @@ animation = &"ARM 4 SHOCK"
animation = &"ARM 4 IDLE_001" animation = &"ARM 4 IDLE_001"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_s0ts5"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_s0ts5"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -36,6 +37,7 @@ advance_mode = 2
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ggmev"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ggmev"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_nwywg"] [sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_nwywg"]
states/attack/node = SubResource("AnimationNodeAnimation_jlfdv") states/attack/node = SubResource("AnimationNodeAnimation_jlfdv")
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
[node name="Arm4" type="Node3D"] [node name="Arm4" type="Node3D"]
script = ExtResource("1_nwywg") script = ExtResource("1_nwywg")
_enemyStatResource = SubResource("Resource_0pjjv") _enemyStatResource = SubResource("Resource_0pjjv")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM4" parent="." instance=ExtResource("1_dr5tf")] [node name="ARM4" parent="." instance=ExtResource("1_dr5tf")]

View File

@@ -32,8 +32,10 @@ animation = &"ARM 5 IDLE"
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_cpus0"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_cpus0"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l47f2"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l47f2"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
[node name="Arm5" type="Node3D"] [node name="Arm5" type="Node3D"]
script = ExtResource("1_j3ruw") script = ExtResource("1_j3ruw")
_enemyStatResource = SubResource("Resource_bqpdp") _enemyStatResource = SubResource("Resource_bqpdp")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM5" parent="." instance=ExtResource("1_3y571")] [node name="ARM5" parent="." instance=ExtResource("1_3y571")]

View File

@@ -29,6 +29,7 @@ animation = &"ARM 6 SLASH"
animation = &"ARM 6 IDLE" animation = &"ARM 6 IDLE"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bt0kd"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bt0kd"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -36,6 +37,7 @@ advance_mode = 2
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_stghn"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_stghn"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_xefo1"] [sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_xefo1"]
states/attack/node = SubResource("AnimationNodeAnimation_s0ts5") states/attack/node = SubResource("AnimationNodeAnimation_s0ts5")
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
[node name="Arm6" type="Node3D"] [node name="Arm6" type="Node3D"]
script = ExtResource("1_xefo1") script = ExtResource("1_xefo1")
_enemyStatResource = SubResource("Resource_7mykh") _enemyStatResource = SubResource("Resource_7mykh")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM6" parent="." instance=ExtResource("1_txo11")] [node name="ARM6" parent="." instance=ExtResource("1_txo11")]

View File

@@ -29,11 +29,13 @@ animation = &"7_ AGNI CONE"
animation = &"ARM 7 IDLE" animation = &"ARM 7 IDLE"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_728ue"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_728ue"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0admf"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0admf"]
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mknr5"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mknr5"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -47,6 +49,8 @@ transitions = ["idle", "attack", SubResource("AnimationNodeStateMachineTransitio
[node name="Arm7" type="Node3D"] [node name="Arm7" type="Node3D"]
script = ExtResource("1_enq7k") script = ExtResource("1_enq7k")
_enemyStatResource = SubResource("Resource_2r6oy") _enemyStatResource = SubResource("Resource_2r6oy")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM7" parent="." instance=ExtResource("1_kip2x")] [node name="ARM7" parent="." instance=ExtResource("1_kip2x")]

View File

@@ -29,6 +29,7 @@ animation = &"ARM 8 MELEE"
animation = &"ARM 8 IDLE" animation = &"ARM 8 IDLE"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0kspt"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0kspt"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -36,6 +37,7 @@ advance_mode = 2
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_e3l4l"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_e3l4l"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_5tnjc"] [sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_5tnjc"]
states/attack/node = SubResource("AnimationNodeAnimation_cpus0") states/attack/node = SubResource("AnimationNodeAnimation_cpus0")
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
[node name="Arm8" type="Node3D"] [node name="Arm8" type="Node3D"]
script = ExtResource("1_5tnjc") script = ExtResource("1_5tnjc")
_enemyStatResource = SubResource("Resource_p8nrl") _enemyStatResource = SubResource("Resource_p8nrl")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM8" parent="." instance=ExtResource("1_7eb4v")] [node name="ARM8" parent="." instance=ExtResource("1_7eb4v")]

View File

@@ -32,8 +32,10 @@ animation = &"ARM 9 IDLE"
advance_mode = 2 advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ryvbb"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ryvbb"]
xfade_time = 0.25
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_u8us3"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_u8us3"]
xfade_time = 0.25
switch_mode = 2 switch_mode = 2
advance_mode = 2 advance_mode = 2
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
[node name="Arm9" type="Node3D"] [node name="Arm9" type="Node3D"]
script = ExtResource("1_fjfqv") script = ExtResource("1_fjfqv")
_enemyStatResource = SubResource("Resource_4tcsg") _enemyStatResource = SubResource("Resource_4tcsg")
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
[node name="ARM9" parent="." instance=ExtResource("1_vc4af")] [node name="ARM9" parent="." instance=ExtResource("1_vc4af")]

View File

@@ -7,7 +7,7 @@ using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma; namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode))] [Meta(typeof(IAutoNode))]
public partial class DemonWall : Node3D public partial class DemonWall : CharacterBody3D
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
@@ -15,6 +15,8 @@ public partial class DemonWall : Node3D
[Export] protected EnemyStatResource _enemyStatResource { get; set; } = default!; [Export] protected EnemyStatResource _enemyStatResource { get; set; } = default!;
[Node] private DemonWallArm _arm3 { get; set; } = default!;
[Node] public Node3D LeftArms { get; set; } = default!; [Node] public Node3D LeftArms { get; set; } = default!;
[Node] public Node3D RightArms { get; set; } = default!; [Node] public Node3D RightArms { get; set; } = default!;
@@ -23,10 +25,11 @@ public partial class DemonWall : Node3D
[Node] private Node3D _rotation { get; set; } = default!; [Node] private Node3D _rotation { get; set; } = default!;
public void OnReady() [Node] private AnimatableBody3D _opposingWall { get; set; } = default!;
{
SetPhysicsProcess(true); [Export] private double _maximumWallMoveAmount = 24;
}
private Timer _attackTimer;
public void OnPhysicsProcess(double delta) public void OnPhysicsProcess(double delta)
{ {
@@ -41,6 +44,37 @@ public partial class DemonWall : Node3D
tweener.TweenMethod(Callable.From((float x) => RotateTowardsPlayer(x)), Eye.Rotation.Y, rotationAngle, 1f); tweener.TweenMethod(Callable.From((float x) => RotateTowardsPlayer(x)), Eye.Rotation.Y, rotationAngle, 1f);
} }
public void Activate()
{
_opposingWall.Show();
var collisionShape = _opposingWall.GetChildren().OfType<CollisionShape3D>().Single();
collisionShape.SetDeferred(CollisionShape3D.PropertyName.Disabled, false);
_attackTimer = new Timer { WaitTime = 5f };
_attackTimer.Timeout += AttackTimer_Timeout;
AddChild(_attackTimer);
SetPhysicsProcess(true);
_attackTimer.Start();
}
private void AttackTimer_Timeout()
{
var rng = new RandomNumberGenerator();
rng.Randomize();
var leftArms = new Godot.Collections.Array<DemonWallArm>(LeftArms.GetChildren().Cast<DemonWallArm>());
var rightArms = new Godot.Collections.Array<DemonWallArm>(RightArms.GetChildren().Cast<DemonWallArm>());
var leftArm = leftArms.PickRandom();
var rightArm = rightArms.PickRandom();
leftArm.PrimaryAttack();
rightArm.PrimaryAttack();
if (leftArm == _arm3 && _opposingWall.Position.Z > -_maximumWallMoveAmount)
MoveWall();
}
private float GetRotationAngle() private float GetRotationAngle()
{ {
var target = new Vector3(_player.CurrentPosition.X, Position.Y, _player.CurrentPosition.Z); var target = new Vector3(_player.CurrentPosition.X, Position.Y, _player.CurrentPosition.Z);
@@ -49,5 +83,21 @@ public partial class DemonWall : Node3D
return _rotation.Rotation.Y; return _rotation.Rotation.Y;
} }
private void MoveWall()
{
var tweener = GetTree().CreateTween();
tweener.TweenMethod(Callable.From((float x) => MoveWallTowardsPlayer(x)), _opposingWall.Position.Z, _opposingWall.Position.Z - 2, 3f);
}
private void RotateTowardsPlayer(float angle) => Eye.Rotation = new Vector3(Eye.Rotation.X, angle, Eye.Rotation.Z); private void RotateTowardsPlayer(float angle) => Eye.Rotation = new Vector3(Eye.Rotation.X, angle, Eye.Rotation.Z);
private void MoveWallTowardsPlayer(float moveAmount)
{
_opposingWall.Position = new Vector3(_opposingWall.Position.X, _opposingWall.Position.Y, moveAmount);
}
public void OnExitTree()
{
_attackTimer.Timeout -= AttackTimer_Timeout;
}
} }

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=27 format=4 uid="uid://6kck5vborfyk"] [gd_scene load_steps=29 format=4 uid="uid://6kck5vborfyk"]
[ext_resource type="Script" uid="uid://dlvk70cr20nva" path="res://src/enemy/enemy_types/16. demon wall/DemonWall.cs" id="1_dqcrh"] [ext_resource type="Script" uid="uid://dlvk70cr20nva" path="res://src/enemy/enemy_types/16. demon wall/DemonWall.cs" id="1_dqcrh"]
[ext_resource type="Script" uid="uid://dnkmr0eq1sij0" path="res://src/enemy/EnemyStatResource.cs" id="2_bpd8u"] [ext_resource type="Script" uid="uid://dnkmr0eq1sij0" path="res://src/enemy/EnemyStatResource.cs" id="2_bpd8u"]
@@ -163,7 +163,13 @@ _surfaces = [{
blend_shape_mode = 0 blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_yunh4") shadow_mesh = SubResource("ArrayMesh_yunh4")
[node name="Demon Wall" type="Node3D"] [sub_resource type="BoxShape3D" id="BoxShape3D_5ht6q"]
size = Vector3(28.312, 10.3551, 2.86102)
[sub_resource type="BoxShape3D" id="BoxShape3D_l48m2"]
size = Vector3(28.2825, 12.6552, 4.15076)
[node name="Demon Wall" type="CharacterBody3D"]
script = ExtResource("1_dqcrh") script = ExtResource("1_dqcrh")
_enemyStatResource = SubResource("Resource_ccv8a") _enemyStatResource = SubResource("Resource_ccv8a")
@@ -179,6 +185,7 @@ unique_name_in_owner = true
[node name="Arm2" parent="LeftArms" instance=ExtResource("4_qignv")] [node name="Arm2" parent="LeftArms" instance=ExtResource("4_qignv")]
[node name="Arm3" parent="LeftArms" instance=ExtResource("5_kosjo")] [node name="Arm3" parent="LeftArms" instance=ExtResource("5_kosjo")]
unique_name_in_owner = true
[node name="Arm4" parent="LeftArms" instance=ExtResource("6_dqcrh")] [node name="Arm4" parent="LeftArms" instance=ExtResource("6_dqcrh")]
@@ -215,5 +222,20 @@ transform = Transform3D(1.53728, 0.0209947, 0.0380914, 0.00298547, 1.29824, -0.8
mesh = SubResource("ArrayMesh_l6g6j") mesh = SubResource("ArrayMesh_l6g6j")
skeleton = NodePath("") skeleton = NodePath("")
[node name="demon_wall_summoned_wall" parent="." instance=ExtResource("16_5ht6q")] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.40518, 8.3319, 1.76666)
shape = SubResource("BoxShape3D_5ht6q")
[node name="OpposingWall" type="AnimatableBody3D" parent="."]
unique_name_in_owner = true
visible = false
collision_layer = 2
collision_mask = 2
[node name="Summoned Wall Model" parent="OpposingWall" instance=ExtResource("16_5ht6q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.3, 4.3, 42) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.3, 4.3, 42)
[node name="CollisionShape3D" type="CollisionShape3D" parent="OpposingWall"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.296021, 10.2941, 42.0277)
shape = SubResource("BoxShape3D_l48m2")
disabled = true

View File

@@ -6,17 +6,23 @@ using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma; namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode))] [Meta(typeof(IAutoNode))]
public partial class DemonWallArm : Node3D, IHasPrimaryAttack public partial class DemonWallArm : Node3D
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
[Signal]
public delegate void MoveWallEventHandler();
private const string PARAMETERS_PLAYBACK = "parameters/playback";
private const string ATTACK = "attack";
[Node] public AnimationTree AnimationTree { get; set; } = default!; [Node] public AnimationTree AnimationTree { get; set; } = default!;
[Export] protected EnemyStatResource _enemyStatResource { get; set; } = default!; [Export] protected EnemyStatResource _enemyStatResource { get; set; } = default!;
public ElementType PrimaryAttackElementalType { set => throw new System.NotImplementedException(); } [Export] public ElementType PrimaryAttackElementalType { get; set; } = ElementType.None;
public double PrimaryAttackElementalDamageBonus { set => throw new System.NotImplementedException(); } [Export] public double PrimaryAttackElementalDamageBonus { get; set; } = 1.0f;
public void PrimaryAttack() => throw new System.NotImplementedException(); public void PrimaryAttack() => AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ATTACK);
} }

View File

@@ -39,9 +39,6 @@ public partial class Game : Node3D, IGame
public GameLogic.IBinding GameBinding { get; set; } = default!; public GameLogic.IBinding GameBinding { get; set; } = default!;
[Signal]
public delegate void StatRaisedAlertEventHandler(string statRaisedAlert);
[Dependency] public IAppRepo AppRepo => this.DependOn<IAppRepo>(); [Dependency] public IAppRepo AppRepo => this.DependOn<IAppRepo>();
#region Nodes #region Nodes
@@ -79,201 +76,201 @@ public partial class Game : Node3D, IGame
public void Setup() public void Setup()
{ {
_container = new SimpleInjector.Container(); _container = new SimpleInjector.Container();
Module.Bootstrap(_container); Module.Bootstrap(_container);
_container.Verify(); _container.Verify();
GameRepo = _container.GetInstance<IGameRepo>(); GameRepo = _container.GetInstance<IGameRepo>();
GameLogic = _container.GetInstance<IGameLogic>(); GameLogic = _container.GetInstance<IGameLogic>();
GameEventDepot = new GameEventDepot(); GameEventDepot = new GameEventDepot();
GameLogic.Set(GameRepo); GameLogic.Set(GameRepo);
GameLogic.Set(AppRepo); GameLogic.Set(AppRepo);
GameLogic.Set(GameEventDepot); GameLogic.Set(GameEventDepot);
GameLogic.Set(Player); GameLogic.Set(Player);
GameLogic.Set(Map); GameLogic.Set(Map);
GameLogic.Set(InGameUI); GameLogic.Set(InGameUI);
Instantiator = new Instantiator(GetTree()); Instantiator = new Instantiator(GetTree());
RescuedItems = new RescuedItemDatabase(); RescuedItems = new RescuedItemDatabase();
GameChunk = new SaveChunk<GameData>( GameChunk = new SaveChunk<GameData>(
(chunk) => (chunk) =>
{ {
var gameData = new GameData() var gameData = new GameData()
{ {
PlayerData = new PlayerData() PlayerData = new PlayerData()
{ {
PlayerStats = new PlayerStats() PlayerStats = new PlayerStats()
{ {
CurrentHP = Player.Stats.CurrentHP.Value, CurrentHP = Player.Stats.CurrentHP.Value,
MaximumHP = Player.Stats.MaximumHP.Value, MaximumHP = Player.Stats.MaximumHP.Value,
CurrentVT = Player.Stats.CurrentVT.Value, CurrentVT = Player.Stats.CurrentVT.Value,
MaximumVT = Player.Stats.MaximumVT.Value, MaximumVT = Player.Stats.MaximumVT.Value,
CurrentAttack = Player.Stats.CurrentAttack.Value, CurrentAttack = Player.Stats.CurrentAttack.Value,
BonusAttack = Player.Stats.BonusAttack.Value, BonusAttack = Player.Stats.BonusAttack.Value,
MaxAttack = Player.Stats.MaxAttack.Value, MaxAttack = Player.Stats.MaxAttack.Value,
CurrentDefense = Player.Stats.CurrentDefense.Value, CurrentDefense = Player.Stats.CurrentDefense.Value,
BonusDefense = Player.Stats.BonusDefense.Value, BonusDefense = Player.Stats.BonusDefense.Value,
MaxDefense = Player.Stats.MaxDefense.Value, MaxDefense = Player.Stats.MaxDefense.Value,
CurrentExp = Player.Stats.CurrentExp.Value, CurrentExp = Player.Stats.CurrentExp.Value,
CurrentLevel = Player.Stats.CurrentLevel.Value, CurrentLevel = Player.Stats.CurrentLevel.Value,
ExpToNextLevel = Player.Stats.ExpToNextLevel.Value, ExpToNextLevel = Player.Stats.ExpToNextLevel.Value,
Luck = Player.Stats.Luck.Value Luck = Player.Stats.Luck.Value
}, },
Inventory = Player.Inventory Inventory = Player.Inventory
}, },
MapData = new MapData() MapData = new MapData()
{ {
FloorScenes = Map.FloorScenes FloorScenes = Map.FloorScenes
}, },
RescuedItems = new RescuedItemDatabase() { Items = RescuedItems.Items } RescuedItems = new RescuedItemDatabase() { Items = RescuedItems.Items }
}; };
return gameData; return gameData;
}, },
onLoad: (chunk, data) => onLoad: (chunk, data) =>
{ {
RescuedItems = data.RescuedItems; RescuedItems = data.RescuedItems;
chunk.LoadChunkSaveData(data.PlayerData); chunk.LoadChunkSaveData(data.PlayerData);
chunk.LoadChunkSaveData(data.MapData); chunk.LoadChunkSaveData(data.MapData);
} }
); );
} }
public void OnResolved() public void OnResolved()
{ {
var saveFileManager = _container.GetInstance<IMaSaveFileManager<GameData>>(); var saveFileManager = _container.GetInstance<IMaSaveFileManager<GameData>>();
SaveFile = new SaveFile<GameData>( SaveFile = new SaveFile<GameData>(
root: GameChunk, root: GameChunk,
onSave: saveFileManager.Save, onSave: saveFileManager.Save,
onLoad: async () => onLoad: async () =>
{ {
try try
{ {
var gameData = await saveFileManager.Load(); var gameData = await saveFileManager.Load();
return gameData; return gameData;
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
GD.Print("No save file found."); GD.Print("No save file found.");
} }
return null; return null;
} }
); );
GameBinding = GameLogic.Bind(); GameBinding = GameLogic.Bind();
GameBinding GameBinding
.Handle((in GameLogic.Output.StartGame _) => .Handle((in GameLogic.Output.StartGame _) =>
{ {
GameRepo.Resume(); GameRepo.Resume();
InGameUI.Show(); InGameUI.Show();
}) })
.Handle((in GameLogic.Output.GoToOverworld _) => .Handle((in GameLogic.Output.GoToOverworld _) =>
{ {
GameEventDepot.OnOverworldEntered(); GameEventDepot.OnOverworldEntered();
}) })
.Handle((in GameLogic.Output.SetPauseMode output) => CallDeferred(nameof(SetPauseMode), output.IsPaused)) .Handle((in GameLogic.Output.SetPauseMode output) => CallDeferred(nameof(SetPauseMode), output.IsPaused))
.Handle((in GameLogic.Output.ShowPauseMenu _) => .Handle((in GameLogic.Output.ShowPauseMenu _) =>
{ {
PauseMenu.Show(); PauseMenu.Show();
PauseMenu.FadeIn(); PauseMenu.FadeIn();
Input.MouseMode = Input.MouseModeEnum.Visible; Input.MouseMode = Input.MouseModeEnum.Visible;
PauseMenu.SetProcessUnhandledInput(true); PauseMenu.SetProcessUnhandledInput(true);
}) })
.Handle((in GameLogic.Output.HidePauseMenu _) => { PauseMenu.Hide(); }) .Handle((in GameLogic.Output.HidePauseMenu _) => { PauseMenu.Hide(); })
.Handle((in GameLogic.Output.ExitPauseMenu _) => { PauseMenu.FadeOut(); Input.MouseMode = Input.MouseModeEnum.Visible; PauseMenu.SetProcessUnhandledInput(false); }) .Handle((in GameLogic.Output.ExitPauseMenu _) => { PauseMenu.FadeOut(); Input.MouseMode = Input.MouseModeEnum.Visible; PauseMenu.SetProcessUnhandledInput(false); })
.Handle((in GameLogic.Output.LoadNextFloor _) => { Map.SpawnNextFloor(); }) .Handle((in GameLogic.Output.LoadNextFloor _) => { Map.SpawnNextFloor(); })
.Handle((in GameLogic.Output.LoadMap _) => { Map.LoadMap(); }) .Handle((in GameLogic.Output.LoadMap _) => { Map.LoadMap(); })
.Handle((in GameLogic.Output.ShowFloorClearMenu _) => { FloorClearMenu.Show(); FloorClearMenu.FadeIn(); }) .Handle((in GameLogic.Output.ShowFloorClearMenu _) => { FloorClearMenu.Show(); FloorClearMenu.FadeIn(); })
.Handle((in GameLogic.Output.ExitFloorClearMenu _) => { FloorClearMenu.FadeOut(); }) .Handle((in GameLogic.Output.ExitFloorClearMenu _) => { FloorClearMenu.FadeOut(); })
.Handle((in GameLogic.Output.ShowAskForTeleport _) => { GameRepo.Pause(); InGameUI.UseTeleportPrompt.FadeIn(); InGameUI.SetProcessInput(true); }) .Handle((in GameLogic.Output.ShowAskForTeleport _) => { GameRepo.Pause(); InGameUI.UseTeleportPrompt.FadeIn(); InGameUI.SetProcessInput(true); })
.Handle((in GameLogic.Output.HideAskForTeleport _) => { GameRepo.Resume(); InGameUI.UseTeleportPrompt.FadeOut(); InGameUI.SetProcessInput(false); }) .Handle((in GameLogic.Output.HideAskForTeleport _) => { GameRepo.Resume(); InGameUI.UseTeleportPrompt.FadeOut(); InGameUI.SetProcessInput(false); })
.Handle((in GameLogic.Output.ShowLostScreen _) => { DeathMenu.Show(); DeathMenu.FadeIn(); }) .Handle((in GameLogic.Output.ShowLostScreen _) => { DeathMenu.Show(); DeathMenu.FadeIn(); })
.Handle((in GameLogic.Output.ExitLostScreen _) => { DeathMenu.FadeOut(); }) .Handle((in GameLogic.Output.ExitLostScreen _) => { DeathMenu.FadeOut(); })
.Handle((in GameLogic.Output.DoubleExpTimeStart output) => { DoubleEXPTimer.WaitTime = output.lengthOfTimeInSeconds; DoubleEXPTimer.Start(); }) .Handle((in GameLogic.Output.DoubleExpTimeStart output) => { DoubleEXPTimer.WaitTime = output.lengthOfTimeInSeconds; DoubleEXPTimer.Start(); })
.Handle((in GameLogic.Output.SaveGame _) => .Handle((in GameLogic.Output.SaveGame _) =>
{ {
SaveFile.Save(); SaveFile.Save();
AppRepo.OnExitGame(); AppRepo.OnExitGame();
GetTree().Quit(); GetTree().Quit();
// Back to title screen // Back to title screen
}); });
GameLogic.Start(); GameLogic.Start();
GameLogic.Input(new GameLogic.Input.Initialize()); GameLogic.Input(new GameLogic.Input.Initialize());
this.Provide(); this.Provide();
PauseMenu.TransitionCompleted += OnPauseMenuTransitioned; PauseMenu.TransitionCompleted += OnPauseMenuTransitioned;
PauseMenu.UnpauseButtonPressed += PauseMenu_UnpauseButtonPressed; PauseMenu.UnpauseButtonPressed += PauseMenu_UnpauseButtonPressed;
InGameUI.UseTeleportPrompt.TeleportToNextFloor += UseTeleportPrompt_TeleportToNextFloor; InGameUI.UseTeleportPrompt.TeleportToNextFloor += UseTeleportPrompt_TeleportToNextFloor;
InGameUI.UseTeleportPrompt.CloseTeleportPrompt += UseTeleportPrompt_CloseTeleportPrompt; InGameUI.UseTeleportPrompt.CloseTeleportPrompt += UseTeleportPrompt_CloseTeleportPrompt;
FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor; FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor;
FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit; FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit;
FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted; FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted;
GameEventDepot.RestorativePickedUp += GameEventDepot_RestorativePickedUp; GameEventDepot.RestorativePickedUp += GameEventDepot_RestorativePickedUp;
DoubleEXPTimer.Timeout += DoubleEXPTimer_Timeout; DoubleEXPTimer.Timeout += DoubleEXPTimer_Timeout;
_effectService = new EffectService(this, Player, Map); _effectService = new EffectService(this, Player, Map);
} }
public void LoadExistingGame() => SaveFile.Load().ContinueWith((_) => CallDeferred(nameof(FinishedLoadingSaveFile))); public void LoadExistingGame() => SaveFile.Load().ContinueWith((_) => CallDeferred(nameof(FinishedLoadingSaveFile)));
public void TogglePause() public void TogglePause()
{ {
if (GameLogic.Value is GameLogic.State.Paused) if (GameLogic.Value is GameLogic.State.Paused)
GameLogic.Input(new GameLogic.Input.UnpauseGame()); GameLogic.Input(new GameLogic.Input.UnpauseGame());
else else
GameLogic.Input(new GameLogic.Input.PauseGame()); GameLogic.Input(new GameLogic.Input.PauseGame());
} }
public void FloorExitReached() public void FloorExitReached()
{ {
GameLogic.Input(new GameLogic.Input.AskForTeleport()); GameLogic.Input(new GameLogic.Input.AskForTeleport());
GameEventDepot.OnTeleportEntered(); GameEventDepot.OnTeleportEntered();
} }
public async Task UseItem(InventoryItem item) public async Task UseItem(InventoryItem item)
{ {
switch (item) switch (item)
{ {
case ConsumableItem consumableItem: case ConsumableItem consumableItem:
EnactConsumableItemEffects(consumableItem); EnactConsumableItemEffects(consumableItem);
break; break;
case EffectItem effectItem: case EffectItem effectItem:
EnactEffectItemEffects(effectItem); EnactEffectItemEffects(effectItem);
break; break;
case ThrowableItem throwableItem: case ThrowableItem throwableItem:
EnactThrowableItemEffects(throwableItem); EnactThrowableItemEffects(throwableItem);
break; break;
} }
await ToSignal(GetTree().CreateTimer(0.3f), "timeout"); await ToSignal(GetTree().CreateTimer(0.3f), "timeout");
RemoveItemOrSubtractFromItemCount(item); RemoveItemOrSubtractFromItemCount(item);
} }
public void DropItem(InventoryItem item) public void DropItem(InventoryItem item)
{ {
var droppedScene = GD.Load<PackedScene>("res://src/items/dropped/DroppedItem.tscn"); var droppedScene = GD.Load<PackedScene>("res://src/items/dropped/DroppedItem.tscn");
var dropped = droppedScene.Instantiate<DroppedItem>(); var dropped = droppedScene.Instantiate<DroppedItem>();
dropped.Item = item; dropped.Item = item;
AddChild(dropped); AddChild(dropped);
dropped.Drop(); dropped.Drop();
} }
public void ThrowItem(InventoryItem item) public void ThrowItem(InventoryItem item)
{ {
var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn"); var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
var thrown = thrownScene.Instantiate<ThrownItem>(); var thrown = thrownScene.Instantiate<ThrownItem>();
thrown.ItemThatIsThrown = (InventoryItem)item; thrown.ItemThatIsThrown = (InventoryItem)item;
AddChild(thrown); AddChild(thrown);
thrown.Position += new Vector3(0, 1.5f, 0); thrown.Position += new Vector3(0, 1.5f, 0);
thrown.Throw(_effectService); thrown.Throw(_effectService);
} }
public IDungeonFloor CurrentFloor => Map.CurrentFloor; public IDungeonFloor CurrentFloor => Map.CurrentFloor;
@@ -282,18 +279,18 @@ public partial class Game : Node3D, IGame
private void DropRestorative(Vector3 vector) private void DropRestorative(Vector3 vector)
{ {
var restorativeScene = GD.Load<PackedScene>("res://src/items/restorative/Restorative.tscn"); var restorativeScene = GD.Load<PackedScene>("res://src/items/restorative/Restorative.tscn");
var restorative = restorativeScene.Instantiate<Restorative>(); var restorative = restorativeScene.Instantiate<Restorative>();
AddChild(restorative); AddChild(restorative);
restorative.GlobalPosition = vector; restorative.GlobalPosition = vector;
} }
private void UseTeleportPrompt_CloseTeleportPrompt() => GameLogic.Input(new GameLogic.Input.HideAskForTeleport()); private void UseTeleportPrompt_CloseTeleportPrompt() => GameLogic.Input(new GameLogic.Input.HideAskForTeleport());
private void UseTeleportPrompt_TeleportToNextFloor() private void UseTeleportPrompt_TeleportToNextFloor()
{ {
GameLogic.Input(new GameLogic.Input.FloorExitReached()); GameLogic.Input(new GameLogic.Input.FloorExitReached());
GameEventDepot.OnDungeonAThemeAreaEntered(); GameEventDepot.OnDungeonAThemeAreaEntered();
} }
private void PauseMenu_UnpauseButtonPressed() => GameLogic.Input(new GameLogic.Input.UnpauseGame()); private void PauseMenu_UnpauseButtonPressed() => GameLogic.Input(new GameLogic.Input.UnpauseGame());
@@ -302,13 +299,13 @@ public partial class Game : Node3D, IGame
private void FloorClearMenu_TransitionCompleted() private void FloorClearMenu_TransitionCompleted()
{ {
GameRepo.Resume(); GameRepo.Resume();
if (Player.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnChange) if (Player.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnChange)
Player.Unequip(Player.EquippedWeapon.Value); Player.Unequip(Player.EquippedWeapon.Value);
if (Player.EquippedArmor.Value.ItemTag == ItemTag.BreaksOnChange) if (Player.EquippedArmor.Value.ItemTag == ItemTag.BreaksOnChange)
Player.Unequip(Player.EquippedArmor.Value); Player.Unequip(Player.EquippedArmor.Value);
if (Player.EquippedAccessory.Value.ItemTag == ItemTag.BreaksOnChange) if (Player.EquippedAccessory.Value.ItemTag == ItemTag.BreaksOnChange)
Player.Unequip(Player.EquippedAccessory.Value); Player.Unequip(Player.EquippedAccessory.Value);
} }
private void FloorClearMenu_GoToNextFloor() => GameLogic.Input(new GameLogic.Input.GoToNextFloor()); private void FloorClearMenu_GoToNextFloor() => GameLogic.Input(new GameLogic.Input.GoToNextFloor());
@@ -319,8 +316,8 @@ public partial class Game : Node3D, IGame
private void SetPauseMode(bool isPaused) private void SetPauseMode(bool isPaused)
{ {
if (GetTree() != null) if (GetTree() != null)
GetTree().Paused = isPaused; GetTree().Paused = isPaused;
} }
private void DoubleEXPTimer_Timeout() => GameRepo.EndDoubleExp(); private void DoubleEXPTimer_Timeout() => GameRepo.EndDoubleExp();
@@ -335,88 +332,88 @@ public partial class Game : Node3D, IGame
private void EnactConsumableItemEffects(ConsumableItem consumableItem) private void EnactConsumableItemEffects(ConsumableItem consumableItem)
{ {
if (Player.Stats.CurrentHP == Player.Stats.MaximumHP && consumableItem.RaiseHPAmount > 0) if (Player.Stats.CurrentHP == Player.Stats.MaximumHP && consumableItem.RaiseHPAmount > 0)
Player.RaiseHP(consumableItem.RaiseHPAmount); Player.RaiseHP(consumableItem.RaiseHPAmount);
if (Player.Stats.CurrentVT == Player.Stats.MaximumVT && consumableItem.RaiseVTAmount > 0) if (Player.Stats.CurrentVT == Player.Stats.MaximumVT && consumableItem.RaiseVTAmount > 0)
Player.RaiseVT(consumableItem.RaiseVTAmount); Player.RaiseVT(consumableItem.RaiseVTAmount);
if (consumableItem.HealHPAmount > 0 && Player.Stats.CurrentHP != Player.Stats.MaximumHP) if (consumableItem.HealHPAmount > 0 && Player.Stats.CurrentHP != Player.Stats.MaximumHP)
Player.HealHP(consumableItem.HealHPAmount); Player.HealHP(consumableItem.HealHPAmount);
if (consumableItem.HealVTAmount > 0 && Player.Stats.CurrentVT != Player.Stats.MaximumVT) if (consumableItem.HealVTAmount > 0 && Player.Stats.CurrentVT != Player.Stats.MaximumVT)
Player.HealVT(consumableItem.HealVTAmount); Player.HealVT(consumableItem.HealVTAmount);
} }
private void EnactEffectItemEffects(EffectItem effectItem) private void EnactEffectItemEffects(EffectItem effectItem)
{ {
switch (effectItem.UsableItemTag) switch (effectItem.UsableItemTag)
{ {
case UsableItemTag.TeleportAllEnemiesToRoom: case UsableItemTag.TeleportAllEnemiesToRoom:
_effectService.TeleportEnemiesToCurrentRoom(); _effectService.TeleportEnemiesToCurrentRoom();
break; break;
case UsableItemTag.KillHalfEnemiesInRoom: case UsableItemTag.KillHalfEnemiesInRoom:
_effectService.KillHalfEnemiesInRoom(); _effectService.KillHalfEnemiesInRoom();
break; break;
case UsableItemTag.TurnAllEnemiesIntoHealingItem: case UsableItemTag.TurnAllEnemiesIntoHealingItem:
_effectService.TurnAllEnemiesInRoomIntoHealingItem(); _effectService.TurnAllEnemiesInRoomIntoHealingItem();
break; break;
case UsableItemTag.HealsAllInRoomToMaxHP: case UsableItemTag.HealsAllInRoomToMaxHP:
_effectService.HealAllEnemiesAndPlayerInRoomToFull(); _effectService.HealAllEnemiesAndPlayerInRoomToFull();
break; break;
case UsableItemTag.AbsorbHPFromAllEnemiesInRoom: case UsableItemTag.AbsorbHPFromAllEnemiesInRoom:
_effectService.AbsorbHPFromAllEnemiesInRoom(); _effectService.AbsorbHPFromAllEnemiesInRoom();
break; break;
case UsableItemTag.DealElementalDamageToAllEnemiesInRoom: case UsableItemTag.DealElementalDamageToAllEnemiesInRoom:
_effectService.DealElementalDamageToAllEnemiesInRoom(ElementType.Hydric); _effectService.DealElementalDamageToAllEnemiesInRoom(ElementType.Hydric);
break; break;
case UsableItemTag.SwapHPAndVT: case UsableItemTag.SwapHPAndVT:
_effectService.SwapHPandVT(); _effectService.SwapHPandVT();
break; break;
case UsableItemTag.RaiseCurrentWeaponAttack: case UsableItemTag.RaiseCurrentWeaponAttack:
_effectService.RaiseCurrentWeaponAttack(); _effectService.RaiseCurrentWeaponAttack();
break; break;
case UsableItemTag.RaiseCurrentDefenseArmor: case UsableItemTag.RaiseCurrentDefenseArmor:
_effectService.RaiseCurrentArmorDefense(); _effectService.RaiseCurrentArmorDefense();
break; break;
case UsableItemTag.RaiseLevel: case UsableItemTag.RaiseLevel:
_effectService.RaiseLevel(); _effectService.RaiseLevel();
break; break;
case UsableItemTag.RandomEffect: case UsableItemTag.RandomEffect:
_effectService.RandomEffect(effectItem); _effectService.RandomEffect(effectItem);
break; break;
} }
} }
private void EnactThrowableItemEffects(ThrowableItem throwableItem) private void EnactThrowableItemEffects(ThrowableItem throwableItem)
{ {
switch (throwableItem.ThrowableItemTag) switch (throwableItem.ThrowableItemTag)
{ {
case ThrowableItemTag.DoubleExp: case ThrowableItemTag.DoubleExp:
GameRepo.StartDoubleEXP(TimeSpan.FromSeconds(30)); GameRepo.StartDoubleEXP(TimeSpan.FromSeconds(30));
break; break;
case ThrowableItemTag.TeleportToRandomLocation: case ThrowableItemTag.TeleportToRandomLocation:
_effectService.TeleportToRandomRoom(Player); _effectService.TeleportToRandomRoom(Player);
InGameUI.CloseInventory(); InGameUI.CloseInventory();
break; break;
case ThrowableItemTag.CanChangeAffinity: case ThrowableItemTag.CanChangeAffinity:
_effectService.ChangeAffinity(throwableItem); _effectService.ChangeAffinity(throwableItem);
break; break;
case ThrowableItemTag.WarpToExitIfFound: case ThrowableItemTag.WarpToExitIfFound:
_effectService.WarpToExit(Player); _effectService.WarpToExit(Player);
InGameUI.CloseInventory(); InGameUI.CloseInventory();
break; break;
} }
if (throwableItem.HealHPAmount > 0) if (throwableItem.HealHPAmount > 0)
Player.HealHP(throwableItem.HealHPAmount); Player.HealHP(throwableItem.HealHPAmount);
if (throwableItem.HealVTAmount > 0) if (throwableItem.HealVTAmount > 0)
Player.HealVT(throwableItem.HealVTAmount); Player.HealVT(throwableItem.HealVTAmount);
} }
private void RemoveItemOrSubtractFromItemCount(InventoryItem item) private void RemoveItemOrSubtractFromItemCount(InventoryItem item)
{ {
if (item is IStackable stackableItem && stackableItem.Count > 1) if (item is IStackable stackableItem && stackableItem.Count > 1)
stackableItem.SetCount(stackableItem.Count - 1); stackableItem.SetCount(stackableItem.Count - 1);
else else
GameRepo.RemoveItemFromInventory(item); GameRepo.RemoveItemFromInventory(item);
} }
} }

View File

@@ -15,8 +15,6 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
event Game.SaveFileLoadedEventHandler? SaveFileLoaded; event Game.SaveFileLoadedEventHandler? SaveFileLoaded;
event Game.StatRaisedAlertEventHandler StatRaisedAlert;
public RescuedItemDatabase RescuedItems { get; } public RescuedItemDatabase RescuedItems { get; }
public IDungeonFloor CurrentFloor { get; } public IDungeonFloor CurrentFloor { get; }

View File

@@ -11,6 +11,17 @@ public partial class BossRoomB : Node3D, IBossRoom
[Node] public Marker3D PlayerSpawn { get; set; } = default!; [Node] public Marker3D PlayerSpawn { get; set; } = default!;
[Node] public DemonWall DemonWall { get; set; } = default!;
[Node] private Area3D ActivateTrap { get; set; } = default!;
public void OnReady()
{
ActivateTrap.BodyEntered += ActivateTrap_AreaEntered;
}
private void ActivateTrap_AreaEntered(Node3D area) => StartBossFight();
public void OnBossFightEnded() public void OnBossFightEnded()
{ {
@@ -18,6 +29,6 @@ public partial class BossRoomB : Node3D, IBossRoom
public void StartBossFight() public void StartBossFight()
{ {
DemonWall.Activate();
} }
} }

View File

@@ -1972,6 +1972,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -102.157, -2.30863, 13.0139)
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, -102.157, -0.510939, 13.0139) transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, -102.157, -0.510939, 13.0139)
visible = false visible = false
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
_movementSpeed = null
[node name="OxFaceStatue" parent="Room" instance=ExtResource("26_futcf")] [node name="OxFaceStatue" parent="Room" instance=ExtResource("26_futcf")]
unique_name_in_owner = true unique_name_in_owner = true
@@ -1981,6 +1984,9 @@ transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -101.5
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(-0.15, 0, -2.26494e-08, 0, 0.15, 0, 2.26494e-08, 0, -0.15, -101.703, -0.479859, 22.0955) transform = Transform3D(-0.15, 0, -2.26494e-08, 0, 0.15, 0, 2.26494e-08, 0, -0.15, -101.703, -0.479859, 22.0955)
visible = false visible = false
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
_movementSpeed = null
[node name="Exit" type="Area3D" parent="Room"] [node name="Exit" type="Area3D" parent="Room"]
unique_name_in_owner = true unique_name_in_owner = true

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=120 format=4 uid="uid://ceo7ph483io44"] [gd_scene load_steps=121 format=4 uid="uid://ceo7ph483io44"]
[ext_resource type="Script" uid="uid://cvj30id0i8ska" path="res://src/map/dungeon/code/BossRoomB.cs" id="1_bxvob"] [ext_resource type="Script" uid="uid://cvj30id0i8ska" path="res://src/map/dungeon/code/BossRoomB.cs" id="1_bxvob"]
[ext_resource type="Texture2D" uid="uid://dovqerwxfvkga" path="res://src/map/dungeon/models/Set B/34. Boss Floor B/34_A2_BOSS FLOOR B_VER_COLUMN_WHITE.png" id="2_egkxs"] [ext_resource type="Texture2D" uid="uid://dovqerwxfvkga" path="res://src/map/dungeon/models/Set B/34. Boss Floor B/34_A2_BOSS FLOOR B_VER_COLUMN_WHITE.png" id="2_egkxs"]
@@ -1626,6 +1626,9 @@ radius = 1.33887
[sub_resource type="BoxShape3D" id="BoxShape3D_oqcwc"] [sub_resource type="BoxShape3D" id="BoxShape3D_oqcwc"]
size = Vector3(1.9823, 12.776, 1.97168) size = Vector3(1.9823, 12.776, 1.97168)
[sub_resource type="BoxShape3D" id="BoxShape3D_bxvob"]
size = Vector3(31.5159, 15.6586, 11.8418)
[node name="Boss Floor B" type="Node3D"] [node name="Boss Floor B" type="Node3D"]
script = ExtResource("1_bxvob") script = ExtResource("1_bxvob")
@@ -1929,7 +1932,17 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -115.98, -2.05432, 16.535)
[node name="Room" type="Node3D" parent="."] [node name="Room" type="Node3D" parent="."]
[node name="ActivateTrap" type="Area3D" parent="Room"]
unique_name_in_owner = true
collision_layer = 2
collision_mask = 2
[node name="CollisionShape3D" type="CollisionShape3D" parent="Room/ActivateTrap"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.197388, 31.0529, 77.0455)
shape = SubResource("BoxShape3D_bxvob")
[node name="Minimap" type="Node3D" parent="."] [node name="Minimap" type="Node3D" parent="."]
[node name="Demon Wall" parent="." instance=ExtResource("25_k2q0o")] [node name="DemonWall" parent="." instance=ExtResource("25_k2q0o")]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 21.2936, 55.334) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 21.2936, 55.334)

View File

@@ -60,13 +60,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
ISaveChunk<PlayerData> IProvide<ISaveChunk<PlayerData>>.Value() => PlayerChunk; ISaveChunk<PlayerData> IProvide<ISaveChunk<PlayerData>>.Value() => PlayerChunk;
#endregion #endregion
#region Event Signals
[Signal]
public delegate void InventoryButtonPressedEventHandler();
[Signal]
public delegate void MinimapButtonHeldEventHandler();
#endregion
#region Exports #region Exports
[Export] [Export]
public PlayerStatResource PlayerStatResource { get; set; } = default!; public PlayerStatResource PlayerStatResource { get; set; } = default!;