mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-06 18:25:54 +00:00
Spawn markers in level
This commit is contained in:
parent
f7448eb3f5
commit
4b65b25dcd
18 changed files with 335 additions and 197 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Linq;
|
||||
using Cirno.Scripts.Actors._3D;
|
||||
using Cirno.Scripts.Components.FSM._3DPlayer;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Misc;
|
||||
|
|
@ -223,17 +224,27 @@ public partial class GameController : Node
|
|||
|
||||
private Vector3 GetStartPosition()
|
||||
{
|
||||
if (MapResource != null)
|
||||
{
|
||||
if (SpawnMarkers.TryGetValue(EggStartIndex, out var spawnMarker))
|
||||
{
|
||||
var marker = GetNode<Node3D>(spawnMarker);
|
||||
var spawners = GetTree().GetNodesInGroup("SpawnMarkers").Cast<PlayerStartMarker3D>().ToList();
|
||||
|
||||
return marker.Position; // Why position and not globalposition? I have no idea
|
||||
}
|
||||
if (spawners.Count == 0)
|
||||
{
|
||||
return Vector3.Zero;
|
||||
}
|
||||
|
||||
var m = GetNode<Node3D>(SpawnMarkers.First().Value);
|
||||
return m.GlobalPosition;
|
||||
var spawnerToUse = spawners.FirstOrDefault(x => x.MarkerId == EggStartIndex) ?? spawners[0];
|
||||
return spawnerToUse.GlobalPosition;
|
||||
|
||||
// if (MapResource != null)
|
||||
// {
|
||||
// if (SpawnMarkers.TryGetValue(EggStartIndex, out var spawnMarker))
|
||||
// {
|
||||
// var marker = GetNode<Node3D>(spawnMarker);
|
||||
//
|
||||
// return marker.Position; // Why position and not globalposition? I have no idea
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// var m = GetNode<Node3D>(SpawnMarkers.First().Value);
|
||||
// return m.GlobalPosition;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue