Updated namespaces

This commit is contained in:
Pascal Serrarens 2025-02-19 14:50:09 +01:00
parent d3e12c16f2
commit a1d89ff1f7
6 changed files with 18 additions and 20 deletions

View File

@ -1,4 +1,4 @@
namespace Passer.RoboidControl.Core {
namespace Passer.RoboidControl {
public class TouchSensor : Thing {
public bool touchedSomething = false;

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 718e148be3eeb65498334ed008747482

View File

@ -2,7 +2,7 @@
using System.Collections;
using UnityEngine;
namespace Passer.Control.Unity {
namespace Passer.RoboidControl.Unity {
public class DistanceSensor : Thing {
@ -20,7 +20,7 @@ namespace Passer.Control.Unity {
StartCoroutine(MeasureDistance());
}
public static DistanceSensor Create(Core.Thing parent) {
public static DistanceSensor Create(RoboidControl.Thing parent) {
GameObject distanceObj = new("Distance sensor");
DistanceSensor component = distanceObj.AddComponent<DistanceSensor>();
if (parent != null && parent.component != null)

View File

@ -3,32 +3,32 @@ using System;
using System.Collections.Generic;
using UnityEngine;
namespace Passer.Control.Unity {
namespace Passer.RoboidControl.Unity {
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() {
Console.SetOut(new UnityLogWriter());
//Console.SetOut(new UnityLogWriter());
site = new(7681);
Core.Thing.OnNewThing += HandleNewThing;
RoboidControl.Thing.OnNewThing += HandleNewThing;
}
void OnApplicationQuit() {
site.Close();
}
public void HandleNewThing(Core.Thing thing) {
public void HandleNewThing(RoboidControl.Thing thing) {
site.Add(thing, false);
thingQueue.Enqueue(thing);
}
protected virtual void Update() {
site.Update((ulong)(Time.time * 1000));
while (thingQueue.TryDequeue(out Core.Thing thing))
while (thingQueue.TryDequeue(out RoboidControl.Thing thing))
thing.CreateComponent();
}
}

View File

@ -1,14 +1,14 @@
#if UNITY_5_3_OR_NEWER
using UnityEngine;
namespace Passer.Control.Unity {
namespace Passer.RoboidControl.Unity {
public class Thing : MonoBehaviour {
[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.component = this;

View File

@ -1,23 +1,23 @@
#if UNITY_5_3_OR_NEWER
using UnityEngine;
namespace Passer.Control.Unity {
namespace Passer.RoboidControl.Unity {
public class TouchSensor : Thing {
public Core.TouchSensor coreSensor {
get => (Core.TouchSensor)base.core;
public RoboidControl.TouchSensor coreSensor {
get => (RoboidControl.TouchSensor)base.core;
}
protected virtual void Start() {
if (core == null) {
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 ?
new(core.name) :
new("Touch Sensor");