TechbloxModdingAPI/GamecraftModdingAPI/Blocks/Movement.cs
2019-12-16 20:55:52 -05:00

55 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unity.Mathematics;
namespace GamecraftModdingAPI.Blocks
{
/// <summary>
/// Common block movement operations
/// </summary>
public static class Movement
{
private static MovementEngine movementEngine = new MovementEngine();
/// <summary>
/// Move a single block by a specific (x,y,z) amount
/// </summary>
/// <param name="id">The block's id</param>
/// <param name="vector">The movement amount (x,y,z)</param>
/// <returns></returns>
public static bool MoveBlock(uint id, float3 vector)
{
if (movementEngine.IsInGame && movementEngine.IsBuildMode())
{
movementEngine.MoveBlock(id, vector);
return true;
}
return false;
}
/// <summary>
/// Move all connected blocks by a specific (x,y,z) amount
/// </summary>
/// <param name="id">The starting block's id</param>
/// <param name="vector">The movement amount (x,y,z)</param>
/// <returns></returns>
public static bool MoveConnectedBlocks(uint id, float3 vector)
{
if (movementEngine.IsInGame && movementEngine.IsBuildMode())
{
movementEngine.MoveConnectedBlocks(id, vector);
return true;
}
return false;
}
public static void Init()
{
GamecraftModdingAPI.Utility.GameEngineManager.AddGameEngine(movementEngine);
}
}
}