Пример #1
0
 private void Start()
 {
     localPlayer   = GameObject.Find("Player");
     control       = localPlayer.GetComponent <PlayerControl>();
     client        = GameObject.Find("GOIMP.Client").GetComponent <Client>();
     chatUi        = gameObject.AddComponent <ChatUI>();
     serverBrowser = gameObject.AddComponent <ServerBrowserUI>();
 }
Пример #2
0
        private void Start()
        {
            client  = GameObject.Find("GOIMP.Client").GetComponent <Client>() ?? throw new NotImplementedException("Could not find Client");
            control = GameObject.Find("Player").GetComponent <PlayerControl>() ?? throw new NotImplementedException("Could not find PlayerControl");

            GameObject uiObject = GameObject.Find("GOIMP.UI") ?? throw new NotImplementedException("Could not find Player object");

            chat = uiObject.GetComponent <ChatUI>() ?? throw new NotImplementedException("Could not find ChatUI");

            players.Add(control.gameObject.GetComponent <LocalPlayer>() ?? throw new NotImplementedException("Could not find LocalPlayer"));

            waterObject = GameObject.Find("Splashes") ?? throw new NotImplementedException("Could not find Splashes");
            waterHeight = waterObject.transform.position.y;

            client.PlayerJoined += (sender, args) => players.Add(args.Player);
            client.PlayerLeft   += (sender, args) => players.Remove(args.Player);
        }