Liberi
An exergame built for kids with CP!
FireAntBike.cs
1 using UnityEngine;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.Diagnostics;
5 
9 public class FireAntBike : Device
10 {
11  int _cadence;
12 
13  void OnEnable()
14  {
15  UJeli configOptions;
16  GameClient.Instance.Config.Devices.Options.TryGetValue(name, out configOptions);
17  DeviceManager.Instance.ConfigureFireAnt();
18  DeviceManager.Instance.FireAntProcess.OutputDataReceived += OnFireAntOutput;
19  DeviceManager.Instance.StartFireAnt();
20  }
21 
22  void OnFireAntOutput(object sender, DataReceivedEventArgs e)
23  {
24  if (e.Data != null)
25  {
26  string[] args = e.Data.Split();
27  _cadence = int.Parse(args[1]);
28 
29  Controls.InjectSmoothCadence((float)_cadence);
30  }
31  }
32 }
static DeviceManager Instance
Gets the sole instance of the device manager.
Abstract class to be extended by devices.
Definition: Device.cs:7
static void InjectSmoothCadence(float cadence)
Injects a power value.
Definition: Controls.cs:109
A Device for providing power information to the Controls class from Fireant.
Definition: FireAntBike.cs:9
ClientConfig Config
Gets the configuration for this client.
Definition: GameClient.cs:176
static GameClient Instance
Gets the sole instance of the game client.
Definition: GameClient.cs:136
Manages game devices.
Main game client class.
Definition: GameClient.cs:16
Unity version of Jeli markup class.
Definition: UJeli.cs:10
Controls class. Allows for controls queries and controls injection from devices.
Definition: Controls.cs:41