-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSceneManager.cs
34 lines (31 loc) · 841 Bytes
/
SceneManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Godot;
using System;
using System.Data.Common;
public partial class SceneManager : Node2D
{
[Export]
private PackedScene playerScene;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
int index = 0;
foreach (var item in GameManager.Players)
{
Player currentPlayer = playerScene.Instantiate<Player>();
currentPlayer.Name = item.Id.ToString();
currentPlayer.SetUpPlayer(item.Name);
AddChild(currentPlayer);
foreach (Node2D spawnPoint in GetTree().GetNodesInGroup("PlayerSpawnPoints"))
{
if(int.Parse(spawnPoint.Name) == index){
currentPlayer.GlobalPosition = spawnPoint.GlobalPosition;
}
}
index ++;
}
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}