void Awake() { _input = new PlayerAction.PlayerActions(new PlayerAction()); _input.SetCallbacks(this); _car = Instantiate(_carTemplate, _spawnTarget.transform.position, Quaternion.identity); }
private void Start() { rb = GetComponent <Rigidbody2D>(); identity = GetComponent <NetworkIdentity>(); cameraController = FindObjectOfType <CameraController>(); playerController = GetComponent <PlayerCharacterController>(); leaveButton = GameObject.Find("UI").transform.Find("LeaveButton").GetComponent <Button>(); leaveButton.onClick.AddListener(LeftController); controlsButton = GameObject.Find("Game/UI/SubmarineControls"); PlayerAction action = new PlayerAction(); playerAction = action.Player; playerAction.EnterStation.performed += OnStationClick; playerAction.Enable(); PauseMenu.IsEnabled = true; }
private void Awake() { action = new PlayerAction(); PlayerAction.PlayerActions playerAction = action.Player; playerAction.Move.performed += OnMove; playerAction.JumpClimbUp.performed += OnJump; playerAction.ClimbDown.performed += OnClimbDown; //In order to stop climbing when the button is released playerAction.JumpClimbUp.canceled += OnJump; playerAction.ClimbDown.canceled += OnClimbDown; playerAction.Enable(); rb = GetComponent <Rigidbody2D>(); playerSize = GetComponent <BoxCollider2D>().size; spriteRendered = GetComponent <SpriteRenderer>(); boxSize = new Vector2(playerSize.x, groundBuffer); identity = GetComponent <NetworkIdentity>(); }