test commit

This commit is contained in:
niko
2026-10-11 20:26:48 +02:00
parent 4dbd3c0ab3
commit 6fee00e7ff
2187 changed files with 760371 additions and 2 deletions
+33
View File
@@ -0,0 +1,33 @@
using UnityEngine;
using UnityEngine.Events;
public class Custard : Grabbable
{
public UnityEvent OnCollect;
public override void OnPlayerCollect()
{
base.OnPlayerCollect();
if (CollectGamemode.Instance)
CollectGamemode.Instance.CollectCustard(this);
else
Destroy(this.gameObject);
Player.Instance.PlayCollectSound();
if (OnCollect != null)
OnCollect.Invoke();
if (DummyWinky.Instance && DummyWinky.Instance.unleashed)
{
float dist = Vector3.Distance(this.transform.position, DummyWinky.Instance.transform.position);
if (dist < 100)
{
rb.isKinematic = true;
rb.useGravity = false;
this.transform.position = Vector3.MoveTowards(this.transform.position, DummyWinky.Instance.transform.position, Time.deltaTime);
}
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f3cff10c742e6df48bca14457e106872
+70
View File
@@ -0,0 +1,70 @@
using UnityEngine;
using UnityEngine.Events;
public class Custard : MonoBehaviour
{
public UnityEvent OnCollect;
Rigidbody rb;
MeshCollider collider;
bool wasCollecting = false;
bool smoothing = false;
bool lockSmoothing = false;
bool interactedWith = false;
private void Awake()
{
collider = GetComponent<MeshCollider>();
rb = GetComponent<Rigidbody>();
}
void Update()
{
if (!Player.Instance) return;
if (Vector3.Distance(this.transform.position, Player.Instance.CustardAnchor.position) < 0.5f || lockSmoothing)
smoothing = false;
else
smoothing = true;
if (Player.Instance.collecting && Player.Instance.InRangeForCollectGrab(gameObject))
{
if (!smoothing)
lockSmoothing = true;
wasCollecting = true;
interactedWith = true;
this.transform.position = Vector3.Lerp(this.transform.position, Player.Instance.CustardAnchor.position, (smoothing) ? Time.deltaTime * 10f : 1);
this.transform.rotation = Quaternion.Lerp(this.transform.rotation, Player.Instance.CustardAnchor.rotation, (smoothing) ? Time.deltaTime * 10f : 1);
collider.enabled = false;
rb.isKinematic = true;
} else
{
lockSmoothing = false;
if (wasCollecting)
{
if (Player.Instance.InRangeForCollect(gameObject))
{
if (CollectGamemode.Instance)
CollectGamemode.Instance.CollectCustard(this);
else
Destroy(this.gameObject);
Player.Instance.PlayCollectSound();
if (OnCollect != null)
OnCollect.Invoke();
}
}
wasCollecting = false;
collider.enabled = true;
if (interactedWith)
rb.isKinematic = false;
}
}
}
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bf88c66af797d93498a5bcee47950bd7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: