Make overworld doors be of unlockable type, add behavior later
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Door : Node3D, IDoor
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Node] public AnimationPlayer AnimationPlayer { get; set; }
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
public void Demolish()
|
||||
{
|
||||
AnimationPlayer.Play("explode");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
|
||||
public interface IDoor : INode3D
|
||||
{
|
||||
}
|
||||
public interface IDoor : INode3D;
|
||||
|
||||
6
Zennysoft.Game.Ma/src/map/UnlockableDoor.cs
Normal file
6
Zennysoft.Game.Ma/src/map/UnlockableDoor.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Godot;
|
||||
|
||||
public partial class UnlockableDoor : Node3D, IDoor
|
||||
{
|
||||
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/map/UnlockableDoor.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/map/UnlockableDoor.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bxs2sugex0p0i
|
||||
@@ -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
@@ -32,6 +32,15 @@ animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
_subresources={
|
||||
"nodes": {
|
||||
"PATH:PROS DOOR": {
|
||||
"mesh_instance/layers": 0
|
||||
},
|
||||
"PATH:PROS DOOR 2": {
|
||||
"mesh_instance/layers": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
|
||||
Reference in New Issue
Block a user