From 4a66021bfd261c57da6df91264f6b8eb0ccebaf6 Mon Sep 17 00:00:00 2001 From: Brian Will Date: Mon, 26 Feb 2024 20:24:24 -0800 Subject: [PATCH] firefighters tutorial bug fix --- .../Assets/Tutorials/Firefighters/Step 3/LineSystem.cs | 9 +++++---- .../Firefighters_Step4/Firefighters_Step4Subscene.unity | 7 ++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/EntitiesSamples/Assets/Tutorials/Firefighters/Step 3/LineSystem.cs b/EntitiesSamples/Assets/Tutorials/Firefighters/Step 3/LineSystem.cs index 274ada0b..ff894b27 100644 --- a/EntitiesSamples/Assets/Tutorials/Firefighters/Step 3/LineSystem.cs +++ b/EntitiesSamples/Assets/Tutorials/Firefighters/Step 3/LineSystem.cs @@ -26,7 +26,8 @@ namespace Tutorials.Firefighters public void OnUpdate(ref SystemState state) { var config = SystemAPI.GetSingleton(); - var rand = new Random(123 + seed++); // seed is incremented to get different random values in different frames + var rand = new Random(123 + + seed++); // seed is incremented to get different random values in different frames var pondQuery = SystemAPI.QueryBuilder().WithAll().Build(); var pondPositions = pondQuery.ToComponentDataArray(Allocator.Temp); @@ -38,7 +39,7 @@ namespace Tutorials.Firefighters foreach (var (team, members, respositionLineState) in SystemAPI.Query, DynamicBuffer, EnabledRefRW>()) { - respositionLineState.ValueRW = false; // disable RepositionLine + respositionLineState.ValueRW = false; // disable RepositionLine // set LinePos of the team's bots and set their bot state { @@ -55,7 +56,7 @@ namespace Tutorials.Firefighters for (int i = 1; i <= douserIdx; i++) { var ratio = (float)i / (douserIdx + 1); - var offset = math.sin(math.lerp(0, config.LineMaxOffset, ratio)) * offsetVec; + var offset = math.sin(math.lerp(0, math.PI, ratio)) * offsetVec * config.LineMaxOffset; var pos = math.lerp(randomPondPos, nearestFirePos, ratio); var bot = SystemAPI.GetComponentRW(members[i].Bot); @@ -86,4 +87,4 @@ namespace Tutorials.Firefighters } } } -} +} \ No newline at end of file diff --git a/EntitiesSamples/Assets/Tutorials/Firefighters/Step 4/Firefighters_Step4/Firefighters_Step4Subscene.unity b/EntitiesSamples/Assets/Tutorials/Firefighters/Step 4/Firefighters_Step4/Firefighters_Step4Subscene.unity index 05f65261..d70819fb 100644 --- a/EntitiesSamples/Assets/Tutorials/Firefighters/Step 4/Firefighters_Step4/Firefighters_Step4Subscene.unity +++ b/EntitiesSamples/Assets/Tutorials/Firefighters/Step 4/Firefighters_Step4/Firefighters_Step4Subscene.unity @@ -219,7 +219,7 @@ PrefabInstance: - target: {fileID: 7709179001885154505, guid: 564374f1656a67c498c706bc5dd35446, type: 3} propertyPath: NumTeams - value: 9 + value: 6 objectReference: {fileID: 0} - target: {fileID: 7709179001885154505, guid: 564374f1656a67c498c706bc5dd35446, type: 3} @@ -237,6 +237,11 @@ PrefabInstance: propertyPath: GroundNumRows value: 90 objectReference: {fileID: 0} + - target: {fileID: 7709179001885154505, guid: 564374f1656a67c498c706bc5dd35446, + type: 3} + propertyPath: LineMaxOffset + value: 3 + objectReference: {fileID: 0} - target: {fileID: 7709179001885154505, guid: 564374f1656a67c498c706bc5dd35446, type: 3} propertyPath: HeatSpreadSpeed