Updated namespaces
This commit is contained in:
parent
d3e12c16f2
commit
a1d89ff1f7
@ -1,4 +1,4 @@
|
|||||||
namespace Passer.RoboidControl.Core {
|
namespace Passer.RoboidControl {
|
||||||
public class TouchSensor : Thing {
|
public class TouchSensor : Thing {
|
||||||
public bool touchedSomething = false;
|
public bool touchedSomething = false;
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 718e148be3eeb65498334ed008747482
|
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Passer.Control.Unity {
|
namespace Passer.RoboidControl.Unity {
|
||||||
|
|
||||||
public class DistanceSensor : Thing {
|
public class DistanceSensor : Thing {
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ namespace Passer.Control.Unity {
|
|||||||
StartCoroutine(MeasureDistance());
|
StartCoroutine(MeasureDistance());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DistanceSensor Create(Core.Thing parent) {
|
public static DistanceSensor Create(RoboidControl.Thing parent) {
|
||||||
GameObject distanceObj = new("Distance sensor");
|
GameObject distanceObj = new("Distance sensor");
|
||||||
DistanceSensor component = distanceObj.AddComponent<DistanceSensor>();
|
DistanceSensor component = distanceObj.AddComponent<DistanceSensor>();
|
||||||
if (parent != null && parent.component != null)
|
if (parent != null && parent.component != null)
|
||||||
|
@ -3,32 +3,32 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Passer.Control.Unity {
|
namespace Passer.RoboidControl.Unity {
|
||||||
|
|
||||||
public class SiteServer : MonoBehaviour {
|
public class SiteServer : MonoBehaviour {
|
||||||
public Core.SiteServer site;
|
public RoboidControl.SiteServer site;
|
||||||
|
|
||||||
public Queue<Core.Thing> thingQueue = new();
|
public Queue<RoboidControl.Thing> thingQueue = new();
|
||||||
|
|
||||||
protected virtual void Awake() {
|
protected virtual void Awake() {
|
||||||
Console.SetOut(new UnityLogWriter());
|
//Console.SetOut(new UnityLogWriter());
|
||||||
|
|
||||||
site = new(7681);
|
site = new(7681);
|
||||||
Core.Thing.OnNewThing += HandleNewThing;
|
RoboidControl.Thing.OnNewThing += HandleNewThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnApplicationQuit() {
|
void OnApplicationQuit() {
|
||||||
site.Close();
|
site.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleNewThing(Core.Thing thing) {
|
public void HandleNewThing(RoboidControl.Thing thing) {
|
||||||
site.Add(thing, false);
|
site.Add(thing, false);
|
||||||
thingQueue.Enqueue(thing);
|
thingQueue.Enqueue(thing);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Update() {
|
protected virtual void Update() {
|
||||||
site.Update((ulong)(Time.time * 1000));
|
site.Update((ulong)(Time.time * 1000));
|
||||||
while (thingQueue.TryDequeue(out Core.Thing thing))
|
while (thingQueue.TryDequeue(out RoboidControl.Thing thing))
|
||||||
thing.CreateComponent();
|
thing.CreateComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Passer.Control.Unity {
|
namespace Passer.RoboidControl.Unity {
|
||||||
|
|
||||||
public class Thing : MonoBehaviour {
|
public class Thing : MonoBehaviour {
|
||||||
|
|
||||||
[field: SerializeField]
|
[field: SerializeField]
|
||||||
public Core.Thing core {get; set; }
|
public RoboidControl.Thing core {get; set; }
|
||||||
|
|
||||||
protected void SetCoreThing(Core.Thing thing) {
|
protected void SetCoreThing(RoboidControl.Thing thing) {
|
||||||
core = thing;
|
core = thing;
|
||||||
core.component = this;
|
core.component = this;
|
||||||
|
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Passer.Control.Unity {
|
namespace Passer.RoboidControl.Unity {
|
||||||
|
|
||||||
public class TouchSensor : Thing {
|
public class TouchSensor : Thing {
|
||||||
|
|
||||||
public Core.TouchSensor coreSensor {
|
public RoboidControl.TouchSensor coreSensor {
|
||||||
get => (Core.TouchSensor)base.core;
|
get => (RoboidControl.TouchSensor)base.core;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Start() {
|
protected virtual void Start() {
|
||||||
if (core == null) {
|
if (core == null) {
|
||||||
SiteServer siteServer = FindAnyObjectByType<SiteServer>();
|
SiteServer siteServer = FindAnyObjectByType<SiteServer>();
|
||||||
SetCoreThing(new Core.TouchSensor(siteServer.site));
|
SetCoreThing(new RoboidControl.TouchSensor(siteServer.site));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TouchSensor Create(Core.TouchSensor core) {
|
public static TouchSensor Create(RoboidControl.TouchSensor core) {
|
||||||
GameObject gameObj = core.name != null ?
|
GameObject gameObj = core.name != null ?
|
||||||
new(core.name) :
|
new(core.name) :
|
||||||
new("Touch Sensor");
|
new("Touch Sensor");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user