supervisor-simulator/resources/Table.cs
2024-12-01 23:47:55 +08:00

31 lines
771 B
C#

using Godot;
using System;
public partial class Table : Node2D
{
private static readonly Rect2I tableRect = new(0, 0, 3, 2);
private static readonly TileMapping[] tableThemes = {
new(new Vector2I(1, 30), tableRect),
new(new Vector2I(4, 30), tableRect),
new(new Vector2I(7, 30), tableRect),
new(new Vector2I(7, 28), tableRect),
new(new Vector2I(10, 28), tableRect),
};
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
RandomChangeTheme();
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void RandomChangeTheme() {
tableThemes[GD.RandRange(0, tableThemes.Length)].Apply(GetNode<TileMapLayer>("Base"));
}
}