30 lines
1.3 KiB
C#
30 lines
1.3 KiB
C#
using System.Collections.Immutable;
|
|
using SideScrollerGame.Sim.Definitions;
|
|
using SideScrollerGame.Sim.Input;
|
|
using SideScrollerGame.Sim.Math;
|
|
using SideScrollerGame.Sim.Verification;
|
|
|
|
namespace SideScrollerGame.Sim.Tests;
|
|
|
|
internal static class SimulationTestFactory
|
|
{
|
|
public static GameDefinition CreateGameDefinition(AxisAlignedBounds? worldBounds = null, ImmutableArray<HazardDefinition> hazards = default, ImmutableArray<TriggerDefinition> triggers = default, ImmutableArray<SolidPlatformDefinition> platforms = default, ImmutableArray<PlayerDefinition> players = default)
|
|
{
|
|
return new(new(worldBounds ?? new(new(0, 0), new(100, 100)), hazards, triggers, platforms), players.IsDefault ? ImmutableArray.Create(new PlayerDefinition(new(1), new(10, 20), 10)) : players);
|
|
}
|
|
|
|
public static PlayerDefinition CreatePlatformerPlayerDefinition(PlayerId playerId, int spawnX, int spawnY)
|
|
{
|
|
return new(playerId, new(spawnX, spawnY), 10, true, new(2), FixPoint16.One, new(3), 1, 1);
|
|
}
|
|
|
|
public static SimulationConfig CreateConfig(VerificationMode verificationMode = VerificationMode.None)
|
|
{
|
|
return new(SimulationDefaults.DefaultTicksPerSecond, verificationMode);
|
|
}
|
|
|
|
public static TickActionBatch CreateTick(int tick, params SimulationAction[] actions)
|
|
{
|
|
return new(tick, ImmutableArray.Create(actions));
|
|
}
|
|
} |