void OnEnable() { //set this GameObject as a listener for the events coming from the Input System playerControls = new GameControls(); playerControls.Gameplay.SetCallbacks(this); playerControls.Enable(); }
public void Awake() { gameInputController = new GameControls(); gameInputController.GameControl.FreeCursor.started += _ => { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; }; gameInputController.GameControl.FreeCursor.canceled += _ => { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }; gameInputController.GameControl.Inventory.performed += _ => { InventoryPanel.SetActive(!InventoryPanel.activeSelf); if (InventoryPanel.activeSelf) { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; } else { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } }; gameInputController.GameControl.SpawnShip.performed += _ => { }; gameInputController.GameControl.SpawnStation.performed += _ => { }; }
//Move player position public void MovePlayer(GameControls input) { switch (input) { case GameControls.MoveUp: Move(new Point(0, -1), this); break; case GameControls.MoveRight: Move(new Point(+1, 0), this); break; case GameControls.MoveDown: Move(new Point(0, +1), this); break; case GameControls.MoveLeft: Move(new Point(-1, 0), this); break; case GameControls.Attack: Attack(); break; } }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "Jawaban") { TextMeshPro txtPilih = col.gameObject.GetComponent <TextMeshPro>(); //Debug.Log("OnCollisionEnter2D : " + txtPilih.text); if (GameAction.ARRAY_SOAL.Contains(txtPilih.text)) { TRUE_SOUND.Play(); GameAction.TRUE_ANS++; GameAction.KATA_JAWAB.Add(txtPilih.text); int idx = GameAction.ARRAY_BENAR.IndexOf(txtPilih.text); GameAction.KATA_SOAL[idx] = txtPilih.text; string strFix = string.Join(" ", GameAction.KATA_SOAL.ToArray()); strFix = strFix.ToLower(); strFix = GameControls.UppercaseWords(strFix); GameAction.TEXT_SOAL = strFix; GameAction.ARRAY_SOAL.Remove(txtPilih.text); if (GameAction.TRUE_ANS >= GameAction.ITEM_LEVEL[GameAction.GAME_LEVEL]) { GameAction.SCORES += 10; GameAction.GAME_STATUS = true; } } else { GameAction.TRY_COUNT++; WRONG_SOUND.Play(); } col.gameObject.transform.position = new Vector3(col.gameObject.transform.position.x - 1000, col.gameObject.transform.position.y); } }
public static bool GetInputUp(GameControls key) { if (keyValuePairs[key].keyCode != KeyCode.None) { return(Input.GetKeyUp(keyValuePairs[key].keyCode)); } else if (keyValuePairs[key].mouseCode != MouseCode.None) { switch (keyValuePairs[key].mouseCode) { case MouseCode.LeftMouseButton: return(Input.GetMouseButtonUp(0)); case MouseCode.RightMouseButton: return(Input.GetMouseButtonUp(1)); case MouseCode.MouseWheelUp: return(Input.mouseScrollDelta.y == 0); case MouseCode.MouseWheelDown: return(Input.mouseScrollDelta.y == 0); default: return(false); } } // The Game Control is not set, return false return(false); }
// Start is called before the first frame update private void Awake() { control = new GameControls(); control.MapCraftControls.Enable(); control.MapCraftControls.LeftClick.performed += _ => AddTarget(); control.MapCraftControls.RightClick.performed += _ => SubmitSelection(); }
public void StartRebindProcess(ControlRebindMessage eventMessage) { controlToBind = eventMessage.control; Rebinding = true; uiBlocker.SetActive(true); keybindExplanation.SetActive(true); }
// Start is called before the first frame update void Start() { resUI = GetComponent <ResUI>(); camera = GetComponentInParent <Camera>(); gameControls = GetComponent <GameControls>(); repairBuilding = GetComponent <RepairBuilding>(); }
private void Awake() { _controls = new GameControls(); _controls.Menu.Press.started += ctx => TouchStarted(ctx); _controls.Menu.Press.canceled += ctx => TouchCancelled(ctx); }
void Start() { _controls = new GameControls(); _controls.Enable(); _controls.Keyboard.Interact.performed += context => { Interact(); }; _controls.Keyboard.Throw.performed += context => { PickupThrow(); }; }
private void Start() { GetComponent <RectTransform>().anchoredPosition = Vector3.zero; GridCrafter.MenuOpen = true; control = new GameControls(); control.MapCraftControls.Enable(); }
void OnGUI() { GUILayout.Label("Input Settings", EditorStyles.boldLabel); GUILayout.Label("Face Buttons", EditorStyles.boldLabel); A_Button = (GameControls)EditorGUILayout.EnumPopup("A button:", A_Button); B_Button = (GameControls)EditorGUILayout.EnumPopup("B Button:", B_Button); X_Button = (GameControls)EditorGUILayout.EnumPopup("X Button:", X_Button); Y_Button = (GameControls)EditorGUILayout.EnumPopup("Y Button:", Y_Button); GUILayout.Label("triggers and bumpers", EditorStyles.boldLabel); Right_Bumper = (GameControls)EditorGUILayout.EnumPopup("Right Bumper:", Right_Bumper); Left_Bumper = (GameControls)EditorGUILayout.EnumPopup("Left Bumper:", Left_Bumper); //Right_Trigger = (GameControls)EditorGUILayout.EnumPopup("Right Trigger:", Right_Trigger); //Left_Trigger = (GameControls)EditorGUILayout.EnumPopup("Left Trigger:", Left_Trigger); GUILayout.Label("Number of Controllers", EditorStyles.boldLabel); noControllers = EditorGUILayout.IntPopup("How Many Controllers: ", noControllers, names, sizes); if (GUILayout.Button("Update Controls")) { UpdateControls(); } if (GUILayout.Button("Reset To Default")) { ResetControls(); } if (GUILayout.Button("Delete all inputs")) { DeleteControls(); } }
private void Awake() { //TODO: Make this *not* rely on the MainCamera just in case somebody de-tags it??? playerCamera = Camera.main; inputActions = new GameControls(); // Left inputActions.ZG_Main.LeftHand.performed += ctx => leftHandPos = ctx.ReadValue <Vector2>(); inputActions.ZG_Main.LeftHand.canceled += ctx => leftHandPos = Vector2.zero; inputActions.ZG_Main.LeftGrab.started += ctx => leftHand.OnGrab(playerCamera.transform.position); inputActions.ZG_Main.LeftGrab.performed += ctx => leftHand.state = HandState.HandState_Closed; inputActions.ZG_Main.LeftGrab.canceled += ctx => leftHand.state = HandState.HandState_Open; inputActions.ZG_Main.LeftGrab.canceled += ctx => leftHand.OnRelease(); // Right inputActions.ZG_Main.RightHand.performed += ctx => rightHandPos = ctx.ReadValue <Vector2>(); inputActions.ZG_Main.RightHand.canceled += ctx => rightHandPos = Vector2.zero; inputActions.ZG_Main.RightGrab.started += ctx => rightHand.OnGrab(playerCamera.transform.position); inputActions.ZG_Main.RightGrab.performed += ctx => rightHand.state = HandState.HandState_Closed; inputActions.ZG_Main.RightGrab.canceled += ctx => rightHand.state = HandState.HandState_Open; inputActions.ZG_Main.RightGrab.canceled += ctx => rightHand.OnRelease(); inputActions.ZG_Main.DisableLook.performed += ctx => disableLook = true; inputActions.ZG_Main.DisableLook.canceled += ctx => disableLook = false; leftHand.ownerPHC = this; rightHand.ownerPHC = this; }
private void Awake() { _controls = new GameControls(); _controls.Default.Space.performed += HandleSpace; _controls.Enable(); }
public void SetUp(float yPos, GameControls control, string keybind) { Control = control; gameControlText.text = control.ToString().AddSpacesBetweenCamelCase(); keyBindText.text = keybind; GetComponent <RectTransform>().localPosition = new Vector2(0, yPos); }
private void Awake() { Addressables.LoadAssetAsync <Sprite[]>(_assetReference).Completed += SpriteLoad; GameControls = new GameControls(); GameControls.Controls.Enable(); }
private void Awake() { input = new GameControls(); cGroup = GetComponent <CanvasGroup>(); colours[0] = new Color32(163, 163, 51, 255); colours[1] = selectionImage[0].color; maxPos = selectionImage.Length - 1; }
// Start is called before the first frame update void Start() { _gameControls = new GameControls(); _rigidbody2D = GetComponent <Rigidbody2D>(); _animator = GetComponent <Animator>(); _batteryLevel = 100f; GameManager.Instance.StartGame(); }
private void Awake() { if (camera == null) camera = GetComponent<Camera>(); if (texture == null) texture = CreateDummyTexture(); if (controls == null) controls = Controller.Controls; color.Changed += ctx => UpdateTexture(); controls.Player.Fire.performed += ctx => Execute(); }
void ButtonCreationHelper(int controller_id, GameControls control, int buttonID) { AddAxis(new InputAxis() { name = ammend(controller_id, control.ToString()), positiveButton = JoyStickButton(buttonID, controller_id + 1), joyNum = controller_id + 1 //reset to zero }); }
internal GameImages(ContentManager content) { Backgrounds = new GameBackgrounds(content); Controls = new GameControls(content); Ships = new GameShips(content); MiniShips = new GameMiniShips(content); NonPlayingObjects = new NonPlayingGameObjects(content); SecondaryWeapon = new GameSecondaryWeapon(content); Equipment = new GameEquipment(content); }
// Start is called before the first frame update void Start() { controls = GameManager.Manager.GameControls; Vector2 offset = new Vector2(transform.position.x, transform.position.z); Vector2 worldBorders = SquareGrid.MainGrid.GetWorldBorders(); topBorder = new Vector2(worldBorders.x + offset.x, worldBorders.y + offset.y); bottomBorder = new Vector2(offset.x, offset.y); }
private void OnEnable() { GameControls = new GameControls(); GameControls.Enable(); GameControls.CityBuilding.Movement.performed += CameraMovementEvent.Invoke; GameControls.CityBuilding.Rotation.performed += CameraRotationEvent.Invoke; GameControls.CityBuilding.Zoom.performed += CameraZoomEvent.Invoke; GameControls.CityBuilding.SelectionClick.performed += SelectionEvent.Invoke; }
public override void OnStartAuthority() { _cameraTransform.gameObject.SetActive(true); _controls = new GameControls(); _controls.Player.CameraMove.performed += SetPreviousInput; _controls.Player.CameraMove.canceled += SetPreviousInput; _controls.Enable(); }
void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
void SetupGameControls() { controls = new GameControls(); controls.Gameplay.PlayerMovement.performed += GetMovementInput; controls.Gameplay.PlayerMovement.canceled += GetMovementInput; controls.Gameplay.CameraMovementJoystick.performed += GetJoystickCameraInput; controls.Gameplay.CameraMovementJoystick.canceled += GetJoystickCameraInput; controls.Gameplay.Enable(); controls.UI.Pause.performed += OnPressedPause; controls.UI.Enable(); controls.ControlType.Enable(); }
public void Awake() { GameControls inputController = new GameControls(); inputController.GameControl.CursorLocation.performed += ctx => { Vector2 mousePos = ctx.ReadValue <Vector2>(); transform.position = new Vector3(mousePos.x, mousePos.y, -10); }; inputController.Enable(); }
private void Awake() { _shooter = GetComponent <PlayerShooter>(); _playerAnimator = GetComponent <PlayerAnimator>(); _mover = GetComponent <PlayerMover>(); _health = GetComponent <Health>(); _mana = GetComponent <Mana>(); _playerAudio = GetComponent <CharacterAudio>(); _gameControls = new GameControls(); _gameControls.Gameplay.Shoot.started += OnShootActionStarted; _gameControls.Gameplay.Shoot.canceled += OnShootActionCancelled; }
private IEnumerator StartBoilBuffer() { CBUG.Do("STARTING BOIL!!"); isBuffered = true; yield return(boilBuffer); if (CanBoil && !GameControls.IsQuizTime()) { IsBoiling = true; Tips.Spawn(0); } isBuffered = false; }
void Start() { start_head_rot = head.transform.rotation.eulerAngles; game_cont = game_controls.GetComponent<GameControls>(); }
// Use this for initialization void Start () { game_cont = game_controller.GetComponent<GameControls>(); obj_renderer = GetComponent<Renderer>(); obj_renderer.enabled = false; }
// Use this for initialization void Start() { gameControls = this; // INSTANTIATE THE GAMECONTROLS TO BE ABLE TO CHANGE VARIABLES FROM OUTSIDE THE SCRIPT spawnBall(); }