Demon wall implementation time
This commit is contained in:
@@ -32,8 +32,10 @@ animation = &"ARM 1 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dqcrh"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bpd8u"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm1" type="Node3D"]
|
||||
script = ExtResource("2_w0a5p")
|
||||
_enemyStatResource = SubResource("Resource_yfb8x")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM1" parent="." instance=ExtResource("1_3tnuk")]
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ animation = &"ARM 2 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_xj37f"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jlfdv"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm2" type="Node3D"]
|
||||
script = ExtResource("1_jkuo4")
|
||||
_enemyStatResource = SubResource("Resource_ni55f")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM2" parent="." instance=ExtResource("1_7rfsf")]
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ animation = &"ARM 3 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p21h7"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_1weac"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm3" type="Node3D"]
|
||||
script = ExtResource("1_fhrhk")
|
||||
_enemyStatResource = SubResource("Resource_gcbec")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM3" parent="." instance=ExtResource("1_wuuwb")]
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ animation = &"ARM 4 SHOCK"
|
||||
animation = &"ARM 4 IDLE_001"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_s0ts5"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -36,6 +37,7 @@ advance_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ggmev"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_nwywg"]
|
||||
states/attack/node = SubResource("AnimationNodeAnimation_jlfdv")
|
||||
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
|
||||
[node name="Arm4" type="Node3D"]
|
||||
script = ExtResource("1_nwywg")
|
||||
_enemyStatResource = SubResource("Resource_0pjjv")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM4" parent="." instance=ExtResource("1_dr5tf")]
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ animation = &"ARM 5 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_cpus0"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l47f2"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm5" type="Node3D"]
|
||||
script = ExtResource("1_j3ruw")
|
||||
_enemyStatResource = SubResource("Resource_bqpdp")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM5" parent="." instance=ExtResource("1_3y571")]
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ animation = &"ARM 6 SLASH"
|
||||
animation = &"ARM 6 IDLE"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bt0kd"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -36,6 +37,7 @@ advance_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_stghn"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_xefo1"]
|
||||
states/attack/node = SubResource("AnimationNodeAnimation_s0ts5")
|
||||
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
|
||||
[node name="Arm6" type="Node3D"]
|
||||
script = ExtResource("1_xefo1")
|
||||
_enemyStatResource = SubResource("Resource_7mykh")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM6" parent="." instance=ExtResource("1_txo11")]
|
||||
|
||||
|
||||
@@ -29,11 +29,13 @@ animation = &"7_ AGNI CONE"
|
||||
animation = &"ARM 7 IDLE"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_728ue"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0admf"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mknr5"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["idle", "attack", SubResource("AnimationNodeStateMachineTransitio
|
||||
[node name="Arm7" type="Node3D"]
|
||||
script = ExtResource("1_enq7k")
|
||||
_enemyStatResource = SubResource("Resource_2r6oy")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM7" parent="." instance=ExtResource("1_kip2x")]
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ animation = &"ARM 8 MELEE"
|
||||
animation = &"ARM 8 IDLE"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0kspt"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -36,6 +37,7 @@ advance_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_e3l4l"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_5tnjc"]
|
||||
states/attack/node = SubResource("AnimationNodeAnimation_cpus0")
|
||||
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
|
||||
[node name="Arm8" type="Node3D"]
|
||||
script = ExtResource("1_5tnjc")
|
||||
_enemyStatResource = SubResource("Resource_p8nrl")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM8" parent="." instance=ExtResource("1_7eb4v")]
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ animation = &"ARM 9 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ryvbb"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_u8us3"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm9" type="Node3D"]
|
||||
script = ExtResource("1_fjfqv")
|
||||
_enemyStatResource = SubResource("Resource_4tcsg")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM9" parent="." instance=ExtResource("1_vc4af")]
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using Zennysoft.Ma.Adapter;
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class DemonWall : Node3D
|
||||
public partial class DemonWall : CharacterBody3D
|
||||
{
|
||||
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!;
|
||||
|
||||
[Node] private DemonWallArm _arm3 { get; set; } = default!;
|
||||
|
||||
[Node] public Node3D LeftArms { 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!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
}
|
||||
[Node] private AnimatableBody3D _opposingWall { get; set; } = default!;
|
||||
|
||||
[Export] private double _maximumWallMoveAmount = 24;
|
||||
|
||||
private Timer _attackTimer;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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 MoveWallTowardsPlayer(float moveAmount)
|
||||
{
|
||||
_opposingWall.Position = new Vector3(_opposingWall.Position.X, _opposingWall.Position.Y, moveAmount);
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
_attackTimer.Timeout -= AttackTimer_Timeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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://dnkmr0eq1sij0" path="res://src/enemy/EnemyStatResource.cs" id="2_bpd8u"]
|
||||
@@ -163,7 +163,13 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
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")
|
||||
_enemyStatResource = SubResource("Resource_ccv8a")
|
||||
|
||||
@@ -179,6 +185,7 @@ unique_name_in_owner = true
|
||||
[node name="Arm2" parent="LeftArms" instance=ExtResource("4_qignv")]
|
||||
|
||||
[node name="Arm3" parent="LeftArms" instance=ExtResource("5_kosjo")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[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")
|
||||
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)
|
||||
|
||||
[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
|
||||
|
||||
@@ -6,17 +6,23 @@ using Zennysoft.Ma.Adapter;
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class DemonWallArm : Node3D, IHasPrimaryAttack
|
||||
public partial class DemonWallArm : Node3D
|
||||
{
|
||||
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!;
|
||||
|
||||
[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);
|
||||
}
|
||||
|
||||
@@ -39,9 +39,6 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
public GameLogic.IBinding GameBinding { get; set; } = default!;
|
||||
|
||||
[Signal]
|
||||
public delegate void StatRaisedAlertEventHandler(string statRaisedAlert);
|
||||
|
||||
[Dependency] public IAppRepo AppRepo => this.DependOn<IAppRepo>();
|
||||
|
||||
#region Nodes
|
||||
@@ -79,201 +76,201 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
_container = new SimpleInjector.Container();
|
||||
Module.Bootstrap(_container);
|
||||
_container.Verify();
|
||||
_container = new SimpleInjector.Container();
|
||||
Module.Bootstrap(_container);
|
||||
_container.Verify();
|
||||
|
||||
GameRepo = _container.GetInstance<IGameRepo>();
|
||||
GameLogic = _container.GetInstance<IGameLogic>();
|
||||
GameEventDepot = new GameEventDepot();
|
||||
GameLogic.Set(GameRepo);
|
||||
GameLogic.Set(AppRepo);
|
||||
GameLogic.Set(GameEventDepot);
|
||||
GameLogic.Set(Player);
|
||||
GameLogic.Set(Map);
|
||||
GameLogic.Set(InGameUI);
|
||||
Instantiator = new Instantiator(GetTree());
|
||||
RescuedItems = new RescuedItemDatabase();
|
||||
GameRepo = _container.GetInstance<IGameRepo>();
|
||||
GameLogic = _container.GetInstance<IGameLogic>();
|
||||
GameEventDepot = new GameEventDepot();
|
||||
GameLogic.Set(GameRepo);
|
||||
GameLogic.Set(AppRepo);
|
||||
GameLogic.Set(GameEventDepot);
|
||||
GameLogic.Set(Player);
|
||||
GameLogic.Set(Map);
|
||||
GameLogic.Set(InGameUI);
|
||||
Instantiator = new Instantiator(GetTree());
|
||||
RescuedItems = new RescuedItemDatabase();
|
||||
|
||||
GameChunk = new SaveChunk<GameData>(
|
||||
(chunk) =>
|
||||
{
|
||||
var gameData = new GameData()
|
||||
{
|
||||
PlayerData = new PlayerData()
|
||||
{
|
||||
PlayerStats = new PlayerStats()
|
||||
{
|
||||
CurrentHP = Player.Stats.CurrentHP.Value,
|
||||
MaximumHP = Player.Stats.MaximumHP.Value,
|
||||
CurrentVT = Player.Stats.CurrentVT.Value,
|
||||
MaximumVT = Player.Stats.MaximumVT.Value,
|
||||
CurrentAttack = Player.Stats.CurrentAttack.Value,
|
||||
BonusAttack = Player.Stats.BonusAttack.Value,
|
||||
MaxAttack = Player.Stats.MaxAttack.Value,
|
||||
CurrentDefense = Player.Stats.CurrentDefense.Value,
|
||||
BonusDefense = Player.Stats.BonusDefense.Value,
|
||||
MaxDefense = Player.Stats.MaxDefense.Value,
|
||||
CurrentExp = Player.Stats.CurrentExp.Value,
|
||||
CurrentLevel = Player.Stats.CurrentLevel.Value,
|
||||
ExpToNextLevel = Player.Stats.ExpToNextLevel.Value,
|
||||
Luck = Player.Stats.Luck.Value
|
||||
},
|
||||
Inventory = Player.Inventory
|
||||
},
|
||||
MapData = new MapData()
|
||||
{
|
||||
FloorScenes = Map.FloorScenes
|
||||
},
|
||||
RescuedItems = new RescuedItemDatabase() { Items = RescuedItems.Items }
|
||||
};
|
||||
GameChunk = new SaveChunk<GameData>(
|
||||
(chunk) =>
|
||||
{
|
||||
var gameData = new GameData()
|
||||
{
|
||||
PlayerData = new PlayerData()
|
||||
{
|
||||
PlayerStats = new PlayerStats()
|
||||
{
|
||||
CurrentHP = Player.Stats.CurrentHP.Value,
|
||||
MaximumHP = Player.Stats.MaximumHP.Value,
|
||||
CurrentVT = Player.Stats.CurrentVT.Value,
|
||||
MaximumVT = Player.Stats.MaximumVT.Value,
|
||||
CurrentAttack = Player.Stats.CurrentAttack.Value,
|
||||
BonusAttack = Player.Stats.BonusAttack.Value,
|
||||
MaxAttack = Player.Stats.MaxAttack.Value,
|
||||
CurrentDefense = Player.Stats.CurrentDefense.Value,
|
||||
BonusDefense = Player.Stats.BonusDefense.Value,
|
||||
MaxDefense = Player.Stats.MaxDefense.Value,
|
||||
CurrentExp = Player.Stats.CurrentExp.Value,
|
||||
CurrentLevel = Player.Stats.CurrentLevel.Value,
|
||||
ExpToNextLevel = Player.Stats.ExpToNextLevel.Value,
|
||||
Luck = Player.Stats.Luck.Value
|
||||
},
|
||||
Inventory = Player.Inventory
|
||||
},
|
||||
MapData = new MapData()
|
||||
{
|
||||
FloorScenes = Map.FloorScenes
|
||||
},
|
||||
RescuedItems = new RescuedItemDatabase() { Items = RescuedItems.Items }
|
||||
};
|
||||
|
||||
return gameData;
|
||||
},
|
||||
onLoad: (chunk, data) =>
|
||||
{
|
||||
RescuedItems = data.RescuedItems;
|
||||
chunk.LoadChunkSaveData(data.PlayerData);
|
||||
chunk.LoadChunkSaveData(data.MapData);
|
||||
}
|
||||
);
|
||||
return gameData;
|
||||
},
|
||||
onLoad: (chunk, data) =>
|
||||
{
|
||||
RescuedItems = data.RescuedItems;
|
||||
chunk.LoadChunkSaveData(data.PlayerData);
|
||||
chunk.LoadChunkSaveData(data.MapData);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
var saveFileManager = _container.GetInstance<IMaSaveFileManager<GameData>>();
|
||||
SaveFile = new SaveFile<GameData>(
|
||||
root: GameChunk,
|
||||
onSave: saveFileManager.Save,
|
||||
onLoad: async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var gameData = await saveFileManager.Load();
|
||||
return gameData;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
GD.Print("No save file found.");
|
||||
}
|
||||
var saveFileManager = _container.GetInstance<IMaSaveFileManager<GameData>>();
|
||||
SaveFile = new SaveFile<GameData>(
|
||||
root: GameChunk,
|
||||
onSave: saveFileManager.Save,
|
||||
onLoad: async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var gameData = await saveFileManager.Load();
|
||||
return gameData;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
GD.Print("No save file found.");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
GameBinding = GameLogic.Bind();
|
||||
GameBinding
|
||||
.Handle((in GameLogic.Output.StartGame _) =>
|
||||
{
|
||||
GameRepo.Resume();
|
||||
InGameUI.Show();
|
||||
})
|
||||
.Handle((in GameLogic.Output.GoToOverworld _) =>
|
||||
{
|
||||
GameEventDepot.OnOverworldEntered();
|
||||
})
|
||||
.Handle((in GameLogic.Output.SetPauseMode output) => CallDeferred(nameof(SetPauseMode), output.IsPaused))
|
||||
.Handle((in GameLogic.Output.ShowPauseMenu _) =>
|
||||
{
|
||||
PauseMenu.Show();
|
||||
PauseMenu.FadeIn();
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
PauseMenu.SetProcessUnhandledInput(true);
|
||||
})
|
||||
.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.LoadNextFloor _) => { Map.SpawnNextFloor(); })
|
||||
.Handle((in GameLogic.Output.LoadMap _) => { Map.LoadMap(); })
|
||||
.Handle((in GameLogic.Output.ShowFloorClearMenu _) => { FloorClearMenu.Show(); FloorClearMenu.FadeIn(); })
|
||||
.Handle((in GameLogic.Output.ExitFloorClearMenu _) => { FloorClearMenu.FadeOut(); })
|
||||
.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.ShowLostScreen _) => { DeathMenu.Show(); DeathMenu.FadeIn(); })
|
||||
.Handle((in GameLogic.Output.ExitLostScreen _) => { DeathMenu.FadeOut(); })
|
||||
.Handle((in GameLogic.Output.DoubleExpTimeStart output) => { DoubleEXPTimer.WaitTime = output.lengthOfTimeInSeconds; DoubleEXPTimer.Start(); })
|
||||
.Handle((in GameLogic.Output.SaveGame _) =>
|
||||
{
|
||||
SaveFile.Save();
|
||||
AppRepo.OnExitGame();
|
||||
GetTree().Quit();
|
||||
// Back to title screen
|
||||
});
|
||||
GameLogic.Start();
|
||||
GameBinding = GameLogic.Bind();
|
||||
GameBinding
|
||||
.Handle((in GameLogic.Output.StartGame _) =>
|
||||
{
|
||||
GameRepo.Resume();
|
||||
InGameUI.Show();
|
||||
})
|
||||
.Handle((in GameLogic.Output.GoToOverworld _) =>
|
||||
{
|
||||
GameEventDepot.OnOverworldEntered();
|
||||
})
|
||||
.Handle((in GameLogic.Output.SetPauseMode output) => CallDeferred(nameof(SetPauseMode), output.IsPaused))
|
||||
.Handle((in GameLogic.Output.ShowPauseMenu _) =>
|
||||
{
|
||||
PauseMenu.Show();
|
||||
PauseMenu.FadeIn();
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
PauseMenu.SetProcessUnhandledInput(true);
|
||||
})
|
||||
.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.LoadNextFloor _) => { Map.SpawnNextFloor(); })
|
||||
.Handle((in GameLogic.Output.LoadMap _) => { Map.LoadMap(); })
|
||||
.Handle((in GameLogic.Output.ShowFloorClearMenu _) => { FloorClearMenu.Show(); FloorClearMenu.FadeIn(); })
|
||||
.Handle((in GameLogic.Output.ExitFloorClearMenu _) => { FloorClearMenu.FadeOut(); })
|
||||
.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.ShowLostScreen _) => { DeathMenu.Show(); DeathMenu.FadeIn(); })
|
||||
.Handle((in GameLogic.Output.ExitLostScreen _) => { DeathMenu.FadeOut(); })
|
||||
.Handle((in GameLogic.Output.DoubleExpTimeStart output) => { DoubleEXPTimer.WaitTime = output.lengthOfTimeInSeconds; DoubleEXPTimer.Start(); })
|
||||
.Handle((in GameLogic.Output.SaveGame _) =>
|
||||
{
|
||||
SaveFile.Save();
|
||||
AppRepo.OnExitGame();
|
||||
GetTree().Quit();
|
||||
// Back to title screen
|
||||
});
|
||||
GameLogic.Start();
|
||||
|
||||
GameLogic.Input(new GameLogic.Input.Initialize());
|
||||
GameLogic.Input(new GameLogic.Input.Initialize());
|
||||
|
||||
this.Provide();
|
||||
this.Provide();
|
||||
|
||||
PauseMenu.TransitionCompleted += OnPauseMenuTransitioned;
|
||||
PauseMenu.UnpauseButtonPressed += PauseMenu_UnpauseButtonPressed;
|
||||
PauseMenu.TransitionCompleted += OnPauseMenuTransitioned;
|
||||
PauseMenu.UnpauseButtonPressed += PauseMenu_UnpauseButtonPressed;
|
||||
|
||||
InGameUI.UseTeleportPrompt.TeleportToNextFloor += UseTeleportPrompt_TeleportToNextFloor;
|
||||
InGameUI.UseTeleportPrompt.CloseTeleportPrompt += UseTeleportPrompt_CloseTeleportPrompt;
|
||||
InGameUI.UseTeleportPrompt.TeleportToNextFloor += UseTeleportPrompt_TeleportToNextFloor;
|
||||
InGameUI.UseTeleportPrompt.CloseTeleportPrompt += UseTeleportPrompt_CloseTeleportPrompt;
|
||||
|
||||
FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor;
|
||||
FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit;
|
||||
FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted;
|
||||
FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor;
|
||||
FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit;
|
||||
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 TogglePause()
|
||||
{
|
||||
if (GameLogic.Value is GameLogic.State.Paused)
|
||||
GameLogic.Input(new GameLogic.Input.UnpauseGame());
|
||||
else
|
||||
GameLogic.Input(new GameLogic.Input.PauseGame());
|
||||
if (GameLogic.Value is GameLogic.State.Paused)
|
||||
GameLogic.Input(new GameLogic.Input.UnpauseGame());
|
||||
else
|
||||
GameLogic.Input(new GameLogic.Input.PauseGame());
|
||||
}
|
||||
|
||||
public void FloorExitReached()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.AskForTeleport());
|
||||
GameEventDepot.OnTeleportEntered();
|
||||
GameLogic.Input(new GameLogic.Input.AskForTeleport());
|
||||
GameEventDepot.OnTeleportEntered();
|
||||
}
|
||||
|
||||
public async Task UseItem(InventoryItem item)
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case ConsumableItem consumableItem:
|
||||
EnactConsumableItemEffects(consumableItem);
|
||||
break;
|
||||
case EffectItem effectItem:
|
||||
EnactEffectItemEffects(effectItem);
|
||||
break;
|
||||
case ThrowableItem throwableItem:
|
||||
EnactThrowableItemEffects(throwableItem);
|
||||
break;
|
||||
}
|
||||
switch (item)
|
||||
{
|
||||
case ConsumableItem consumableItem:
|
||||
EnactConsumableItemEffects(consumableItem);
|
||||
break;
|
||||
case EffectItem effectItem:
|
||||
EnactEffectItemEffects(effectItem);
|
||||
break;
|
||||
case ThrowableItem throwableItem:
|
||||
EnactThrowableItemEffects(throwableItem);
|
||||
break;
|
||||
}
|
||||
|
||||
await ToSignal(GetTree().CreateTimer(0.3f), "timeout");
|
||||
await ToSignal(GetTree().CreateTimer(0.3f), "timeout");
|
||||
|
||||
RemoveItemOrSubtractFromItemCount(item);
|
||||
RemoveItemOrSubtractFromItemCount(item);
|
||||
}
|
||||
|
||||
public void DropItem(InventoryItem item)
|
||||
{
|
||||
var droppedScene = GD.Load<PackedScene>("res://src/items/dropped/DroppedItem.tscn");
|
||||
var dropped = droppedScene.Instantiate<DroppedItem>();
|
||||
dropped.Item = item;
|
||||
AddChild(dropped);
|
||||
dropped.Drop();
|
||||
var droppedScene = GD.Load<PackedScene>("res://src/items/dropped/DroppedItem.tscn");
|
||||
var dropped = droppedScene.Instantiate<DroppedItem>();
|
||||
dropped.Item = item;
|
||||
AddChild(dropped);
|
||||
dropped.Drop();
|
||||
}
|
||||
|
||||
public void ThrowItem(InventoryItem item)
|
||||
{
|
||||
var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
|
||||
var thrown = thrownScene.Instantiate<ThrownItem>();
|
||||
thrown.ItemThatIsThrown = (InventoryItem)item;
|
||||
AddChild(thrown);
|
||||
thrown.Position += new Vector3(0, 1.5f, 0);
|
||||
thrown.Throw(_effectService);
|
||||
var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
|
||||
var thrown = thrownScene.Instantiate<ThrownItem>();
|
||||
thrown.ItemThatIsThrown = (InventoryItem)item;
|
||||
AddChild(thrown);
|
||||
thrown.Position += new Vector3(0, 1.5f, 0);
|
||||
thrown.Throw(_effectService);
|
||||
}
|
||||
|
||||
public IDungeonFloor CurrentFloor => Map.CurrentFloor;
|
||||
@@ -282,18 +279,18 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
private void DropRestorative(Vector3 vector)
|
||||
{
|
||||
var restorativeScene = GD.Load<PackedScene>("res://src/items/restorative/Restorative.tscn");
|
||||
var restorative = restorativeScene.Instantiate<Restorative>();
|
||||
AddChild(restorative);
|
||||
restorative.GlobalPosition = vector;
|
||||
var restorativeScene = GD.Load<PackedScene>("res://src/items/restorative/Restorative.tscn");
|
||||
var restorative = restorativeScene.Instantiate<Restorative>();
|
||||
AddChild(restorative);
|
||||
restorative.GlobalPosition = vector;
|
||||
}
|
||||
|
||||
private void UseTeleportPrompt_CloseTeleportPrompt() => GameLogic.Input(new GameLogic.Input.HideAskForTeleport());
|
||||
|
||||
private void UseTeleportPrompt_TeleportToNextFloor()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.FloorExitReached());
|
||||
GameEventDepot.OnDungeonAThemeAreaEntered();
|
||||
GameLogic.Input(new GameLogic.Input.FloorExitReached());
|
||||
GameEventDepot.OnDungeonAThemeAreaEntered();
|
||||
}
|
||||
|
||||
private void PauseMenu_UnpauseButtonPressed() => GameLogic.Input(new GameLogic.Input.UnpauseGame());
|
||||
@@ -302,13 +299,13 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
private void FloorClearMenu_TransitionCompleted()
|
||||
{
|
||||
GameRepo.Resume();
|
||||
if (Player.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnChange)
|
||||
Player.Unequip(Player.EquippedWeapon.Value);
|
||||
if (Player.EquippedArmor.Value.ItemTag == ItemTag.BreaksOnChange)
|
||||
Player.Unequip(Player.EquippedArmor.Value);
|
||||
if (Player.EquippedAccessory.Value.ItemTag == ItemTag.BreaksOnChange)
|
||||
Player.Unequip(Player.EquippedAccessory.Value);
|
||||
GameRepo.Resume();
|
||||
if (Player.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnChange)
|
||||
Player.Unequip(Player.EquippedWeapon.Value);
|
||||
if (Player.EquippedArmor.Value.ItemTag == ItemTag.BreaksOnChange)
|
||||
Player.Unequip(Player.EquippedArmor.Value);
|
||||
if (Player.EquippedAccessory.Value.ItemTag == ItemTag.BreaksOnChange)
|
||||
Player.Unequip(Player.EquippedAccessory.Value);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (GetTree() != null)
|
||||
GetTree().Paused = isPaused;
|
||||
if (GetTree() != null)
|
||||
GetTree().Paused = isPaused;
|
||||
}
|
||||
|
||||
private void DoubleEXPTimer_Timeout() => GameRepo.EndDoubleExp();
|
||||
@@ -335,88 +332,88 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
private void EnactConsumableItemEffects(ConsumableItem consumableItem)
|
||||
{
|
||||
if (Player.Stats.CurrentHP == Player.Stats.MaximumHP && consumableItem.RaiseHPAmount > 0)
|
||||
Player.RaiseHP(consumableItem.RaiseHPAmount);
|
||||
if (Player.Stats.CurrentVT == Player.Stats.MaximumVT && consumableItem.RaiseVTAmount > 0)
|
||||
Player.RaiseVT(consumableItem.RaiseVTAmount);
|
||||
if (Player.Stats.CurrentHP == Player.Stats.MaximumHP && consumableItem.RaiseHPAmount > 0)
|
||||
Player.RaiseHP(consumableItem.RaiseHPAmount);
|
||||
if (Player.Stats.CurrentVT == Player.Stats.MaximumVT && consumableItem.RaiseVTAmount > 0)
|
||||
Player.RaiseVT(consumableItem.RaiseVTAmount);
|
||||
|
||||
if (consumableItem.HealHPAmount > 0 && Player.Stats.CurrentHP != Player.Stats.MaximumHP)
|
||||
Player.HealHP(consumableItem.HealHPAmount);
|
||||
if (consumableItem.HealVTAmount > 0 && Player.Stats.CurrentVT != Player.Stats.MaximumVT)
|
||||
Player.HealVT(consumableItem.HealVTAmount);
|
||||
if (consumableItem.HealHPAmount > 0 && Player.Stats.CurrentHP != Player.Stats.MaximumHP)
|
||||
Player.HealHP(consumableItem.HealHPAmount);
|
||||
if (consumableItem.HealVTAmount > 0 && Player.Stats.CurrentVT != Player.Stats.MaximumVT)
|
||||
Player.HealVT(consumableItem.HealVTAmount);
|
||||
}
|
||||
|
||||
private void EnactEffectItemEffects(EffectItem effectItem)
|
||||
{
|
||||
switch (effectItem.UsableItemTag)
|
||||
{
|
||||
case UsableItemTag.TeleportAllEnemiesToRoom:
|
||||
_effectService.TeleportEnemiesToCurrentRoom();
|
||||
break;
|
||||
case UsableItemTag.KillHalfEnemiesInRoom:
|
||||
_effectService.KillHalfEnemiesInRoom();
|
||||
break;
|
||||
case UsableItemTag.TurnAllEnemiesIntoHealingItem:
|
||||
_effectService.TurnAllEnemiesInRoomIntoHealingItem();
|
||||
break;
|
||||
case UsableItemTag.HealsAllInRoomToMaxHP:
|
||||
_effectService.HealAllEnemiesAndPlayerInRoomToFull();
|
||||
break;
|
||||
case UsableItemTag.AbsorbHPFromAllEnemiesInRoom:
|
||||
_effectService.AbsorbHPFromAllEnemiesInRoom();
|
||||
break;
|
||||
case UsableItemTag.DealElementalDamageToAllEnemiesInRoom:
|
||||
_effectService.DealElementalDamageToAllEnemiesInRoom(ElementType.Hydric);
|
||||
break;
|
||||
case UsableItemTag.SwapHPAndVT:
|
||||
_effectService.SwapHPandVT();
|
||||
break;
|
||||
case UsableItemTag.RaiseCurrentWeaponAttack:
|
||||
_effectService.RaiseCurrentWeaponAttack();
|
||||
break;
|
||||
case UsableItemTag.RaiseCurrentDefenseArmor:
|
||||
_effectService.RaiseCurrentArmorDefense();
|
||||
break;
|
||||
case UsableItemTag.RaiseLevel:
|
||||
_effectService.RaiseLevel();
|
||||
break;
|
||||
case UsableItemTag.RandomEffect:
|
||||
_effectService.RandomEffect(effectItem);
|
||||
break;
|
||||
}
|
||||
switch (effectItem.UsableItemTag)
|
||||
{
|
||||
case UsableItemTag.TeleportAllEnemiesToRoom:
|
||||
_effectService.TeleportEnemiesToCurrentRoom();
|
||||
break;
|
||||
case UsableItemTag.KillHalfEnemiesInRoom:
|
||||
_effectService.KillHalfEnemiesInRoom();
|
||||
break;
|
||||
case UsableItemTag.TurnAllEnemiesIntoHealingItem:
|
||||
_effectService.TurnAllEnemiesInRoomIntoHealingItem();
|
||||
break;
|
||||
case UsableItemTag.HealsAllInRoomToMaxHP:
|
||||
_effectService.HealAllEnemiesAndPlayerInRoomToFull();
|
||||
break;
|
||||
case UsableItemTag.AbsorbHPFromAllEnemiesInRoom:
|
||||
_effectService.AbsorbHPFromAllEnemiesInRoom();
|
||||
break;
|
||||
case UsableItemTag.DealElementalDamageToAllEnemiesInRoom:
|
||||
_effectService.DealElementalDamageToAllEnemiesInRoom(ElementType.Hydric);
|
||||
break;
|
||||
case UsableItemTag.SwapHPAndVT:
|
||||
_effectService.SwapHPandVT();
|
||||
break;
|
||||
case UsableItemTag.RaiseCurrentWeaponAttack:
|
||||
_effectService.RaiseCurrentWeaponAttack();
|
||||
break;
|
||||
case UsableItemTag.RaiseCurrentDefenseArmor:
|
||||
_effectService.RaiseCurrentArmorDefense();
|
||||
break;
|
||||
case UsableItemTag.RaiseLevel:
|
||||
_effectService.RaiseLevel();
|
||||
break;
|
||||
case UsableItemTag.RandomEffect:
|
||||
_effectService.RandomEffect(effectItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void EnactThrowableItemEffects(ThrowableItem throwableItem)
|
||||
{
|
||||
switch (throwableItem.ThrowableItemTag)
|
||||
{
|
||||
case ThrowableItemTag.DoubleExp:
|
||||
GameRepo.StartDoubleEXP(TimeSpan.FromSeconds(30));
|
||||
break;
|
||||
case ThrowableItemTag.TeleportToRandomLocation:
|
||||
_effectService.TeleportToRandomRoom(Player);
|
||||
InGameUI.CloseInventory();
|
||||
break;
|
||||
case ThrowableItemTag.CanChangeAffinity:
|
||||
_effectService.ChangeAffinity(throwableItem);
|
||||
break;
|
||||
case ThrowableItemTag.WarpToExitIfFound:
|
||||
_effectService.WarpToExit(Player);
|
||||
InGameUI.CloseInventory();
|
||||
break;
|
||||
}
|
||||
switch (throwableItem.ThrowableItemTag)
|
||||
{
|
||||
case ThrowableItemTag.DoubleExp:
|
||||
GameRepo.StartDoubleEXP(TimeSpan.FromSeconds(30));
|
||||
break;
|
||||
case ThrowableItemTag.TeleportToRandomLocation:
|
||||
_effectService.TeleportToRandomRoom(Player);
|
||||
InGameUI.CloseInventory();
|
||||
break;
|
||||
case ThrowableItemTag.CanChangeAffinity:
|
||||
_effectService.ChangeAffinity(throwableItem);
|
||||
break;
|
||||
case ThrowableItemTag.WarpToExitIfFound:
|
||||
_effectService.WarpToExit(Player);
|
||||
InGameUI.CloseInventory();
|
||||
break;
|
||||
}
|
||||
|
||||
if (throwableItem.HealHPAmount > 0)
|
||||
Player.HealHP(throwableItem.HealHPAmount);
|
||||
if (throwableItem.HealVTAmount > 0)
|
||||
Player.HealVT(throwableItem.HealVTAmount);
|
||||
if (throwableItem.HealHPAmount > 0)
|
||||
Player.HealHP(throwableItem.HealHPAmount);
|
||||
if (throwableItem.HealVTAmount > 0)
|
||||
Player.HealVT(throwableItem.HealVTAmount);
|
||||
}
|
||||
|
||||
private void RemoveItemOrSubtractFromItemCount(InventoryItem item)
|
||||
{
|
||||
if (item is IStackable stackableItem && stackableItem.Count > 1)
|
||||
stackableItem.SetCount(stackableItem.Count - 1);
|
||||
else
|
||||
GameRepo.RemoveItemFromInventory(item);
|
||||
if (item is IStackable stackableItem && stackableItem.Count > 1)
|
||||
stackableItem.SetCount(stackableItem.Count - 1);
|
||||
else
|
||||
GameRepo.RemoveItemFromInventory(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
|
||||
|
||||
event Game.SaveFileLoadedEventHandler? SaveFileLoaded;
|
||||
|
||||
event Game.StatRaisedAlertEventHandler StatRaisedAlert;
|
||||
|
||||
public RescuedItemDatabase RescuedItems { get; }
|
||||
|
||||
public IDungeonFloor CurrentFloor { get; }
|
||||
|
||||
@@ -11,6 +11,17 @@ public partial class BossRoomB : Node3D, IBossRoom
|
||||
|
||||
[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()
|
||||
{
|
||||
|
||||
@@ -18,6 +29,6 @@ public partial class BossRoomB : Node3D, IBossRoom
|
||||
|
||||
public void StartBossFight()
|
||||
{
|
||||
|
||||
DemonWall.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, -102.157, -0.510939, 13.0139)
|
||||
visible = false
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
_movementSpeed = null
|
||||
|
||||
[node name="OxFaceStatue" parent="Room" instance=ExtResource("26_futcf")]
|
||||
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
|
||||
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
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
_movementSpeed = null
|
||||
|
||||
[node name="Exit" type="Area3D" parent="Room"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -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="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"]
|
||||
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"]
|
||||
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="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="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)
|
||||
|
||||
@@ -60,13 +60,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
|
||||
ISaveChunk<PlayerData> IProvide<ISaveChunk<PlayerData>>.Value() => PlayerChunk;
|
||||
#endregion
|
||||
|
||||
#region Event Signals
|
||||
[Signal]
|
||||
public delegate void InventoryButtonPressedEventHandler();
|
||||
[Signal]
|
||||
public delegate void MinimapButtonHeldEventHandler();
|
||||
#endregion
|
||||
|
||||
#region Exports
|
||||
[Export]
|
||||
public PlayerStatResource PlayerStatResource { get; set; } = default!;
|
||||
|
||||
Reference in New Issue
Block a user