void Start() { charCtrl = GetComponent <CharacterController>(); if (!isLocalPlayer) { stateHandler = gameObject.AddComponent <AuthCharObserver>(); return; } GetComponentInChildren <Renderer>().material.color = Color.green; stateHandler = gameObject.AddComponent <AuthCharPredictor>(); gameObject.AddComponent <AuthCharInput>(); }
void Start() { //REMOTE PLAYER ONLY if (!isLocalPlayer) { stateHandler = gameObject.GetComponent <RemoteCharacterObsever>();//used to observer the state of this player on the server return; } //LOCAL PLAYER ONLY GetComponentInChildren <Renderer>().material.color = Color.green; //make our character green stateHandler = gameObject.GetComponent <CharacterPredictor>(); //used to predict the state of our local player gameObject.GetComponent <AuthCharInput>(); //used to make local input and transmit it to server }