Fix annoying issue with LookAt
Add jump scare
This commit is contained in:
@@ -228,7 +228,7 @@ public abstract partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLo
|
||||
var lookDirection = GlobalPosition - targetPosition;
|
||||
var look = new Vector3(lookDirection.X, GlobalPosition.Y, lookDirection.Z);
|
||||
if (!look.IsEqualApprox(GlobalPosition))
|
||||
LookAt(look, Vector3.Up);
|
||||
LookAt(look - new Vector3(0.001f, 0.001f, 0.001f), Vector3.Up);
|
||||
}
|
||||
|
||||
protected void SetTarget(Vector3 targetPosition) => TargetPosition = targetPosition;
|
||||
|
||||
@@ -42,11 +42,11 @@ script = ExtResource("1_xsluo")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 2.18615, 0)
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.74339, 0)
|
||||
shape = SubResource("CapsuleShape3D_cwfph")
|
||||
|
||||
[node name="Collision" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.18615, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.74339, 0)
|
||||
|
||||
[node name="Collision" type="Area3D" parent="Collision"]
|
||||
collision_layer = 2048
|
||||
@@ -84,13 +84,13 @@ collision_mask = 34
|
||||
shape = SubResource("CylinderShape3D_drfkj")
|
||||
|
||||
[node name="Visual" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.657239, 0)
|
||||
|
||||
[node name="EnemyModelView" parent="Visual" instance=ExtResource("4_o3b7p")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="Components" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.18615, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.74339, 0)
|
||||
|
||||
[node name="PatrolBehavior" parent="Components" instance=ExtResource("4_drfkj")]
|
||||
unique_name_in_owner = true
|
||||
@@ -109,9 +109,10 @@ _acquireTargetTime = 2.0
|
||||
unique_name_in_owner = true
|
||||
avoidance_enabled = true
|
||||
radius = 1.0
|
||||
debug_enabled = true
|
||||
|
||||
[node name="SFX" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.18615, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.74339, 0)
|
||||
|
||||
[node name="AbsorbSFX" type="AudioStreamPlayer3D" parent="SFX"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -35,7 +35,7 @@ script = ExtResource("1_lb5oy")
|
||||
|
||||
[node name="LineOfSight" type="Area3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 2.27161, 0)
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.71715, 0)
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
|
||||
@@ -45,22 +45,23 @@ shape = SubResource("CylinderShape3D_jbgmx")
|
||||
|
||||
[node name="Raycast" type="RayCast3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 2.27161, 0)
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.71715, 0)
|
||||
target_position = Vector3(0, 0, -5)
|
||||
collision_mask = 3
|
||||
debug_shape_custom_color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.0824751, 2.48407, 0)
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.0824751, 1.92961, 0)
|
||||
shape = SubResource("CapsuleShape3D_0h5s2")
|
||||
|
||||
[node name="EnemyModelView" parent="." instance=ExtResource("3_wrps7")]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0799522, 1.36029, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0799522, 0.805832, 0)
|
||||
|
||||
[node name="PlayerDetector" type="Area3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.27161, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.71715, 0)
|
||||
collision_layer = 0
|
||||
collision_mask = 34
|
||||
|
||||
@@ -68,7 +69,7 @@ collision_mask = 34
|
||||
shape = SubResource("CylinderShape3D_eek1b")
|
||||
|
||||
[node name="Collision" type="Area3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.27161, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.71715, 0)
|
||||
collision_layer = 2048
|
||||
collision_mask = 0
|
||||
|
||||
@@ -77,7 +78,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.120117, 0.221246, 0)
|
||||
shape = SubResource("SphereShape3D_wrps7")
|
||||
|
||||
[node name="Components" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.27161, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.71715, 0)
|
||||
|
||||
[node name="PatrolBehavior" parent="Components" instance=ExtResource("5_fkx5j")]
|
||||
unique_name_in_owner = true
|
||||
@@ -96,7 +97,7 @@ avoidance_enabled = true
|
||||
radius = 1.0
|
||||
|
||||
[node name="HitSounds" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.27161, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.71715, 0)
|
||||
|
||||
[node name="AbsorbSFX" type="AudioStreamPlayer3D" parent="HitSounds"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -1257,7 +1257,7 @@ autoplay = true
|
||||
bus = &"SFX"
|
||||
|
||||
[node name="Shadow" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(0.38, 0, 0, 0, -1.66103e-08, 0.38, 0, -0.38, -1.66103e-08, 0.00393164, 0.0219133, 0.0077811)
|
||||
transform = Transform3D(0.38, 0, 0, 0, -1.66103e-08, 0.38, 0, -0.38, -1.66103e-08, 0.00393164, -0.728023, 0.0077811)
|
||||
transparency = 0.1
|
||||
cast_shadow = 0
|
||||
modulate = Color(1, 1, 1, 0.591)
|
||||
|
||||
@@ -42,4 +42,36 @@ public partial class DungeonFloorNode : FloorNode
|
||||
public float ShieldOfHeaven { get; set; }
|
||||
[Export]
|
||||
public float GoldSproingy { get; set; }
|
||||
|
||||
[ExportGroup("True Route Spawn Rates")]
|
||||
[Export]
|
||||
public float TrueSproingy { get; set; }
|
||||
[Export]
|
||||
public float TrueMichael { get; set; }
|
||||
[Export]
|
||||
public float TrueFilthEater { get; set; }
|
||||
[Export]
|
||||
public float TrueSara { get; set; }
|
||||
[Export]
|
||||
public float TrueBallos { get; set; }
|
||||
[Export]
|
||||
public float TrueChariot { get; set; }
|
||||
[Export]
|
||||
public float TrueChinthe { get; set; }
|
||||
[Export]
|
||||
public float TrueGreenAmbassador { get; set; }
|
||||
[Export]
|
||||
public float TrueRedAmbassador { get; set; }
|
||||
[Export]
|
||||
public float TrueSteelAmbassador { get; set; }
|
||||
[Export]
|
||||
public float TrueAgniDemon { get; set; }
|
||||
[Export]
|
||||
public float TrueAqueosDemon { get; set; }
|
||||
[Export]
|
||||
public float TruePalan { get; set; }
|
||||
[Export]
|
||||
public float TrueShieldOfHeaven { get; set; }
|
||||
[Export]
|
||||
public float TrueGoldSproingy { get; set; }
|
||||
}
|
||||
|
||||
@@ -87,141 +87,50 @@ FloorName = 1
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor01"
|
||||
FloorOdds = Array[float]([0.33, 0.33, 0.33])
|
||||
Sproingy = null
|
||||
Michael = 1.0
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
Sproingy = 0.5
|
||||
Michael = 0.5
|
||||
|
||||
[node name="Floor02" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor02"
|
||||
FloorOdds = Array[float]([0.5, 0.5])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
Sproingy = 0.5
|
||||
Michael = 0.5
|
||||
GoldSproingy = 0.05
|
||||
TrueRedAmbassador = 0.3
|
||||
|
||||
[node name="Floor03" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor03"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
Sproingy = 0.25
|
||||
Michael = 0.5
|
||||
FilthEater = 0.5
|
||||
TrueRedAmbassador = 0.3
|
||||
|
||||
[node name="Floor04" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor04"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Floor05" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor05"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Floor06" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor06"
|
||||
FloorOdds = Array[float]([0.2, 0.8, 0.5, 0.1])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Floor07" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor07"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Boss Floor 1" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("3_v14r0")
|
||||
@@ -232,120 +141,36 @@ script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor09"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Floor11" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor11"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Floor12" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor12"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Floor13" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor13"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Floor14" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor14"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Floor15" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor15"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
Michael = null
|
||||
FilthEater = null
|
||||
Sara = null
|
||||
Ballos = null
|
||||
Chariot = null
|
||||
Chinthe = null
|
||||
GreenAmbassador = null
|
||||
RedAmbassador = null
|
||||
SteelAmbassador = null
|
||||
AgniDemon = null
|
||||
AqueosDemon = null
|
||||
Palan = null
|
||||
ShieldOfHeaven = null
|
||||
GoldSproingy = null
|
||||
|
||||
[node name="Boss Floor 2" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("3_v14r0")
|
||||
|
||||
@@ -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;
|
||||
MinimapShadow.Hide();
|
||||
_isPlayerInRoom = true;
|
||||
_playerDiscoveredRoom = true;
|
||||
MinimapShadow.Hide();
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
_room.BodyEntered -= Room_BodyEntered;
|
||||
_room.BodyExited -= Room_BodyExited;
|
||||
_room.BodyEntered -= Room_BodyEntered;
|
||||
_room.BodyExited -= Room_BodyExited;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Zennysoft.Game.Ma/src/map/dungeon/code/JumpScareRoom.cs
Normal file
31
Zennysoft.Game.Ma/src/map/dungeon/code/JumpScareRoom.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class JumpScareRoom : DungeonRoom
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency]
|
||||
public IPlayer Player => this.DependOn<IPlayer>();
|
||||
|
||||
[Node] public Area3D JumpScare { get; set; }
|
||||
|
||||
[Export] public Resource Dialogue { get; set; } = default!;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
JumpScare.AreaEntered += JumpScare_AreaEntered;
|
||||
}
|
||||
|
||||
private void JumpScare_AreaEntered(Area3D area)
|
||||
{
|
||||
Player.PlayJumpScareAnimation();
|
||||
DialogueController.ShowDialogue(Dialogue, "general");
|
||||
JumpScare.SetMonitoring(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://cwqgealqc3w4
|
||||
@@ -19,57 +19,54 @@ public partial class MonsterRoom : DungeonRoom
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
SpawnItems();
|
||||
SpawnItems();
|
||||
}
|
||||
|
||||
public void SpawnEnemies(Godot.Collections.Dictionary<EnemyType, float> enemyInfo)
|
||||
{
|
||||
if (enemyInfo == null || !enemyInfo.Any(x => x.Value > 0))
|
||||
return;
|
||||
if (enemyInfo == null || !enemyInfo.Any(x => x.Value > 0))
|
||||
return;
|
||||
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var enemySpawnPoints = EnemySpawnPoints.GetChildren();
|
||||
var numberOfEnemiesToSpawn = rng.RandiRange(1, enemySpawnPoints.Count);
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var enemySpawnPoints = EnemySpawnPoints.GetChildren();
|
||||
var numberOfEnemiesToSpawn = rng.RandiRange(1, enemySpawnPoints.Count);
|
||||
|
||||
foreach (var spawnPoint in enemySpawnPoints.Cast<Marker3D>())
|
||||
{
|
||||
if (numberOfEnemiesToSpawn <= 0)
|
||||
break;
|
||||
numberOfEnemiesToSpawn--;
|
||||
foreach (var spawnPoint in enemySpawnPoints.Cast<Marker3D>())
|
||||
{
|
||||
if (numberOfEnemiesToSpawn <= 0)
|
||||
break;
|
||||
numberOfEnemiesToSpawn--;
|
||||
|
||||
var index = rng.RandWeighted([.. enemyInfo.Values]);
|
||||
var selectedEnemy = enemyInfo.ElementAt((int)index);
|
||||
var instantiatedEnemy = EnemyTypeToEnemyConverter.Convert(selectedEnemy.Key);
|
||||
instantiatedEnemy.Position = new Vector3(spawnPoint.Position.X, 0f, spawnPoint.Position.Z);
|
||||
AddChild(instantiatedEnemy);
|
||||
}
|
||||
var index = rng.RandWeighted([.. enemyInfo.Values]);
|
||||
var selectedEnemy = enemyInfo.ElementAt((int)index);
|
||||
var instantiatedEnemy = EnemyTypeToEnemyConverter.Convert(selectedEnemy.Key);
|
||||
instantiatedEnemy.Position = new Vector3(spawnPoint.Position.X, 0f, spawnPoint.Position.Z);
|
||||
AddChild(instantiatedEnemy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// RegularFlame.GetChildren();
|
||||
//
|
||||
private void SpawnItems()
|
||||
{
|
||||
if (ItemSpawnPoints == null)
|
||||
return;
|
||||
if (ItemSpawnPoints == null)
|
||||
return;
|
||||
|
||||
var itemSpawnPoints = ItemSpawnPoints.GetChildren();
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var numberOfItemsToSpawn = rng.RandiRange(1, itemSpawnPoints.Count);
|
||||
itemSpawnPoints.Shuffle();
|
||||
var database = ItemDatabase.Instance;
|
||||
foreach (var spawnPoint in itemSpawnPoints.Cast<Marker3D>())
|
||||
{
|
||||
if (numberOfItemsToSpawn <= 0)
|
||||
break;
|
||||
numberOfItemsToSpawn--;
|
||||
var itemSpawnPoints = ItemSpawnPoints.GetChildren();
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var numberOfItemsToSpawn = rng.RandiRange(1, itemSpawnPoints.Count);
|
||||
itemSpawnPoints.Shuffle();
|
||||
var database = ItemDatabase.Instance;
|
||||
foreach (var spawnPoint in itemSpawnPoints.Cast<Marker3D>())
|
||||
{
|
||||
if (numberOfItemsToSpawn <= 0)
|
||||
break;
|
||||
numberOfItemsToSpawn--;
|
||||
|
||||
var selectedItem = database.PickItem<InventoryItem>();
|
||||
var duplicated = selectedItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
|
||||
duplicated.Position = new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z);
|
||||
AddChild(duplicated);
|
||||
}
|
||||
var selectedItem = database.PickItem<InventoryItem>();
|
||||
var duplicated = selectedItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
|
||||
duplicated.Position = new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z);
|
||||
AddChild(duplicated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://dhkbvos11tkdw"]
|
||||
[gd_scene load_steps=19 format=3 uid="uid://dhkbvos11tkdw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bccyfmj8ikewh" path="res://src/map/dungeon/code/SpecialRoom.cs" id="1_5m2h2"]
|
||||
[ext_resource type="Script" uid="uid://cwqgealqc3w4" path="res://src/map/dungeon/code/JumpScareRoom.cs" id="1_unlia"]
|
||||
[ext_resource type="Resource" uid="uid://iapl7k07fwt0" path="res://src/npc/Proscenium/JumpScare.dialogue" id="2_fgt65"]
|
||||
[ext_resource type="PackedScene" uid="uid://bc7ubbvnx0jdo" path="res://src/map/dungeon/models/Area 1/Jumpscare/A1-Jumpscare.glb" id="2_umqhi"]
|
||||
[ext_resource type="Texture2D" uid="uid://dw50ys561j8no" path="res://src/map/assets/DUST_1.png" id="5_5m2h2"]
|
||||
|
||||
@@ -31,6 +32,9 @@ albedo_color = Color(0, 0, 0, 1)
|
||||
material = SubResource("StandardMaterial3D_unlia")
|
||||
size = Vector2(20.5, 19)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_unlia"]
|
||||
size = Vector3(6.43689, 5.99969, 4.5957)
|
||||
|
||||
[sub_resource type="Curve" id="Curve_umqhi"]
|
||||
_limits = [-2.0, 2.0, 0.0, 1.0]
|
||||
_data = [Vector2(0.00358423, 0.230769), 0.0, 0.0, 0, 0, Vector2(0.982079, -1.03846), 0.0, 0.0, 0, 0]
|
||||
@@ -68,7 +72,8 @@ subdivide_depth = 1
|
||||
|
||||
[node name="JumpScareRoom" type="Node3D"]
|
||||
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -8.509, -3.41755, -8.60795)
|
||||
script = ExtResource("1_5m2h2")
|
||||
script = ExtResource("1_unlia")
|
||||
Dialogue = ExtResource("2_fgt65")
|
||||
|
||||
[node name="Model" type="Node3D" parent="."]
|
||||
|
||||
@@ -129,6 +134,15 @@ layers = 2
|
||||
sorting_offset = 100.0
|
||||
mesh = SubResource("PlaneMesh_unlia")
|
||||
|
||||
[node name="JumpScare" type="Area3D" parent="Room"]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 0
|
||||
collision_mask = 64
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Room/JumpScare"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.112, 4.54046, 4.67285)
|
||||
shape = SubResource("BoxShape3D_unlia")
|
||||
|
||||
[node name="Lights" type="Node3D" parent="."]
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="Lights"]
|
||||
|
||||
2
Zennysoft.Game.Ma/src/npc/Proscenium/JumpScare.dialogue
Normal file
2
Zennysoft.Game.Ma/src/npc/Proscenium/JumpScare.dialogue
Normal file
@@ -0,0 +1,2 @@
|
||||
~ general
|
||||
boo brother
|
||||
@@ -0,0 +1,16 @@
|
||||
[remap]
|
||||
|
||||
importer="dialogue_manager"
|
||||
importer_version=15
|
||||
type="Resource"
|
||||
uid="uid://iapl7k07fwt0"
|
||||
path="res://.godot/imported/JumpScare.dialogue-d1f0414aee29e70316e2fe293c82adb0.tres"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/npc/Proscenium/JumpScare.dialogue"
|
||||
dest_files=["res://.godot/imported/JumpScare.dialogue-d1f0414aee29e70316e2fe293c82adb0.tres"]
|
||||
|
||||
[params]
|
||||
|
||||
defaults=true
|
||||
@@ -231,6 +231,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
ExperiencePointsComponent.LevelUp();
|
||||
}
|
||||
|
||||
public void PlayJumpScareAnimation() => PlayerFXAnimations.Play("jump_scare");
|
||||
|
||||
public void Die()
|
||||
{
|
||||
PlayerFXAnimations.Play("death");
|
||||
|
||||
@@ -457,7 +457,7 @@ tracks/1/keys = {
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wvcio"]
|
||||
resource_name = "test_animation"
|
||||
resource_name = "jump_scare"
|
||||
length = 5.0005
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
@@ -492,8 +492,8 @@ _data = {
|
||||
&"RESET": SubResource("Animation_jtmj1"),
|
||||
&"death": SubResource("Animation_es4xk"),
|
||||
&"hit_wall": SubResource("Animation_ebyyx"),
|
||||
&"normal_attack": SubResource("Animation_v5qoq"),
|
||||
&"test_animation": SubResource("Animation_wvcio")
|
||||
&"jump_scare": SubResource("Animation_wvcio"),
|
||||
&"normal_attack": SubResource("Animation_v5qoq")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_v3vjx"]
|
||||
|
||||
Reference in New Issue
Block a user