This commit is contained in:
Brian Will 2024-02-26 20:24:24 -08:00
Родитель b796a9006c
Коммит 4a66021bfd
2 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -26,7 +26,8 @@ namespace Tutorials.Firefighters
public void OnUpdate(ref SystemState state)
{
var config = SystemAPI.GetSingleton<Config>();
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<Pond, LocalTransform>().Build();
var pondPositions = pondQuery.ToComponentDataArray<LocalTransform>(Allocator.Temp);
@ -38,7 +39,7 @@ namespace Tutorials.Firefighters
foreach (var (team, members, respositionLineState) in
SystemAPI.Query<RefRO<Team>, DynamicBuffer<TeamMember>, EnabledRefRW<RepositionLine>>())
{
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<Bot>(members[i].Bot);
@ -86,4 +87,4 @@ namespace Tutorials.Firefighters
}
}
}
}
}

Просмотреть файл

@ -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