Add rescued items spawn to overworld
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Zennysoft.Game.Ma;
|
||||
public interface IEnemyLogic : ILogicBlock<EnemyLogic.State>;
|
||||
|
||||
[Meta, Id("enemy_logic")]
|
||||
[LogicBlock(typeof(State), Diagram = true)]
|
||||
[LogicBlock(typeof(State), Diagram = false)]
|
||||
public partial class EnemyLogic : LogicBlock<EnemyLogic.State>, IEnemyLogic
|
||||
{
|
||||
public override Transition GetInitialState() => To<State.Idle>();
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
@startuml EnemyLogic
|
||||
state "EnemyLogic State" as Zennysoft_Game_Ma_EnemyLogic_State {
|
||||
state "Alive" as Zennysoft_Game_Ma_EnemyLogic_State_Alive {
|
||||
state "Activated" as Zennysoft_Game_Ma_EnemyLogic_State_Activated {
|
||||
state "Attacking" as Zennysoft_Game_Ma_EnemyLogic_State_Attacking
|
||||
state "FollowPlayer" as Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer
|
||||
state "Patrolling" as Zennysoft_Game_Ma_EnemyLogic_State_Patrolling
|
||||
}
|
||||
state "Idle" as Zennysoft_Game_Ma_EnemyLogic_State_Idle
|
||||
}
|
||||
state "Defeated" as Zennysoft_Game_Ma_EnemyLogic_State_Defeated
|
||||
}
|
||||
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_Attacking : AttackTimer
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_Attacking : StartAttacking
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_Defeated : EnemyDefeated
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer : Alerted
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_Idle : StopMoving
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Attacking --> Zennysoft_Game_Ma_EnemyLogic_State_Idle : StopMoving
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer --> Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer : PhysicsTick
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer --> Zennysoft_Game_Ma_EnemyLogic_State_Idle : LostPlayer
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Idle --> Zennysoft_Game_Ma_EnemyLogic_State_Patrolling : StartPatrol
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Patrolling --> Zennysoft_Game_Ma_EnemyLogic_State_Idle : StopMoving
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Patrolling --> Zennysoft_Game_Ma_EnemyLogic_State_Patrolling : PatrolToRandomSpot
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Patrolling --> Zennysoft_Game_Ma_EnemyLogic_State_Patrolling : PhysicsTick
|
||||
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Alive : OnAttackTimer → TakeAction
|
||||
Zennysoft_Game_Ma_EnemyLogic_State_Alive : OnEnemyDefeated → Defeated
|
||||
|
||||
[*] --> Zennysoft_Game_Ma_EnemyLogic_State_Idle
|
||||
@enduml
|
||||
@@ -1,6 +1,5 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Zennysoft.Game.Ma;
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -54,10 +53,4 @@ public partial class RescuedItems : Node3D
|
||||
|
||||
Game.RescuedItems.Items.Clear();
|
||||
}
|
||||
|
||||
public void OnSpawnItemsEntered(Node3D body)
|
||||
{
|
||||
GD.Print("Spawn items");
|
||||
SpawnRescuedItems();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://tc5kdfoggrng"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/item_rescue/RescuedItems.cs" id="1_m08l5"]
|
||||
[ext_resource type="Script" uid="uid://cav0todblih41" path="res://src/item_rescue/RescuedItems.cs" id="1_m08l5"]
|
||||
|
||||
[node name="Rescued Items" type="Node3D"]
|
||||
script = ExtResource("1_m08l5")
|
||||
|
||||
@@ -16,27 +16,30 @@ public partial class Overworld : Node3D, IDungeonFloor
|
||||
|
||||
[Node] private Area3D Exit { get; set; } = default!;
|
||||
|
||||
[Node] private RescuedItems RescuedItems { get; set; } = default!;
|
||||
|
||||
public ImmutableList<IDungeonRoom> Rooms => [];
|
||||
|
||||
public bool FloorIsLoaded { get; set; }
|
||||
|
||||
public void InitializeDungeon()
|
||||
{
|
||||
Show();
|
||||
Exit.AreaEntered += Exit_AreaEntered;
|
||||
FloorIsLoaded = true;
|
||||
Show();
|
||||
Exit.AreaEntered += Exit_AreaEntered;
|
||||
RescuedItems.SpawnRescuedItems();
|
||||
FloorIsLoaded = true;
|
||||
}
|
||||
|
||||
private void Exit_AreaEntered(Area3D area)
|
||||
{
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
}
|
||||
|
||||
public void ExitReached() => Game.FloorExitReached();
|
||||
|
||||
public Transform3D GetPlayerSpawnPoint()
|
||||
{
|
||||
return PlayerSpawnPoint.GlobalTransform;
|
||||
return PlayerSpawnPoint.GlobalTransform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=590 format=4 uid="uid://dvnc26rebk6o0"]
|
||||
[gd_scene load_steps=591 format=4 uid="uid://dvnc26rebk6o0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cuhfkyh3d7noa" path="res://src/map/dungeon/code/Overworld.cs" id="1_5hmt3"]
|
||||
[ext_resource type="Texture2D" uid="uid://co6h8vyi11sl2" path="res://src/map/overworld/Models/Overworld_CLOUD_RINGS_INNER_63.png" id="2_g6b7b"]
|
||||
@@ -140,6 +140,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://cjj6wabswtkk1" path="res://src/npc/Caretaker/Caretaker.tscn" id="80_8isf0"]
|
||||
[ext_resource type="CompressedTexture2DArray" uid="uid://c0kjnbpgaa6bs" path="res://src/map/assets/caustics.png" id="84_r86sn"]
|
||||
[ext_resource type="Texture2D" uid="uid://cbsdc4uthojov" path="res://src/map/assets/waternormal2.jpg" id="85_0u0mt"]
|
||||
[ext_resource type="PackedScene" uid="uid://tc5kdfoggrng" path="res://src/item_rescue/RescuedItems.tscn" id="141_b6pah"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o2o3t"]
|
||||
resource_name = "Material"
|
||||
@@ -17825,5 +17826,11 @@ height = 5.18228
|
||||
cone = true
|
||||
material = SubResource("ShaderMaterial_l0fgw")
|
||||
|
||||
[node name="Item Transport" type="Node3D" parent="."]
|
||||
|
||||
[node name="RescuedItems" parent="Item Transport" instance=ExtResource("141_b6pah")]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -349.863, 9.41853, 131.703)
|
||||
|
||||
[editable path="Actors/Clalo"]
|
||||
[editable path="Actors/Caretaker of Saints"]
|
||||
|
||||
Reference in New Issue
Block a user