private void FixedUpdate() { // Read the inputs. bool crouch = Input.GetKey(KeyCode.LeftControl); //float h = CrossPlatformInputManager.GetAxis("Horizontal"); //my code float h = 0; if (CoopWorldInput.GetKey(coopPlayerId, CoopWorldInput.CoopKeyCode.Left)) { h = -1; Debug.Log("Moving Character Left"); } else if (CoopWorldInput.GetKey(coopPlayerId, CoopWorldInput.CoopKeyCode.Right)) { h = 1; Debug.Log("Moving Character Right"); } //float h = CoopWorldInput; // CrossPlatformInputManager.VirtualButton btn = new CrossPlatformInputManager.VirtualButton ("remoteLeft"); // CrossPlatformInputManager.RegisterVirtualButton (btn); // if (Input.GetKeyDown (KeyCode.K)) { // btn.Pressed (); // } // Pass all parameters to the character control script. m_Character.Move(h, crouch, m_Jump); m_Jump = false; }
// Use this for initialization void Start() { Debug.Log("starting!"); CoopWorldInput.Init(); CoopEvents.Instance.RegisterToConnectEvent(Spawn); InvokeRepeating("HandleCoopEvents", 0, 0.2f); }
// This function is called when the MonoBehaviour will be destroyed public void OnDestroy() { CoopWorldInput.Destroy(); }