Last active
January 15, 2022 18:19
-
-
Save ManickYoj/fb07be14e7ed1f6233b546058b16fe91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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