Initial commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user