Grabbing food
This commit is contained in:
parent
6551c653c3
commit
923cb317af
@ -1,7 +1,8 @@
|
||||
|
||||
namespace Passer.Control.Core {
|
||||
public class TouchSensor : Thing {
|
||||
public Thing touchedThing = null;
|
||||
//public Thing touchedThing = null;
|
||||
public bool touchedSomething = false;
|
||||
|
||||
public TouchSensor(bool invokeEvent = true) : base(invokeEvent) {
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Control.Unity {
|
||||
@ -14,13 +13,6 @@ namespace Passer.Control.Unity {
|
||||
if (core == null)
|
||||
SetCoreThing(new Core.TouchSensor());
|
||||
|
||||
//StartCoroutine(MeasureDistance());
|
||||
}
|
||||
bool update = false;
|
||||
|
||||
protected override void Update() {
|
||||
base.Update();
|
||||
this.update= false;
|
||||
}
|
||||
|
||||
public static TouchSensor Create(Core.TouchSensor core) {
|
||||
@ -46,11 +38,16 @@ namespace Passer.Control.Unity {
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
Debug.Log("Touch!");
|
||||
this.coreSensor.touchedThing = other.transform.GetComponentInParent<Thing>().core;
|
||||
if (other.isTrigger)
|
||||
return;
|
||||
|
||||
this.coreSensor.touchedSomething = true;
|
||||
}
|
||||
private void OnTriggerExit(Collider other) {
|
||||
this.coreSensor.touchedThing = null;
|
||||
if (other.isTrigger)
|
||||
return;
|
||||
|
||||
this.coreSensor.touchedSomething = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user