Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit df17e19

Browse files
minor fixes for Physics 101
1 parent eaec18a commit df17e19

File tree

7 files changed

+7
-8
lines changed

7 files changed

+7
-8
lines changed

‎Dots101/Physics101/Assets/ActivationPlates/ActivationSystem.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public void OnUpdate(ref SystemState state)
130130
if (zone.ValueRO.LastTriggerTime == 0)
131131
{
132132
spawnBox = true;
133+
zone.ValueRW.LastTriggerTime = (float)elapsedTime;
133134
}
134135
}
135136
else if (type == ZoneType.Continuous && zoneState == ZoneState.Inside)

‎Dots101/Physics101/Assets/Blender/BladeAuthoring.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Unity.Entities;
22
using Unity.Mathematics;
33
using UnityEngine;
4-
using UnityEngine.Serialization;
54

65
namespace Blender
76
{

‎Dots101/Physics101/Assets/Blender/BuoyantSystem.cs‎ renamed to ‎Dots101/Physics101/Assets/Blender/BuoyancySystem.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public void OnUpdate(ref SystemState state)
2020
float deltaTime = SystemAPI.Time.DeltaTime;
2121

2222
foreach (var (buoyant, transform, velocity, mass) in
23-
SystemAPI
24-
.Query<RefRO<Buoyancy>, RefRW<LocalTransform>, RefRW<PhysicsVelocity>, RefRO<PhysicsMass>>())
23+
SystemAPI.Query<RefRO<Buoyancy>, RefRW<LocalTransform>, RefRW<PhysicsVelocity>, RefRO<PhysicsMass>>())
2524
{
2625
float3 currentPos = transform.ValueRW.Position;
2726

‎Dots101/Physics101/Assets/BreakingBricks/BallSystem.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Unity.Burst;
22
using Unity.Collections;
33
using Unity.Entities;
4-
using Unity.Mathematics;
54
using Unity.Transforms;
65
using Random = Unity.Mathematics.Random;
76

@@ -10,11 +9,13 @@ namespace BreakingBricks
109
public partial struct BallSystem : ISystem
1110
{
1211
private float spawnTimer;
12+
private uint seed;
1313

1414
[BurstCompile]
1515
public void OnCreate(ref SystemState state)
1616
{
1717
state.RequireForUpdate<BreakingBricks.Config>();
18+
seed = 1;
1819
}
1920

2021
[BurstCompile]
@@ -29,8 +30,7 @@ public void OnUpdate(ref SystemState state)
2930

3031
var newBalls =
3132
state.EntityManager.Instantiate(config.BallPrefab, config.NumBallsSpawn, Allocator.Temp);
32-
33-
var rand = new Random((uint)math.max(1, math.ceil(SystemAPI.Time.ElapsedTime)));
33+
var rand = Random.CreateFromIndex(++seed);
3434

3535
var min = config.SpawnBoundsMin;
3636
var max = config.SpawnBoundsMax;

‎Dots101/Physics101/Assets/BreakingBricks/BrickSystem.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void OnCreate(ref SystemState state)
2323
state.RequireForUpdate<PhysicsWorldSingleton>();
2424
state.RequireForUpdate<BreakingBricks.Config>();
2525
}
26-
26+
2727
[BurstCompile]
2828
public void OnUpdate(ref SystemState state)
2929
{

‎Dots101/Physics101/Assets/LaserSight/LaserSystem.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void OnUpdate(ref SystemState state)
3131
playerTransform.ValueRW.Position += input * speed;
3232
}
3333
}
34-
34+
3535
float laserLength = 0;
3636

3737
// raycast to determine the laser length

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /