Loading works
Debug pickup
This commit is contained in:
@@ -25,7 +25,7 @@ public interface IPlayer : IKillable, IProvide<ISaveChunk<PlayerData>>
|
||||
|
||||
public void Move(float delta);
|
||||
|
||||
public void TeleportPlayer(Vector3 newPosition);
|
||||
public void TeleportPlayer(Transform3D newTransform);
|
||||
|
||||
public IDungeonRoom GetCurrentRoom();
|
||||
|
||||
|
||||
@@ -160,6 +160,9 @@ public partial class Player : CharacterBody3D, IPlayer
|
||||
Equip(defaultArmor);
|
||||
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
CollisionDetector.AreaEntered += CollisionDetector_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
@@ -211,9 +214,6 @@ public partial class Player : CharacterBody3D, IPlayer
|
||||
|
||||
PlayerLogic.Start();
|
||||
this.Provide();
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
CollisionDetector.AreaEntered += CollisionDetector_AreaEntered;
|
||||
}
|
||||
|
||||
private void CollisionDetector_AreaEntered(Area3D area)
|
||||
@@ -229,6 +229,17 @@ public partial class Player : CharacterBody3D, IPlayer
|
||||
else
|
||||
Game.AnnounceMessageOnMainScreen($"Could not pick up {inventoryItem.ItemName}.");
|
||||
}
|
||||
if (area.GetParent() is DroppedItem droppedItem)
|
||||
{
|
||||
var isAdded = Inventory.TryAdd(droppedItem.Item);
|
||||
if (isAdded)
|
||||
{
|
||||
Game.AnnounceMessageOnMainScreen($"{droppedItem.Item.ItemName} picked up.");
|
||||
droppedItem.QueueFree();
|
||||
}
|
||||
else
|
||||
Game.AnnounceMessageOnMainScreen($"Could not pick up {droppedItem.Item.ItemName}.");
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReady()
|
||||
@@ -337,9 +348,9 @@ public partial class Player : CharacterBody3D, IPlayer
|
||||
MoveAndSlide();
|
||||
}
|
||||
|
||||
public void TeleportPlayer(Vector3 newPosition)
|
||||
public void TeleportPlayer(Transform3D newTransform)
|
||||
{
|
||||
GlobalPosition = newPosition;
|
||||
Transform = newTransform;
|
||||
}
|
||||
|
||||
public void TakeDamage(double damage, ElementType elementType, bool isCriticalHit = false)
|
||||
@@ -389,12 +400,6 @@ public partial class Player : CharacterBody3D, IPlayer
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Attack))
|
||||
Attack();
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Save))
|
||||
Game.Save();
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Load))
|
||||
Game.Load();
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
|
||||
@@ -38,7 +38,7 @@ radius = 1.0
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_hs4wf"]
|
||||
size = Vector3(1.94531, 3.38623, 2.35425)
|
||||
size = Vector3(1.94531, 3.38623, 1.50671)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_hcjph"]
|
||||
length = 0.001
|
||||
@@ -495,7 +495,7 @@ collision_layer = 452
|
||||
collision_mask = 452
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CollisionDetector"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.509249, -0.675098)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.509249, -0.25133)
|
||||
shape = SubResource("BoxShape3D_hs4wf")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
|
||||
Reference in New Issue
Block a user