Skip to content

Commit

Permalink
Added new Menus
Browse files Browse the repository at this point in the history
  • Loading branch information
Toaschty committed Oct 7, 2023
1 parent 2be8756 commit 6b5c259
Show file tree
Hide file tree
Showing 9 changed files with 18,486 additions and 9,430 deletions.
1,578 changes: 17 additions & 1,561 deletions Assets/Prefabs/Ant.prefab

Large diffs are not rendered by default.

26,193 changes: 18,333 additions & 7,860 deletions Assets/Scenes/MainScene.unity

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Assets/Scenes/MainScene/EntityScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
DistanceBetweenPheromones: 0.2
PheromoneMaxTime: 30
PheromoneMaxTime: 2
MaxPathLength: 200
PendingPheromone: {fileID: 4450744419724839566, guid: c35086f34f935164e8201ba616f0e794,
type: 3}
Expand Down
4 changes: 0 additions & 4 deletions Assets/Scripts/Authoring/AntAuthoring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public class AntAuthoring : MonoBehaviour
[Header("Movement Settings")]
public float MaxSpeed = 2f;
public float SteerStrength = 2f;
public float WanderStrength = 1f;
public float SensorStrength = 0.9f;
public float RandomDirectionAngle = 90f;
public float MaxSlopeAngle = 65f;
Expand All @@ -25,7 +24,6 @@ public class AntAuthoring : MonoBehaviour
[Header("Detection Settings")]
public float ViewAngle = 90f;
public float ViewRadius = 4f;
public float PickUpRadius = 0.5f;

[Header("Sensors")]
public GameObject LeftSensor;
Expand All @@ -42,7 +40,6 @@ public override void Bake(AntAuthoring authoring)
State = AntState.SearchingFood,
MaxSpeed = authoring.MaxSpeed,
SteerStrength = authoring.SteerStrength,
WanderStrength = authoring.WanderStrength,
SensorStength = authoring.SensorStrength,
RandomDirectionAngle = authoring.RandomDirectionAngle,
RandomSteerForce = float3.zero,
Expand Down Expand Up @@ -96,7 +93,6 @@ public struct Ant : IComponentData
// Movement
public float MaxSpeed;
public float SteerStrength;
public float WanderStrength;
public float SensorStength;
public float RandomDirectionAngle;
public float MaxRandomSteerDuration;
Expand Down
4 changes: 4 additions & 0 deletions Assets/Scripts/Authoring/AntSpawnerAuthoring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public struct AntSpawner : IComponentData
public Entity ant;
}

public struct StartSimulation : IComponentData
{
}

public struct RunningSimulation : IComponentData
{
}
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Monobehaviour/UI/SimulationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void StartSim()
if (!query.HasSingleton<RunningSimulation>())
{
manager.AddComponent<RunningSimulation>(simulation);
manager.AddComponent<StartSimulation>(simulation);

// Enable "Reset Simulation" Button
ResetSimulationButton.SetActive(true);
Expand Down
7 changes: 3 additions & 4 deletions Assets/Scripts/Systems/AntSpawnerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ public partial struct AntSpawnerSystem : ISystem
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate<AntSpawner>();
state.RequireForUpdate<RunningSimulation>();
state.RequireForUpdate<StartSimulation>();
}

[BurstCompile]
public void OnUpdate(ref SystemState state)
{
// Only spawn ants once
state.Enabled = false;

AntSpawner spawner = SystemAPI.GetSingleton<AntSpawner>();
EntityCommandBuffer ecb = new EntityCommandBuffer(Allocator.Temp);

Expand Down Expand Up @@ -49,5 +46,7 @@ public void OnUpdate(ref SystemState state)
ant.ValueRW.Velocity = ant.ValueRO.DesiredDirection;
}

// Remove component so system only updates once
state.EntityManager.RemoveComponent<StartSimulation>(SystemAPI.GetSingletonEntity<StartSimulation>());
}
}
Binary file added Assets/Sprites/Buttons/Path.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions Assets/Sprites/Buttons/Path.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6b5c259

Please sign in to comment.