mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 23:25:54 +00:00
Map Level resources system
This commit is contained in:
parent
1a714dd54d
commit
6e997bd01b
21 changed files with 199 additions and 26 deletions
13
Resources/Maps/Level1.tres
Normal file
13
Resources/Maps/Level1.tres
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[gd_resource type="Resource" script_class="MapResource" load_steps=3 format=3 uid="uid://xtg062tcon1j"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://cn8tu4jct04rp" path="res://Resources/StartData/Pistol_Start.tres" id="1_60p60"]
|
||||
[ext_resource type="Script" uid="uid://quy4d4tgvqfy" path="res://Scripts/Resources/MapResource.cs" id="1_dnrxd"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_dnrxd")
|
||||
MapName = &"Refinery"
|
||||
MapDescription = &"The major fuel refinery"
|
||||
ScenePath = &"uid://bv451a8wgty4u"
|
||||
WeaponsAllowed = true
|
||||
StartData = ExtResource("1_60p60")
|
||||
metadata/_custom_type_script = "uid://quy4d4tgvqfy"
|
||||
13
Resources/Maps/Level2.tres
Normal file
13
Resources/Maps/Level2.tres
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[gd_resource type="Resource" script_class="MapResource" load_steps=3 format=3 uid="uid://mx860r8t37g1"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://cn8tu4jct04rp" path="res://Resources/StartData/Pistol_Start.tres" id="1_k5exw"]
|
||||
[ext_resource type="Script" uid="uid://quy4d4tgvqfy" path="res://Scripts/Resources/MapResource.cs" id="1_os6hh"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_os6hh")
|
||||
MapName = &"Biology Lab"
|
||||
MapDescription = &"Bioresearch goes here"
|
||||
ScenePath = &"uid://6a6tjohypmmb"
|
||||
WeaponsAllowed = true
|
||||
StartData = ExtResource("1_k5exw")
|
||||
metadata/_custom_type_script = "uid://quy4d4tgvqfy"
|
||||
13
Resources/Maps/Level3.tres
Normal file
13
Resources/Maps/Level3.tres
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[gd_resource type="Resource" script_class="MapResource" load_steps=3 format=3 uid="uid://b0xtpdb4by8mm"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://cn8tu4jct04rp" path="res://Resources/StartData/Pistol_Start.tres" id="1_7m0kr"]
|
||||
[ext_resource type="Script" uid="uid://quy4d4tgvqfy" path="res://Scripts/Resources/MapResource.cs" id="1_g1k8s"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_g1k8s")
|
||||
MapName = &"Power plant"
|
||||
MapDescription = &"Nuclear power plant"
|
||||
ScenePath = &"uid://dnpmeebmjgv2t"
|
||||
WeaponsAllowed = true
|
||||
StartData = ExtResource("1_7m0kr")
|
||||
metadata/_custom_type_script = "uid://quy4d4tgvqfy"
|
||||
11
Resources/Maps/Level4.tres
Normal file
11
Resources/Maps/Level4.tres
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_resource type="Resource" script_class="MapResource" load_steps=2 format=3 uid="uid://b6per1p85bqpn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://quy4d4tgvqfy" path="res://Scripts/Resources/MapResource.cs" id="1_eeiar"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_eeiar")
|
||||
MapName = null
|
||||
MapDescription = null
|
||||
ScenePath = null
|
||||
WeaponsAllowed = false
|
||||
metadata/_custom_type_script = "uid://quy4d4tgvqfy"
|
||||
19
Resources/Maps/MapsDatabase.tres
Normal file
19
Resources/Maps/MapsDatabase.tres
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[gd_resource type="Resource" script_class="MapsDatabase" load_steps=7 format=3 uid="uid://blf2ii0j3fqil"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://b4u3cs6ietmow" path="res://Resources/Maps/Tutorial.tres" id="1_jm16h"]
|
||||
[ext_resource type="Script" uid="uid://denacldr388km" path="res://Scripts/Resources/MapsDatabase.cs" id="1_p3u82"]
|
||||
[ext_resource type="Resource" uid="uid://xtg062tcon1j" path="res://Resources/Maps/Level1.tres" id="2_2lffu"]
|
||||
[ext_resource type="Resource" uid="uid://37h0tjja4sns" path="res://Resources/Maps/RebelBase.tres" id="3_b8vvn"]
|
||||
[ext_resource type="Resource" uid="uid://mx860r8t37g1" path="res://Resources/Maps/Level2.tres" id="4_axa7o"]
|
||||
[ext_resource type="Resource" uid="uid://b0xtpdb4by8mm" path="res://Resources/Maps/Level3.tres" id="5_8yujj"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_p3u82")
|
||||
Maps = Dictionary[int, Object]({
|
||||
0: ExtResource("1_jm16h"),
|
||||
1: ExtResource("2_2lffu"),
|
||||
2: ExtResource("3_b8vvn"),
|
||||
3: ExtResource("4_axa7o"),
|
||||
4: ExtResource("5_8yujj")
|
||||
})
|
||||
metadata/_custom_type_script = "uid://denacldr388km"
|
||||
11
Resources/Maps/RebelBase.tres
Normal file
11
Resources/Maps/RebelBase.tres
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_resource type="Resource" script_class="MapResource" load_steps=2 format=3 uid="uid://37h0tjja4sns"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://quy4d4tgvqfy" path="res://Scripts/Resources/MapResource.cs" id="1_lgg4g"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_lgg4g")
|
||||
MapName = &"Rebel Base"
|
||||
MapDescription = &"Based rebels"
|
||||
ScenePath = &"uid://bx31ou6tw3kd1"
|
||||
WeaponsAllowed = false
|
||||
metadata/_custom_type_script = "uid://quy4d4tgvqfy"
|
||||
19
Resources/Maps/Tutorial.tres
Normal file
19
Resources/Maps/Tutorial.tres
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[gd_resource type="Resource" script_class="MapResource" load_steps=4 format=3 uid="uid://b4u3cs6ietmow"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://mja0rk7n2kln" path="res://Scripts/Resources/MapStartDataResource.cs" id="1_3bwtp"]
|
||||
[ext_resource type="Script" uid="uid://quy4d4tgvqfy" path="res://Scripts/Resources/MapResource.cs" id="1_5stb7"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_dpitu"]
|
||||
script = ExtResource("1_3bwtp")
|
||||
EggIndex = 0
|
||||
StartingEquipment = []
|
||||
metadata/_custom_type_script = "uid://mja0rk7n2kln"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_5stb7")
|
||||
MapName = &"Tutorial"
|
||||
MapDescription = &"A VR simulation for training"
|
||||
ScenePath = &"uid://bpnahwxmjgb6t"
|
||||
WeaponsAllowed = true
|
||||
StartData = SubResource("Resource_dpitu")
|
||||
metadata/_custom_type_script = "uid://quy4d4tgvqfy"
|
||||
11
Resources/StartData/Pistol_Start.tres
Normal file
11
Resources/StartData/Pistol_Start.tres
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_resource type="Resource" script_class="MapStartDataResource" load_steps=4 format=3 uid="uid://cn8tu4jct04rp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://mja0rk7n2kln" path="res://Scripts/Resources/MapStartDataResource.cs" id="1_fmydh"]
|
||||
[ext_resource type="Resource" uid="uid://ct1fa2huvy34n" path="res://Resources/Items/Ammo1.tres" id="1_juefn"]
|
||||
[ext_resource type="Resource" uid="uid://cs3ihltcn2166" path="res://Resources/Items/IcicleGun.tres" id="2_xjbmv"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_fmydh")
|
||||
EggIndex = 0
|
||||
StartingEquipment = [ExtResource("1_juefn"), ExtResource("2_xjbmv")]
|
||||
metadata/_custom_type_script = "uid://mja0rk7n2kln"
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=89 format=4 uid="uid://6a6tjohypmmb"]
|
||||
[gd_scene load_steps=90 format=4 uid="uid://6a6tjohypmmb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_t2k72"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_2jsgm"]
|
||||
[ext_resource type="Resource" uid="uid://mx860r8t37g1" path="res://Resources/Maps/Level2.tres" id="2_5t0ab"]
|
||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="3_hw1so"]
|
||||
[ext_resource type="Resource" uid="uid://cs3ihltcn2166" path="res://Resources/Items/IcicleGun.tres" id="3_mqt4u"]
|
||||
[ext_resource type="Script" uid="uid://mja0rk7n2kln" path="res://Scripts/Resources/MapStartDataResource.cs" id="4_s1vkf"]
|
||||
|
|
@ -50,7 +51,7 @@
|
|||
[sub_resource type="Resource" id="Resource_6wo78"]
|
||||
script = ExtResource("4_s1vkf")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("3_hw1so")]([ExtResource("3_mqt4u")])
|
||||
StartingEquipment = [ExtResource("3_mqt4u")]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_5j8ks"]
|
||||
font = ExtResource("9_qo7ri")
|
||||
|
|
@ -322,14 +323,16 @@ _data = {
|
|||
}
|
||||
point_count = 2
|
||||
|
||||
[node name="GameScene" type="Node2D"]
|
||||
[node name="GameScene" type="Node2D" node_paths=PackedStringArray("NavigationTilemap")]
|
||||
script = ExtResource("1_t2k72")
|
||||
MapResource = ExtResource("2_5t0ab")
|
||||
PlayerTemplate = ExtResource("2_2jsgm")
|
||||
SpawnMarkers = Dictionary[int, NodePath]({
|
||||
0: NodePath("PlayerStartPosition")
|
||||
})
|
||||
StartingEquipment = Array[ExtResource("3_hw1so")]([ExtResource("3_mqt4u")])
|
||||
MapStartData = SubResource("Resource_6wo78")
|
||||
NavigationTilemap = NodePath("Tilemaps/Floor")
|
||||
|
||||
[node name="Tilemaps" type="Node2D" parent="."]
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=13 format=4 uid="uid://8ppagfume46d"]
|
||||
[gd_scene load_steps=14 format=4 uid="uid://8ppagfume46d"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_hx5ph"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_r7f28"]
|
||||
[ext_resource type="Resource" uid="uid://b6per1p85bqpn" path="res://Resources/Maps/Level4.tres" id="2_wvpxs"]
|
||||
[ext_resource type="Script" uid="uid://mja0rk7n2kln" path="res://Scripts/Resources/MapStartDataResource.cs" id="4_4wg3n"]
|
||||
[ext_resource type="TileSet" uid="uid://6k28roiljylj" path="res://Tilesets/factory_tileset.tres" id="5_e10oj"]
|
||||
[ext_resource type="Script" uid="uid://krean0uywtms" path="res://Scripts/TilemapAvoidance.cs" id="6_4t7ma"]
|
||||
|
|
@ -20,6 +21,7 @@ StartingEquipment = []
|
|||
[node name="GameScene" type="Node2D"]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_hx5ph")
|
||||
MapResource = ExtResource("2_wvpxs")
|
||||
PlayerTemplate = ExtResource("2_r7f28")
|
||||
SpawnMarkers = Dictionary[int, NodePath]({
|
||||
0: NodePath("PlayerStartPosition")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=49 format=4 uid="uid://bpnahwxmjgb6t"]
|
||||
[gd_scene load_steps=51 format=4 uid="uid://bpnahwxmjgb6t"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_qxyfr"]
|
||||
[ext_resource type="Resource" uid="uid://b4u3cs6ietmow" path="res://Resources/Maps/Tutorial.tres" id="2_0xhda"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_ajkcn"]
|
||||
[ext_resource type="Script" uid="uid://mja0rk7n2kln" path="res://Scripts/Resources/MapStartDataResource.cs" id="4_g48r8"]
|
||||
[ext_resource type="TileSet" uid="uid://6k28roiljylj" path="res://Tilesets/factory_tileset.tres" id="5_2m462"]
|
||||
|
|
@ -20,6 +21,7 @@
|
|||
[ext_resource type="Script" uid="uid://bwox5lmgiijcs" path="res://Scripts/Resources/Events/ActivateEvent.cs" id="15_l8ewr"]
|
||||
[ext_resource type="PackedScene" uid="uid://ca6befbx0nurt" path="res://Scenes/Interactable/ScriptableEnabledAlarmTrigger.tscn" id="15_qub1o"]
|
||||
[ext_resource type="PackedScene" uid="uid://bc64lr3vlwchq" path="res://Scenes/Door_Vertical.tscn" id="16_wk6n2"]
|
||||
[ext_resource type="Script" uid="uid://b5fesrd4lv8t1" path="res://Scripts/Resources/Events/EventResource.cs" id="16_xlcit"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnbtou2fklyvp" path="res://Scenes/Actors/alarm_sign.tscn" id="17_lq462"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0133vafvobxf" path="res://Scenes/Interactable/ScriptableDisabledAlarmTrigger.tscn" id="17_wxxk5"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8lgk4wnyi1e6" path="res://Scenes/Actors/HealthStation.tscn" id="20_d20if"]
|
||||
|
|
@ -114,6 +116,7 @@ WaitForCompletion = true
|
|||
[node name="GameScene" type="Node2D"]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_qxyfr")
|
||||
MapResource = ExtResource("2_0xhda")
|
||||
PlayerTemplate = ExtResource("2_ajkcn")
|
||||
SpawnMarkers = Dictionary[int, NodePath]({
|
||||
0: NodePath("PlayerStartPosition"),
|
||||
|
|
@ -187,10 +190,10 @@ position = Vector2(612, -56)
|
|||
State = 1
|
||||
|
||||
[node name="OnAlarmEnabled" parent="Parallax2D/Tilemaps/Actors/VerticalDoor" instance=ExtResource("15_qub1o")]
|
||||
Events = [SubResource("Resource_3vy3u")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_3vy3u")])
|
||||
|
||||
[node name="OnAlarmDisabled" parent="Parallax2D/Tilemaps/Actors/VerticalDoor" instance=ExtResource("17_wxxk5")]
|
||||
Events = [SubResource("Resource_wvpi7")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_wvpi7")])
|
||||
|
||||
[node name="AlarmBox2" parent="Parallax2D/Tilemaps/Actors" instance=ExtResource("17_lq462")]
|
||||
position = Vector2(440, -121)
|
||||
|
|
@ -205,35 +208,35 @@ position = Vector2(72, 8)
|
|||
|
||||
[node name="Intro" parent="Parallax2D/Tilemaps/Actors/TutorialDialogueTriggers" instance=ExtResource("21_t630o")]
|
||||
position = Vector2(128, 351)
|
||||
Events = [SubResource("Resource_ierdo")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_ierdo")])
|
||||
|
||||
[node name="Switch" parent="Parallax2D/Tilemaps/Actors/TutorialDialogueTriggers" instance=ExtResource("21_t630o")]
|
||||
position = Vector2(234, 287)
|
||||
Events = [SubResource("Resource_8yymf")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_8yymf")])
|
||||
|
||||
[node name="Weapon" parent="Parallax2D/Tilemaps/Actors/TutorialDialogueTriggers" instance=ExtResource("21_t630o")]
|
||||
position = Vector2(128, 176)
|
||||
Events = [SubResource("Resource_dbad5"), SubResource("Resource_f3qhg"), SubResource("Resource_ulu4a")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_dbad5"), SubResource("Resource_f3qhg"), SubResource("Resource_ulu4a")])
|
||||
|
||||
[node name="Barrels" parent="Parallax2D/Tilemaps/Actors/TutorialDialogueTriggers" instance=ExtResource("21_t630o")]
|
||||
position = Vector2(231, 40)
|
||||
Events = [SubResource("Resource_35vjh")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_35vjh")])
|
||||
|
||||
[node name="Teleporter1" parent="Parallax2D/Tilemaps/Actors/TutorialDialogueTriggers" instance=ExtResource("21_t630o")]
|
||||
position = Vector2(259, -41)
|
||||
Events = [SubResource("Resource_p02qj")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_p02qj")])
|
||||
|
||||
[node name="Teleporter2" parent="Parallax2D/Tilemaps/Actors/TutorialDialogueTriggers" instance=ExtResource("21_t630o")]
|
||||
position = Vector2(345, -40)
|
||||
Events = [SubResource("Resource_t62sp")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_t62sp")])
|
||||
|
||||
[node name="Repeater" parent="Parallax2D/Tilemaps/Actors/TutorialDialogueTriggers" instance=ExtResource("21_t630o")]
|
||||
position = Vector2(634, -40)
|
||||
Events = [SubResource("Resource_m71ef")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_m71ef")])
|
||||
|
||||
[node name="Cameras" parent="Parallax2D/Tilemaps/Actors/TutorialDialogueTriggers" instance=ExtResource("21_t630o")]
|
||||
position = Vector2(433, -41)
|
||||
Events = [SubResource("Resource_54a43"), SubResource("Resource_8phm4"), SubResource("Resource_7uxja")]
|
||||
Events = Array[ExtResource("16_xlcit")]([SubResource("Resource_54a43"), SubResource("Resource_8phm4"), SubResource("Resource_7uxja")])
|
||||
|
||||
[node name="VerticalDoor2" parent="Parallax2D/Tilemaps/Actors" instance=ExtResource("16_wk6n2")]
|
||||
position = Vector2(916, -56)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=146 format=4 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=147 format=4 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_ksslq"]
|
||||
[ext_resource type="Resource" uid="uid://xtg062tcon1j" path="res://Resources/Maps/Level1.tres" id="2_orkt3"]
|
||||
[ext_resource type="TileSet" uid="uid://6k28roiljylj" path="res://Tilesets/factory_tileset.tres" id="3_kgs2x"]
|
||||
[ext_resource type="Script" uid="uid://krean0uywtms" path="res://Scripts/TilemapAvoidance.cs" id="4_p1fl3"]
|
||||
[ext_resource type="PackedScene" uid="uid://rp4jhx0tuh24" path="res://Scenes/fragola.tscn" id="4_s7wq6"]
|
||||
|
|
@ -299,6 +300,7 @@ metadata/_custom_type_script = "uid://bwox5lmgiijcs"
|
|||
[node name="GameScene" type="Node2D" node_paths=PackedStringArray("NavigationTilemap", "PlayerParentNode")]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_8tmoj")
|
||||
MapResource = ExtResource("2_orkt3")
|
||||
PlayerTemplate = ExtResource("2_ksslq")
|
||||
SpawnMarkers = Dictionary[int, NodePath]({
|
||||
0: NodePath("Parallax2D/Factory Tilemaps/LevelProps/StartPosition"),
|
||||
|
|
@ -1126,7 +1128,7 @@ position = Vector2(-2000, -736)
|
|||
[node name="ControlPad8" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")]
|
||||
position = Vector2(-2027, -735)
|
||||
Targets = [NodePath("../HorizontalForceField")]
|
||||
Requirements = Array[ExtResource("6_8tdlb")]([ExtResource("84_ma1ta")])
|
||||
Requirements = [ExtResource("84_ma1ta")]
|
||||
|
||||
[node name="Ammo6" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("34_17pjh")]
|
||||
position = Vector2(-872, -220)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Components.FSM;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Activables;
|
||||
|
|
@ -9,12 +10,13 @@ namespace Cirno.Scripts.Activables;
|
|||
public partial class LevelTeleporter : Teleporter
|
||||
{
|
||||
[Export] public string LevelPath { get; private set; }
|
||||
[Export] public MapResource Map { get; private set; }
|
||||
|
||||
[Export] public bool SaveInventory { get; private set; }
|
||||
|
||||
protected override async Task Teleport(IStateMachine<PlayerState, CharacterBody2D> player)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(LevelPath)) return;
|
||||
if (string.IsNullOrWhiteSpace(LevelPath) && Map is null) return;
|
||||
//player.RequestMovementDisable(true);
|
||||
player.SetState(PlayerState.Cutscene);
|
||||
|
||||
|
|
@ -34,6 +36,14 @@ public partial class LevelTeleporter : Teleporter
|
|||
GlobalState.Instance.SessionSettings.Items = InventoryManager.Instance.Save();
|
||||
}
|
||||
|
||||
GlobalState.Instance.GotoScene(LevelPath);
|
||||
if (!string.IsNullOrWhiteSpace(LevelPath))
|
||||
{
|
||||
GlobalState.Instance.GotoScene(LevelPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalState.Instance.GotoScene(Map);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +23,8 @@ public partial class GameManager : Node2D
|
|||
|
||||
public Vector2? PlayerPosition => _player?.GlobalPosition ?? null;
|
||||
|
||||
[Export] public MapResource MapResource { get; private set; }
|
||||
|
||||
[Export] public PackedScene PlayerTemplate { get; set; }
|
||||
|
||||
[Export] public Dictionary<int, NodePath> SpawnMarkers { get; private set; } = new();
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ public partial class GlobalState : Node
|
|||
public static GlobalState Instance { get; private set; }
|
||||
public static SessionSettings Session => GlobalState.Instance.SessionSettings;
|
||||
public Node CurrentScene { get; set; }
|
||||
public string CurrentSceneId { get; private set; }
|
||||
|
||||
private ColorRect _fader { get; set; }
|
||||
|
||||
public SessionSettings SessionSettings { get; set; } = new();
|
||||
|
|
@ -24,6 +22,10 @@ public partial class GlobalState : Node
|
|||
private readonly StringName _menuMouseTexturePath = "uid://d3oxwik1uoe4j";
|
||||
private readonly StringName _reticuleMouseTexturePath = "uid://8nns6w0skiy3";
|
||||
|
||||
private readonly StringName _mapsDatabaseResource = "uid://blf2ii0j3fqil";
|
||||
|
||||
private MapsDatabase _mapsDatabase;
|
||||
|
||||
private Texture2D _menuMouseTexture;
|
||||
private Image _menuMouseImage;
|
||||
|
||||
|
|
@ -33,6 +35,8 @@ public partial class GlobalState : Node
|
|||
|
||||
this.ProcessMode = ProcessModeEnum.Always;
|
||||
|
||||
_mapsDatabase = ResourceLoader.Load<MapsDatabase>(_mapsDatabaseResource);
|
||||
|
||||
Viewport root = GetTree().Root;
|
||||
// Using a negative index counts from the end, so this gets the last child node of `root`.
|
||||
CurrentScene = root.GetChild(-1);
|
||||
|
|
@ -96,6 +100,12 @@ public partial class GlobalState : Node
|
|||
//CallDeferred(MethodName.DeferredGotoScene, path, startData);
|
||||
}
|
||||
|
||||
public void GotoScene(MapResource map)
|
||||
{
|
||||
this.SessionSettings.LevelNumber = map.LevelId;
|
||||
GoToScene(map.ScenePath.ToString(), map.StartData);
|
||||
}
|
||||
|
||||
private void DeferredGotoScene(string path, MapStartDataResource startData = null)
|
||||
{
|
||||
// It is now safe to remove the current scene.
|
||||
|
|
@ -107,7 +117,6 @@ public partial class GlobalState : Node
|
|||
|
||||
// Load a new scene.
|
||||
var nextScene = GD.Load<PackedScene>(path);
|
||||
CurrentSceneId = nextScene.GetSceneUniqueId();
|
||||
|
||||
// Instance the new scene.
|
||||
CurrentScene = nextScene.Instantiate();
|
||||
|
|
@ -196,7 +205,7 @@ public partial class GlobalState : Node
|
|||
var serializedSavedata = new Godot.Collections.Dictionary<string, Variant>()
|
||||
{
|
||||
{ "Items", items },
|
||||
{ "Level", CurrentSceneId }
|
||||
{ "Level", SessionSettings.LevelNumber }
|
||||
};
|
||||
|
||||
var saveFile = FileAccess.Open("user://savegame.save", FileAccess.ModeFlags.Write);
|
||||
|
|
@ -226,4 +235,6 @@ public partial class GlobalState : Node
|
|||
{
|
||||
GotoScene(CurrentScene.GetSceneFilePath());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
14
Scripts/Resources/MapResource.cs
Normal file
14
Scripts/Resources/MapResource.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class MapResource : Resource
|
||||
{
|
||||
[Export] public int LevelId { get; set; }
|
||||
[Export] public StringName MapName { get; set; }
|
||||
[Export] public StringName MapDescription { get; set; }
|
||||
[Export] public StringName ScenePath { get; set; }
|
||||
[Export] public bool WeaponsAllowed { get; set; }
|
||||
[Export] public MapStartDataResource StartData { get; set; }
|
||||
}
|
||||
1
Scripts/Resources/MapResource.cs.uid
Normal file
1
Scripts/Resources/MapResource.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://quy4d4tgvqfy
|
||||
10
Scripts/Resources/MapsDatabase.cs
Normal file
10
Scripts/Resources/MapsDatabase.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Resources;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class MapsDatabase : Resource
|
||||
{
|
||||
[Export] public Array<MapResource> Maps { get; set; }
|
||||
}
|
||||
1
Scripts/Resources/MapsDatabase.cs.uid
Normal file
1
Scripts/Resources/MapsDatabase.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://denacldr388km
|
||||
|
|
@ -9,6 +9,8 @@ public class SessionSettings
|
|||
public bool GodMode { get; set; } = false;
|
||||
|
||||
public Godot.Collections.Dictionary<string, int> Items { get; set; } = new();
|
||||
|
||||
public int LevelNumber { get; set; } = 0;
|
||||
|
||||
public float Health { get; set; }
|
||||
public float Shield { get; set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue