Files
JuegoSim/Assets/_Project/Scripts/Code/BlockExtensions/Concrete/NewBlockPlacementHandler.cs
T
2026-07-21 08:56:10 +03:00

36 lines
831 B
C#

using UnityEngine;
/// <summary>
/// Placement handler for brand-new blocks dragged from the menu.
/// </summary>
public class NewBlockPlacementHandler : IPlacementHandler
{
private readonly CommandHandler _commandHandler;
public NewBlockPlacementHandler(CommandHandler commandHandler)
{
_commandHandler = commandHandler;
Debug.Log("initialize the NewBlockPlacement");
}
public void Commit(BlockEditContext ctx)
{
if (ctx.Block == null) return;
_commandHandler.createBlock(
ctx.Block.getBlockData()?.blockName,
ctx.GhostTransform.position,
ctx.GhostTransform.rotation);
}
public void Cancel(BlockEditContext ctx)
{
// nothing for now
}
public void Debugln()
{
Debug.Log("Hi I'm New");
}
}