void OnTriggerEnter2D(Collider2D other) { Robot robot = other.gameObject.GetComponent <Robot>(); //Trigger if the object is the player controlled robot if (robot != null && robot.IsControlledCharacter()) { robotToWake.Activate(true); //global.currentRobot = ; //TODO: Do we want to switch to the new robot automaticaly? } }
static async Task Main(string[] args) { using var loggerFactory = LoggerFactory.Create(opts => opts.AddConsole().SetMinimumLevel(LogLevel.Information)); var portName = SerialPort.GetPortNames().FirstOrDefault(); using var port = new SerialPort(portName, 115200); port.Open(); using var dispatcher = new OIDispatcher(port, loggerFactory.CreateLogger <OIDispatcher>()); var sensorReader = new SensorReader(dispatcher, loggerFactory.CreateLogger <SensorReader>()); var ioSensor = new OISensor(sensorReader); var robot = new Robot(dispatcher, ioSensor, loggerFactory.CreateLogger <Robot>()); await robot.Reset(); Console.WriteLine($"IO Mode: {robot.CurrentMode}"); await robot.Start(); Console.WriteLine($"IO Mode: {robot.CurrentMode}"); await robot.Activate(); Console.WriteLine($"IO Mode: {robot.CurrentMode}"); await robot.Stop(); }