Skip to content

Commit

Permalink
jobs: Migrate hit- and drop targets, and clean up some obsolete systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
freezy committed Oct 9, 2023
1 parent 59a304e commit 505ca3f
Show file tree
Hide file tree
Showing 39 changed files with 214 additions and 1,725 deletions.
44 changes: 44 additions & 0 deletions VisualPinball.Unity/VisualPinball.Unity/Game/PhysicsEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,34 @@ private void Update()
}
}

// drop targets
using (var enumerator = _dropTargetStates.GetEnumerator()) {
while (enumerator.MoveNext()) {
ref var dropTargetState = ref enumerator.Current.Value;
var dropTargetTransform = _transforms[dropTargetState.AnimatedItemId];
var localPos = dropTargetTransform.localPosition;
dropTargetTransform.localPosition = new Vector3(
localPos.x,
Physics.ScaleToWorld(dropTargetState.Animation.ZOffset),
localPos.z
);
}
}

// hit targets
using (var enumerator = _hitTargetStates.GetEnumerator()) {
while (enumerator.MoveNext()) {
ref var hitTargetState = ref enumerator.Current.Value;
var hitTargetTransform = _transforms[hitTargetState.AnimatedItemId];
var localRot = hitTargetTransform.localEulerAngles;
hitTargetTransform.localEulerAngles = new Vector3(
hitTargetState.Animation.XRotation,
localRot.y,
localRot.z
);
}
}

// gates
using (var enumerator = _gateStates.GetEnumerator()) {
while (enumerator.MoveNext()) {
Expand Down Expand Up @@ -398,6 +426,22 @@ public void Execute()
}
}

// drop target
using (var enumerator = DropTargetStates.GetEnumerator()) {
while (enumerator.MoveNext()) {
ref var dropTargetState = ref enumerator.Current.Value;
DropTargetAnimation.Update(enumerator.Current.Key, ref dropTargetState.Animation, in dropTargetState.Static, ref state, timeMsec);
}
}

// hit target
using (var enumerator = HitTargetStates.GetEnumerator()) {
while (enumerator.MoveNext()) {
ref var hitTargetState = ref enumerator.Current.Value;
HitTargetAnimation.Update(ref hitTargetState.Animation, in hitTargetState.Static, timeMsec);
}
}

// plunger
using (var enumerator = PlungerStates.GetEnumerator()) {
while (enumerator.MoveNext()) {
Expand Down
2 changes: 0 additions & 2 deletions VisualPinball.Unity/VisualPinball.Unity/Game/PhysicsState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
using NativeTrees;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using VisualPinball.Engine.VPT;
using VisualPinball.Unity.Collections;
using VisualPinballUnity;

namespace VisualPinball.Unity
{
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 505ca3f

Please sign in to comment.