Commit a29c9062 authored by Sebastian Höffner's avatar Sebastian Höffner
Browse files

Removing double Communication.cs

parent 78fb67b0
using UnityEngine;
using System.Collections;
using SimpleJSON;
namespace dlu
{
public abstract class Communication : MonoBehaviour
{
public SceneController sceneController;
void Awake()
{
if (sceneController == null)
{
sceneController = GetComponent<SceneController>();
}
StartServer();
}
protected abstract void StartServer();
protected void HandleRequest(JSONObject requestObject)
{
string command = requestObject["Command"];
Debug.Log($"[Communication] Command: '{command}'");
switch(command)
{
case "RESET_SCENE":
StartCoroutine(sceneController.ResetScene(ReplyToRequest));
break;
case "GET_CONTEXT":
StartCoroutine(sceneController.GetContext(ReplyToRequest));
break;
case "GET_OCCUPANCY":
StartCoroutine(sceneController.GenerateOccupancyGrid(float.Parse(requestObject["resolution"]), requestObject["exclude"] as JSONArray, ReplyToRequest));
break;
case "SIMULATE_SCENE":
StartCoroutine(sceneController.RunSimulation(requestObject["instructions"] as JSONArray, ReplyToRequest));
break;
default:
StartCoroutine(ReplyToRequest("{\"Error\": \"Server does not understand this command.\"}"));
break;
}
}
public abstract IEnumerator ReplyToRequest(string response);
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 429a7dfc7a7974ccb8f8925740a5b392
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment