-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate random path for enemy fairies
- Loading branch information
Showing
8 changed files
with
162 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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,49 @@ | ||
using System.Numerics; | ||
using DefaultEcs.System; | ||
using Veldrid; | ||
using zzio; | ||
using zzre.materials; | ||
using zzre.rendering; | ||
|
||
namespace zzre.game.systems; | ||
|
||
public sealed partial class DebugAIPath : AEntitySetSystem<CommandList> | ||
{ | ||
private readonly DebugLineRenderer lineRenderer; | ||
|
||
public DebugAIPath(ITagContainer diContainer) : base(diContainer.GetTag<DefaultEcs.World>(), CreateEntityContainer, useBuffer: false) | ||
{ | ||
lineRenderer = new(diContainer); | ||
lineRenderer.Material.LinkTransformsTo(diContainer.GetTag<Camera>()); | ||
lineRenderer.Material.World.Ref = Matrix4x4.Identity; | ||
} | ||
|
||
protected override void PreUpdate(CommandList cl) | ||
{ | ||
base.PreUpdate(cl); | ||
lineRenderer.Clear(); | ||
} | ||
|
||
[Update] | ||
private void Update(in components.AIPath aiPath) | ||
{ | ||
var pathFinder = World.Get<PathFinder>(); | ||
foreach (var index in aiPath.WaypointIndices) | ||
{ | ||
lineRenderer.AddDiamondSphere(new(pathFinder[index], 0.1f), IColor.White); | ||
} | ||
|
||
for (int i = 1; i < aiPath.WaypointIndices.Count; i++) | ||
{ | ||
lineRenderer.Add(IColor.White, | ||
pathFinder[aiPath.WaypointIndices[i - 1]], | ||
pathFinder[aiPath.WaypointIndices[i]]); | ||
} | ||
} | ||
|
||
protected override void PostUpdate(CommandList cl) | ||
{ | ||
base.PostUpdate(cl); | ||
lineRenderer.Render(cl); | ||
} | ||
} |
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