// Use this for initialization void Start() { cvar_watcher = Server_watcher.Singleton; msg_watcher = cvar_watcher.GetComponent <Message_board_watcher>(); if (!isLocalPlayer) { state_update = Update_inGame; return; } cvar_watcher.local_player = this; GUI = Instantiate(GUI_template).GetComponent <GUI_manager>(); GUI.cvar_watcher = cvar_watcher; GUI_template = null; if (character_type == Body_generic.Character_type.Observer) { GUI.observer_healthbar.gameObject.SetActive(true); GetComponent <Observer_controller>().health_bar = GUI.observer_healthbar; GetComponent <Observer_controller>().debug_info = GUI.debug_info; } else { GetComponent <Player_controller>().debug_info = GUI.debug_info; } cvar_watcher.onClientReady.Add(GUI.OnClientReady); state_update = Update_waitingReady; }
/// <summary> /// Started when all clients are ready, in game state /// </summary> void Update_inGame() { if (isLocalPlayer) { //Client interface latency_test(); //Chat if (Input.GetKeyDown(toggleChat)) { msg_watcher = FindObjectOfType <Message_board_watcher>(); if (msg_watcher != null)//Start editing { msg_watcher.Turnon_chat(); } } if (Input.GetKeyDown(toggleScoreBoard)) { GUI.scoreBoard.SetActive(true); GUI.scoreBoardUpdate(); } else if (Input.GetKeyUp(toggleScoreBoard)) { GUI.scoreBoard.SetActive(false); } } }
// Use this for initialization void Start() { cvar_watcher = FindObjectOfType <Server_watcher>();//Need to register on all end cuz its required by timescale if (!isLocalPlayer) { return; } msg_watcher = FindObjectOfType <Message_board_watcher>(); obRB = GetComponent <Rigidbody2D>(); interpolator = GetComponent <Interpolator_generic>(); GetComponent <SpriteRenderer>().enabled = true; mainCam = Camera.main; main_camera = mainCam.transform; Destroy(main_camera.GetComponent <Fisheye>()); Destroy(main_camera.GetComponent <ColorCorrectionCurves>()); Destroy(main_camera.GetComponent <BlurOptimized>()); Destroy(main_camera.GetComponent <ContrastStretch>()); Destroy(main_camera.GetComponent <NoiseAndGrain>()); Destroy(main_camera.GetComponent <VignetteAndChromaticAberration>()); //debug_info = GameObject.Find("Debug_log").GetComponent<Text>(); cam3D = GameObject.Find("Background3D_Camera").transform; Destroy(GameObject.Find("Darkness")); Destroy(GameObject.Find("Fade_view")); characters = FindObjectsOfType <Body_generic>(); StartCoroutine(fetch_characters()); }
/*Unity functions*/ //Initialization void Start() { Singleton = this; message_watcher = GetComponent <Message_board_watcher>(); lobbyManager = FindObjectOfType <Prototype.NetworkLobby.LobbyManager>(); onClientReady = new List <Action>(); lobbyManager.cvar_watcher = this; DontDestroyOnLoad(gameObject); }
void Update() { if (Input.GetKeyDown(toggleChat)) { Message_board_watcher msg_watcher = FindObjectOfType <Message_board_watcher>(); if (msg_watcher != null) //Start editing { msg_watcher.Turnon_chat(); } } }