Skip to content

Commit

Permalink
stempelhuisjes
Browse files Browse the repository at this point in the history
  • Loading branch information
bozmir committed Dec 20, 2024
1 parent 6842a4e commit 759df32
Show file tree
Hide file tree
Showing 9 changed files with 795 additions and 54 deletions.
18 changes: 4 additions & 14 deletions Assets/Scenes/Main.unity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions Assets/Scripts/KerstSpecial/StempelTrigger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Netherlands3D.Twin
{
public class StempelTrigger : ZoneTrigger
{
public bool IsCollected = false;
private RaceController controller;

private void Start()
{
controller = FindObjectOfType<RaceController>();
GetComponent<BoxCollider>().isTrigger = true;
}

protected override void OnTriggerEnter(Collider other)
{
base.OnTriggerEnter(other);
if (controller != null && controller.playerCollider == other)
{
IsCollected = true;

StempelTrigger[] triggers = transform.parent.transform.GetComponentsInChildren<StempelTrigger>();
foreach (StempelTrigger trigger in triggers)
trigger.IsCollected = true;
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/KerstSpecial/StempelTrigger.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Assets/Scripts/KerstSpecial/ZoneTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ public class ZoneTrigger : MonoBehaviour
public event ZoneHandler OnExit;
public event ZoneHandler OnStay;

private void OnTriggerEnter(Collider other)
protected virtual void OnTriggerEnter(Collider other)
{
OnEnter?.Invoke(other, this);
}

private void OnTriggerExit(Collider other)
protected virtual void OnTriggerExit(Collider other)
{
OnExit?.Invoke(other, this);
}

private void OnTriggerStay(Collider other)
protected virtual void OnTriggerStay(Collider other)
{
OnStay?.Invoke(other, this);
}
Expand Down
14 changes: 7 additions & 7 deletions Assets/Scripts/KerstSpecial/arreslee.prefab

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 759df32

Please sign in to comment.