|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- 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 Rotation
- {
- private static RotationEngine rotationEngine = new RotationEngine();
-
- /// <summary>
- /// Rotate a single block by a specific amount in degrees
- /// </summary>
- /// <param name="id">The block's id</param>
- /// <param name="vector">The rotation amount around the x,y,z-axis</param>
- /// <returns>Whether the operation was successful</returns>
- public static bool RotateBlock(uint id, float3 vector)
- {
- if (rotationEngine.IsInGame && rotationEngine.IsBuildMode())
- {
- rotationEngine.RotateBlock(id, vector);
- return true;
- }
- return false;
- }
-
- /// <summary>
- /// Rotate all connected blocks by a specific amount in degrees
- /// </summary>
- /// <param name="id">The starting block's id</param>
- /// <param name="vector">The rotation around the x,y,z-axis</param>
- /// <returns>Whether the operation was successful</returns>
- public static bool RotateConnectedBlocks(uint id, float3 vector)
- {
- if (rotationEngine.IsInGame && rotationEngine.IsBuildMode())
- {
- rotationEngine.RotateConnectedBlocks(id, vector);
- return true;
- }
- return false;
- }
-
- public static void Init()
- {
- GamecraftModdingAPI.Utility.GameEngineManager.AddGameEngine(rotationEngine);
- }
- }
- }
|