Make overworld doors be of unlockable type, add behavior later
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Collections.Immutable;
|
||||
@@ -28,47 +28,47 @@ public abstract partial class DungeonRoom : Node3D, IDungeonRoom
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
_enemiesInRoom = [];
|
||||
if (_room != null)
|
||||
{
|
||||
_room.BodyEntered += Room_BodyEntered;
|
||||
_room.BodyExited += Room_BodyExited;
|
||||
}
|
||||
_enemiesInRoom = [];
|
||||
if (_room != null)
|
||||
{
|
||||
_room.BodyEntered += Room_BodyEntered;
|
||||
_room.BodyExited += Room_BodyExited;
|
||||
}
|
||||
}
|
||||
|
||||
private void Room_BodyExited(Node3D body)
|
||||
{
|
||||
if (body is IEnemy enemy)
|
||||
_enemiesInRoom = _enemiesInRoom.Remove(enemy);
|
||||
if (body is IPlayer)
|
||||
_isPlayerInRoom = false;
|
||||
if (body is IEnemy enemy)
|
||||
_enemiesInRoom = _enemiesInRoom.Remove(enemy);
|
||||
if (body is IPlayer)
|
||||
_isPlayerInRoom = false;
|
||||
}
|
||||
private void Room_BodyEntered(Node3D body)
|
||||
{
|
||||
if (body is IEnemy enemy)
|
||||
_enemiesInRoom = _enemiesInRoom.Add(enemy);
|
||||
if (body is IPlayer)
|
||||
if (_playerDiscoveredRoom)
|
||||
_isPlayerInRoom = true;
|
||||
else
|
||||
OnPlayerDiscoveringRoom();
|
||||
if (body is IEnemy enemy)
|
||||
_enemiesInRoom = _enemiesInRoom.Add(enemy);
|
||||
if (body is IPlayer)
|
||||
if (_playerDiscoveredRoom)
|
||||
_isPlayerInRoom = true;
|
||||
else
|
||||
OnPlayerDiscoveringRoom();
|
||||
}
|
||||
|
||||
public ImmutableList<IEnemy> GetEnemiesInCurrentRoom()
|
||||
{
|
||||
return _enemiesInRoom;
|
||||
return _enemiesInRoom;
|
||||
}
|
||||
|
||||
private void OnPlayerDiscoveringRoom()
|
||||
{
|
||||
_isPlayerInRoom = true;
|
||||
_playerDiscoveredRoom = true;
|
||||
_minimap.Show();
|
||||
_isPlayerInRoom = true;
|
||||
_playerDiscoveredRoom = true;
|
||||
_minimap.Show();
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
_room.BodyEntered -= Room_BodyEntered;
|
||||
_room.BodyExited -= Room_BodyExited;
|
||||
_room.BodyEntered -= Room_BodyEntered;
|
||||
_room.BodyExited -= Room_BodyExited;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bn5egdkg03f5d"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bxs2sugex0p0i" path="res://src/map/UnlockableDoor.cs" id="4_om2kn"]
|
||||
|
||||
[node name="Node3D" type="Node3D"]
|
||||
script = ExtResource("4_om2kn")
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user