Last active
January 2, 2022 22:16
-
-
Save ManickYoj/c763cf76b96378f2ceb6301618e9fc07 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
[RequireComponent(typeof(PlayerInput))] | |
public class Transmitter : MonoBehaviour { | |
private Receiver receiver; | |
private PlayerInput playerInput; | |
void Start() { | |
this.playerInput = this.GetComponent<PlayerInput>(); | |
this.playerInput.enabled = true; | |
Registry.Instance.GetNewReceiver(this); | |
} | |
public void Connect(Receiver receiver) { | |
// Somewhat clumsily, be sure that evey other possible camera is disabled | |
// we activate the new one. | |
foreach(Camera c in Camera.allCameras) c.gameObject.SetActive(false); | |
this.receiver = receiver; | |
this.receiver.receiverCamera.gameObject.SetActive(true); | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment