forked from finepointcgi/Nakama-cSharp-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameManager.cs
More file actions
32 lines (28 loc) · 794 Bytes
/
GameManager.cs
File metadata and controls
32 lines (28 loc) · 794 Bytes
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
using Godot;
using System;
/// <summary>
/// Coordinates the transition from UI/lobby to gameplay level.
/// </summary>
public partial class GameManager : Node2D
{
/// <summary>
/// Level scene instantiated when the start-game signal is received.
/// </summary>
[Export]
public PackedScene LevelToLoad;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
GetNode<NakamaClient>("UI/Node2D").StartGame += onStartGame;
}
private void onStartGame(string data)
{
var level = LevelToLoad.Instantiate();
GetNode<Control>("UI").Hide();
GetNode<Node2D>("World").AddChild(level);
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}