Browse Source

Improve documentation

master
NGnius 4 years ago
parent
commit
7519bc37ae
8 changed files with 39 additions and 11 deletions
  1. +9
    -3
      GamecraftModdingAPI/Blocks/Movement.cs
  2. +4
    -2
      GamecraftModdingAPI/Blocks/Placement.cs
  3. +7
    -3
      GamecraftModdingAPI/Blocks/Rotation.cs
  4. +1
    -0
      GamecraftModdingAPI/Blocks/RotationEngine.cs
  5. +2
    -1
      GamecraftModdingAPI/Blocks/Signals.cs
  6. +2
    -1
      GamecraftModdingAPI/Tasks/Once.cs
  7. +2
    -1
      GamecraftModdingAPI/Tasks/Repeatable.cs
  8. +12
    -0
      GamecraftModdingAPI/Tasks/Scheduler.cs

+ 9
- 3
GamecraftModdingAPI/Blocks/Movement.cs View File

@@ -9,14 +9,17 @@ using Unity.Mathematics;
namespace GamecraftModdingAPI.Blocks
{
/// <summary>
/// Common block movement operations
/// Common block movement operations.
/// The functionality of this class only works in build mode.
/// </summary>
public static class Movement
{
private static MovementEngine movementEngine = new MovementEngine();

/// <summary>
/// Move a single block by a specific (x,y,z) amount
/// Move a single block by a specific (x,y,z) amount (offset).
/// The moved block will remain connected to the blocks it was touching before it was moved.
/// The block's placement grid and collision box are also moved.
/// </summary>
/// <param name="id">The block's id</param>
/// <param name="vector">The movement amount (x,y,z)</param>
@@ -32,7 +35,10 @@ namespace GamecraftModdingAPI.Blocks
}

/// <summary>
/// Move all connected blocks by a specific (x,y,z) amount
/// Move all connected blocks by a specific (x,y,z) amount (offset).
/// The moved blocks will remain connected to the block they're touching.
/// All of the block's placement grids and collision boxes are also moved.
/// This is equivalent to calling MoveBlock() for every connected block.
/// </summary>
/// <param name="id">The starting block's id</param>
/// <param name="vector">The movement amount (x,y,z)</param>


+ 4
- 2
GamecraftModdingAPI/Blocks/Placement.cs View File

@@ -7,15 +7,17 @@ using GamecraftModdingAPI.Utility;
namespace GamecraftModdingAPI.Blocks
{
/// <summary>
/// Common block placement operations
/// Common block placement operations.
/// The functionality in this class is for build mode.
/// </summary>
public static class Placement
{
private static PlacementEngine placementEngine = new PlacementEngine();

/// <summary>
/// Place a block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position.
/// Place a new block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position.
/// Place blocks next to each other to connect them.
/// The placed block will be a complete block with a placement grid and collision which will be saved along with the game.
/// </summary>
/// <param name="block">The block's type</param>
/// <param name="color">The block's color</param>


+ 7
- 3
GamecraftModdingAPI/Blocks/Rotation.cs View File

@@ -9,14 +9,17 @@ using Unity.Mathematics;
namespace GamecraftModdingAPI.Blocks
{
/// <summary>
/// Common block movement operations
/// Common block rotation operations.
/// The functionality in this class is not completely implemented and will only work in build mode.
/// </summary>
public static class Rotation
{
private static RotationEngine rotationEngine = new RotationEngine();

/// <summary>
/// Rotate a single block by a specific amount in degrees
/// Rotate a single block by a specific amount in degrees.
/// This not destroy inter-block connections, so neighbouring blocks will remain attached despite appearances.
/// The cube placement grid and collision are also rotated.
/// </summary>
/// <param name="id">The block's id</param>
/// <param name="vector">The rotation amount around the x,y,z-axis</param>
@@ -32,7 +35,8 @@ namespace GamecraftModdingAPI.Blocks
}

/// <summary>
/// Rotate all connected blocks by a specific amount in degrees
/// Rotate all connected blocks by a specific amount in degrees.
/// This does not do anything because it has not been implemented.
/// </summary>
/// <param name="id">The starting block's id</param>
/// <param name="vector">The rotation around the x,y,z-axis</param>


+ 1
- 0
GamecraftModdingAPI/Blocks/RotationEngine.cs View File

@@ -75,6 +75,7 @@ namespace GamecraftModdingAPI.Blocks

public float3 RotateConnectedBlocks(uint blockID, Vector3 vector)
{
// TODO: Implement and figure out the math
throw new NotImplementedException();
}



+ 2
- 1
GamecraftModdingAPI/Blocks/Signals.cs View File

@@ -12,6 +12,7 @@ namespace GamecraftModdingAPI.Blocks
{
/// <summary>
/// [EXPERIMENTAL] Common block signal operations
/// The functionality in this class only works when in a game.
/// </summary>
public static class Signals
{
@@ -48,7 +49,7 @@ namespace GamecraftModdingAPI.Blocks
}

/// <summary>
/// Set a signal's value.
/// Set the signal's value.
/// </summary>
/// <param name="signalID">The channel cluster's id.</param>
/// <param name="signal">The signal value (-1 to 1; not enforced).</param>


+ 2
- 1
GamecraftModdingAPI/Tasks/Once.cs View File

@@ -10,7 +10,8 @@ using Svelto.Tasks.Enumerators;
namespace GamecraftModdingAPI.Tasks
{
/// <summary>
/// An asynchronous task to be performed once
/// An asynchronous task to be performed once.
/// Once constructed, this can be run by scheduling it with Scheduler.Schedule()
/// </summary>
public class Once : ISchedulable
{


+ 2
- 1
GamecraftModdingAPI/Tasks/Repeatable.cs View File

@@ -10,7 +10,8 @@ using Svelto.Tasks.Enumerators;
namespace GamecraftModdingAPI.Tasks
{
/// <summary>
/// An asynchronous repeating task
/// An asynchronous repeating task.
/// Once constructed, this can be run by scheduling it with Scheduler.Schedule()
/// </summary>
public class Repeatable : ISchedulable
{


+ 12
- 0
GamecraftModdingAPI/Tasks/Scheduler.cs View File

@@ -9,6 +9,11 @@ using Svelto.Tasks.ExtraLean;

namespace GamecraftModdingAPI.Tasks
{
/// <summary>
/// Asynchronous task scheduling for ISchedulables.
/// Asynchronous tasks will not freeze the main program, which makes them ideal for slow or blocking operations which don't need to be completed post-haste.
/// The functionality of this class works in any state.
/// </summary>
public static class Scheduler
{
public static Svelto.Tasks.Lean.Unity.UpdateMonoRunner leanRunnerUI
@@ -31,6 +36,13 @@ namespace GamecraftModdingAPI.Tasks

public static readonly Svelto.Tasks.Lean.Unity.UpdateMonoRunner leanRunner = new Svelto.Tasks.Lean.Unity.UpdateMonoRunner("GamecraftModdingAPILean");

/// <summary>
/// Schedule a task to run asynchronously.
/// This uses custom task runners (by default) to not interfere with the game.
/// </summary>
/// <param name="toRun">The task to run</param>
/// <param name="extraLean">Schedule toRun on an extra lean runner?</param>
/// <param name="ui">Schedule toRun on Gamecraft's built-in UI task runner?</param>
public static void Schedule(ISchedulable toRun, bool extraLean = false, bool ui = false)
{
if (extraLean)


Loading…
Cancel
Save