SupaLidlGame/Scenes/Map.cs

73 lines
1.3 KiB
C#
Raw Normal View History

2023-03-26 10:53:45 -07:00
using Godot;
2023-06-03 18:21:46 -07:00
namespace SupaLidlGame.Scenes;
public partial class Map : TileMap
2023-03-26 10:53:45 -07:00
{
2023-06-03 18:21:46 -07:00
[Export]
public Node2D Entities { get; set; }
2023-03-26 10:53:45 -07:00
2023-06-03 18:21:46 -07:00
[Export]
public Node2D Areas { get; set; }
2023-03-26 10:53:45 -07:00
2023-06-03 18:21:46 -07:00
[Export]
public Node2D Spawners { get; set; }
2023-03-26 10:53:45 -07:00
2023-06-03 18:21:46 -07:00
[Export]
public Vector2 CameraLowerBound { get; set; }
2023-03-26 10:53:45 -07:00
2023-06-03 18:21:46 -07:00
[Export]
public Vector2 CameraUpperBound { get; set; }
2023-03-26 10:53:45 -07:00
2023-07-31 01:12:47 -07:00
[Export]
public Color ClearColor { get; set; }
[Export]
public string AreaName { get; set; }
[Export]
public string MapName { get; set; }
2023-06-03 18:21:46 -07:00
private bool _active;
2023-03-26 10:53:45 -07:00
2023-06-03 18:21:46 -07:00
public bool Active
{
get
2023-03-26 10:53:45 -07:00
{
2023-06-03 18:21:46 -07:00
return _active;
2023-03-26 10:53:45 -07:00
}
2023-06-03 18:21:46 -07:00
set
2023-03-26 10:53:45 -07:00
{
2023-07-13 23:46:58 -07:00
_active = Visible = value;
2023-06-03 18:21:46 -07:00
SetProcess(value);
2023-03-26 10:53:45 -07:00
}
2023-06-03 18:21:46 -07:00
}
2023-03-26 10:53:45 -07:00
2023-06-03 18:21:46 -07:00
public override void _Ready()
{
Active = true;
}
public override void _Process(double delta)
{
base._Process(delta);
2023-03-26 10:53:45 -07:00
}
2023-07-13 23:46:58 -07:00
2023-07-31 01:12:47 -07:00
public void Load()
{
Godot.RenderingServer.SetDefaultClearColor(ClearColor);
}
2023-07-13 23:46:58 -07:00
public Node SpawnEntity(PackedScene scene)
{
var instance = scene.Instantiate();
Entities.AddChild(instance);
return instance;
}
public T SpawnEntity<T>(PackedScene scene) where T : Node
{
return SpawnEntity(scene) as T;
}
2023-03-26 10:53:45 -07:00
}