Skip to content

Instantly share code, notes, and snippets.

@ManickYoj
Last active January 15, 2022 18:19
Show Gist options
  • Save ManickYoj/fb07be14e7ed1f6233b546058b16fe91 to your computer and use it in GitHub Desktop.
Save ManickYoj/fb07be14e7ed1f6233b546058b16fe91 to your computer and use it in GitHub Desktop.
class Transmitter : MonoBehaviour {
// ...
public void OnSwitchReceiver(InputValue inputValue) {
Registry.GetNewReceiver(this);
}
public void Disconnect(Receiver receiver) {
receiver.SendCommand("OnDisconnect");
}
public void OnMove(InputValue inputValue) {
if (receiver != null) receiver.SendCommand("OnMove", inputValue.Get<Vector2>());
}
// This one is a dud: we don't have anything in this scene
// that accepts an OnFire command ! But in a tank scene
// we may well add one and in the meantime it tests
// that there aren't any bugs with sending commands that
// aren't acted upon
public void OnFire(InputValue inputValue) {
if (receiver != null) receiver.SendCommand("OnFire");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment