poc firehydrant oncollide publishes to Car.events script subscribers wheeeeeeeeeeeee
This commit is contained in:
19
Assets/Actors/Automatic/Firehydrant/firehydrant.cs
Normal file
19
Assets/Actors/Automatic/Firehydrant/firehydrant.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class firehydrant : MonoBehaviour
|
||||||
|
{
|
||||||
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnCollisionEnter(Collision _)
|
||||||
|
{
|
||||||
|
events.PubCollision();
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Actors/Automatic/Firehydrant/firehydrant.cs.meta
Normal file
2
Assets/Actors/Automatic/Firehydrant/firehydrant.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f63a4aa77aafd2b12a2554da4978087c
|
||||||
@@ -887,6 +887,9 @@ PrefabInstance:
|
|||||||
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: cde3b92d14d0b0349b04a21a7734f7fd, type: 3}
|
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: cde3b92d14d0b0349b04a21a7734f7fd, type: 3}
|
||||||
insertIndex: -1
|
insertIndex: -1
|
||||||
addedObject: {fileID: 1972229520404947818}
|
addedObject: {fileID: 1972229520404947818}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: cde3b92d14d0b0349b04a21a7734f7fd, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 6825522030758200062}
|
||||||
- targetCorrespondingSourceObject: {fileID: -5287916851642620284, guid: cde3b92d14d0b0349b04a21a7734f7fd, type: 3}
|
- targetCorrespondingSourceObject: {fileID: -5287916851642620284, guid: cde3b92d14d0b0349b04a21a7734f7fd, type: 3}
|
||||||
insertIndex: -1
|
insertIndex: -1
|
||||||
addedObject: {fileID: 2634568116272046903}
|
addedObject: {fileID: 2634568116272046903}
|
||||||
@@ -982,6 +985,18 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 25bb371d44866654297937bd67a261d4, type: 3}
|
m_Script: {fileID: 11500000, guid: 25bb371d44866654297937bd67a261d4, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!114 &6825522030758200062
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1493955717807061527}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: dff7018aae93db1aea5d93f82f4abdcd, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!4 &2242921521379127059 stripped
|
--- !u!4 &2242921521379127059 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 529881195364821077, guid: cde3b92d14d0b0349b04a21a7734f7fd, type: 3}
|
m_CorrespondingSourceObject: {fileID: 529881195364821077, guid: cde3b92d14d0b0349b04a21a7734f7fd, type: 3}
|
||||||
|
|||||||
33
Assets/Actors/Controllable/Car/Scripts/events.cs
Normal file
33
Assets/Actors/Controllable/Car/Scripts/events.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class events : MonoBehaviour
|
||||||
|
{
|
||||||
|
public delegate void Collision();
|
||||||
|
public static event Collision collisions;
|
||||||
|
public static void PubCollision()
|
||||||
|
{
|
||||||
|
if (events.collisions != null)
|
||||||
|
events.collisions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
collisions += testCollisionSubscriber;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
collisions -= testCollisionSubscriber;
|
||||||
|
}
|
||||||
|
|
||||||
|
void testCollisionSubscriber()
|
||||||
|
{
|
||||||
|
Debug.Log("COLLISION IN SUB FEED");
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Actors/Controllable/Car/Scripts/events.cs.meta
Normal file
2
Assets/Actors/Controllable/Car/Scripts/events.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dff7018aae93db1aea5d93f82f4abdcd
|
||||||
Reference in New Issue
Block a user