-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v1.2.0] Added spawn strategies. Added spike traps. Reworked the conf…
…ig with ranges. Added backwards compat to v49.
- Loading branch information
1 parent
e1ce639
commit c86c470
Showing
28 changed files
with
808 additions
and
558 deletions.
There are no files selected for viewing
23 changes: 20 additions & 3 deletions
23
LCLandmineOutside/Abstract/AbstractCompatibilityHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
using System.Collections.Generic; | ||
using LCHazardsOutside.Data; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace LCHazardsOutside.Abstract | ||
{ | ||
internal abstract class SpawnStrategy | ||
public abstract class SpawnStrategy | ||
{ | ||
public abstract void CalculateCenterPosition(Vector3 shipLandPosition, Vector3 mainEntrancePosition, List<Vector3> pointsOfInterest, float spawnRadiusMultiplier, out Vector3 centerPosition, out float spawnRadius); | ||
public abstract List<SpawnPositionData> CalculateCenterPositions(Vector3 shipLandPosition, Vector3 mainEntrancePosition, List<Vector3> pointsOfInterest, float spawnRadiusMultiplier); | ||
|
||
public abstract (Vector3, Quaternion) GetRandomGroundPositionAndRotation(Vector3 centerPoint, float radius = 10f, System.Random randomSeed = null, int layerMask = -1, int maxAttempts = 10); | ||
protected SpawnPositionData CalculateCenterWithSpawnRadius(Vector3 shipLandPosition, Vector3 targetPosition, float spawnRadiusMultiplier) | ||
{ | ||
float spawnRadius; | ||
Vector3 centerPosition = (shipLandPosition + targetPosition) / 2; | ||
spawnRadius = Vector3.Distance(targetPosition, centerPosition) * spawnRadiusMultiplier; | ||
centerPosition.y = Mathf.Max(shipLandPosition.y, targetPosition.y); | ||
|
||
return new SpawnPositionData(centerPosition, spawnRadius); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
|
||
namespace LCHazardsOutside.Data | ||
{ | ||
public class EntranceContainer(Vector3 mainEntrancePosition, List<Vector3> fireExitPositions) | ||
{ | ||
public Vector3 MainEntrancePosition { get; set; } = mainEntrancePosition; | ||
public List<Vector3> FireExitPositions { get; set; } = fireExitPositions; | ||
|
||
public bool IsInitialized() | ||
{ | ||
return MainEntrancePosition != Vector3.zero && FireExitPositions.All(x => x != Vector3.zero); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using LCHazardsOutside.Abstract; | ||
using System.Collections.Generic; | ||
|
||
namespace LCHazardsOutside.Data | ||
{ | ||
public class HazardConfiguration(bool enabled, int minSpawnRate, int maxSpawnRate, Dictionary<string, MoonMinMax> moonMap, SpawnStrategy spawnStrategy) | ||
{ | ||
public bool Enabled { get; set; } = enabled; | ||
public int MinSpawnRate { get; set; } = minSpawnRate; | ||
public int MaxSpawnRate { get; set; } = maxSpawnRate; | ||
public Dictionary<string, MoonMinMax> MoonMap { get; set; } = moonMap; | ||
public SpawnStrategy SpawnStrategy { get; set; } = spawnStrategy; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace LCHazardsOutside.Data | ||
{ | ||
public enum HazardType | ||
{ | ||
Landmine, | ||
Turret, | ||
SpikeRoofTrap, | ||
CustomHazard | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace LCHazardsOutside.Data | ||
{ | ||
public class MoonMinMax(int min, int max) | ||
{ | ||
public int Min { get; set; } = min; | ||
public int Max { get; set; } = max; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using UnityEngine; | ||
|
||
namespace LCHazardsOutside.Data | ||
{ | ||
public record struct SpawnPositionData | ||
{ | ||
public SpawnPositionData(Vector3 centerPosition, float spawnRadius) : this() | ||
{ | ||
CenterPosition = centerPosition; | ||
SpawnRadius = spawnRadius; | ||
} | ||
|
||
public Vector3 CenterPosition { get; set; } | ||
public float SpawnRadius{ get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace LCHazardsOutside.Data | ||
{ | ||
public enum SpawnStrategyType | ||
{ | ||
MainAndFireExit, | ||
MainEntranceOnly, | ||
FireExitsOnly | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.