Skip to content

Commit a58778d

Browse files
committed
Updated CommandService to allow non struct type commands to be executed for reference type commands
Added Spawn(data) method to pool object to allow spawning new objects with defined spawning data Tests updated
1 parent dc5339d commit a58778d

9 files changed

Lines changed: 274 additions & 112 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this package will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [0.10.0] - 2024-10-11
8+
9+
- Updated CommandService to allow non struct type commands to be executed for reference type commands
10+
- Added Spawn<T>(T data) method to pool object to allow spawning new objects with defined spawning data
11+
712
## [0.9.0] - 2024-08-10
813

914
- Updated interfaces and classes related to data services, enhancing modularity and improving version handling.

Runtime/CommandService.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public interface IGameCommandBase {}
1717
public interface IGameCommand<in TGameLogic> : IGameCommandBase where TGameLogic : class
1818
{
1919
/// <summary>
20-
/// Executes the command logic
20+
/// Executes the command logic defined by the implemention of this interface
2121
/// </summary>
2222
void Execute(TGameLogic gameLogic);
2323
}
@@ -29,10 +29,13 @@ public interface IGameCommand<in TGameLogic> : IGameCommandBase where TGameLogic
2929
public interface ICommandService<out TGameLogic> where TGameLogic : class
3030
{
3131
/// <summary>
32-
/// Executes the given <paramref name="command"/>.
33-
/// The command execution is done atomically
32+
/// Executes the given <paramref name="command"/>
3433
/// </summary>
35-
void ExecuteCommand<TCommand>(TCommand command) where TCommand : struct, IGameCommand<TGameLogic>;
34+
/// <remarks>
35+
/// IMPORTANT: Defines the <paramref name="command"/> as a class object if logic execution is asynchronous.
36+
/// Define as a struct if togic logic execution is non waitable.
37+
/// </remarks>
38+
void ExecuteCommand<TCommand>(TCommand command) where TCommand : IGameCommand<TGameLogic>;
3639
}
3740

3841
/// <inheritdoc />
@@ -46,7 +49,7 @@ public CommandService(TGameLogic gameLogic)
4649
}
4750

4851
/// <inheritdoc />
49-
public void ExecuteCommand<TCommand>(TCommand command) where TCommand : struct, IGameCommand<TGameLogic>
52+
public void ExecuteCommand<TCommand>(TCommand command) where TCommand : IGameCommand<TGameLogic>
5053
{
5154
command.Execute(_gameLogic);
5255
}

0 commit comments

Comments
 (0)