ported from perforce
This commit is contained in:
50
DonkeysAndDroids.Godot/BoardNode.cs
Normal file
50
DonkeysAndDroids.Godot/BoardNode.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Godot;
|
||||
using RobotAndDonkey.Game.Board;
|
||||
using RobotAndDonkey.Game.Execution.Results;
|
||||
using RobotAndDonkey.Game.Pois;
|
||||
using RobotAndDonkey.Game.Utils;
|
||||
using System;
|
||||
|
||||
public partial class BoardNode : Node3D
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
m_HexBoard3D = GetNode<HexBoard3D>("HexBoard3D");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
}
|
||||
|
||||
public void Configure(Board board)
|
||||
{
|
||||
m_HexBoard3D.Configure(board);
|
||||
}
|
||||
|
||||
public void Configure(Result result, Tween tween)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case CellTypeResult cellResult:
|
||||
{
|
||||
var cell = cellResult.Board.Cells[cellResult.Board.FindCellIndex(cellResult.Hex)];
|
||||
tween.TweenCallback(Callable.From(() => m_HexBoard3D.Configure(cell)));
|
||||
break;
|
||||
}
|
||||
case ModifyCellResult cellResult:
|
||||
{
|
||||
var cell = cellResult.Board.Cells[cellResult.Board.FindCellIndex(cellResult.Hex)];
|
||||
m_HexBoard3D.ModifyCell(cell, cellResult.Modifier, tween);
|
||||
break;
|
||||
}
|
||||
case PoiResult cellResult:
|
||||
{
|
||||
var cell = cellResult.Board.Cells[cellResult.Board.FindCellIndex(cellResult.Hex)];
|
||||
m_HexBoard3D.ModifyPoi(cell, cellResult.Poi, tween);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HexBoard3D m_HexBoard3D;
|
||||
}
|
||||
Reference in New Issue
Block a user