Fixing small bugs.

This commit is contained in:
Khauvinkh 2024-08-18 19:27:27 +02:00
parent 9b4726113a
commit 3036732a0d
6 changed files with 2005 additions and 78 deletions

View File

@ -0,0 +1,22 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 65221132d7bd4e79856cce65eeb5ce58, type: 3}
m_Name: Level 2
m_EditorClassIdentifier:
Stage: 2
Quotas:
- Type: {fileID: 11400000, guid: 42240b227563f074aa0dd8fee3c0cb35, type: 2}
Quantity: 20
TimeLimit: 60
MaxDefectivePercentage: 80
SuccessMessage: Great job!
FailureMessage: Try again!

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 51ab4948e88c6c241aac9c58fbf85aa7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -52,8 +52,13 @@ public class CranePickDrop : MonoBehaviour
if (state == State.Catching) if (state == State.Catching)
{ {
Debug.Assert(handlingBody, this); Debug.Assert(handlingBody, this);
Debug.Assert(magnet, this);
if (handlingBody == null)
{
state = State.Idle;
return;
}
magnet.strength = magnetStrength; magnet.strength = magnetStrength;
if (magnet.IsCloseTo(handlingBody, 2f)) if (magnet.IsCloseTo(handlingBody, 2f))

View File

@ -6,6 +6,8 @@ public class HammerableRigidbody: RigidbodyInteractable
{ {
public override void Use(InteractionController im) public override void Use(InteractionController im)
{ {
manager = im;
if (im.hands.item == null) if (im.hands.item == null)
{ {
base.Use(im); base.Use(im);

View File

@ -15,6 +15,11 @@ public class Magnet : MonoBehaviour
if (otherRb && otherRb.isKinematic == false) if (otherRb && otherRb.isKinematic == false)
{ {
if (!otherRb.GetComponent<Product>())
{
return;
}
Vector3 dir = otherRb.position - transform.position; Vector3 dir = otherRb.position - transform.position;
float dirSq = Vector3.SqrMagnitude(dir); float dirSq = Vector3.SqrMagnitude(dir);
float forceMagnitude = strength * (1.0f / dirSq); float forceMagnitude = strength * (1.0f / dirSq);