void SetupInput() { inputActions = new PlayerInputMap(); inputActions.UI.Up.performed += delegate { selected.Up(ref selected); }; inputActions.UI.Down.performed += delegate { selected.Down(ref selected); }; inputActions.UI.Cancel.performed += delegate { GameMgr.mgr.ResumeGame(); }; inputActions.UI.Submit.performed += delegate { selected.Submit(); }; }
void Awake() { animator = GetComponentInChildren <Animator>(); rb = GetComponent <Rigidbody2D>(); controls = new PlayerInputMap(); left = new Vector2(1f, 1f); right = new Vector2(-1f, 1f); }
void Awake() { instance = this; rb = GetComponent <Rigidbody2D>(); controls = new PlayerInputMap(); playerCombat = GetComponent <PlayerCombat>(); left = new Vector2(1f, 1f); right = new Vector2(-1f, 1f); }
public void Enter(PlayerInputMap playerInput) { if (!enabled) { PlayerInput = playerInput; enabled = true; foreach (var transition in _transitions) { transition.enabled = true; } } }
void Awake() { sceneHandler = FindObjectOfType <ScreenFadeHandler>(); playerStats = FindObjectOfType <PlayerStats>(); playerCount = FindObjectOfType <PlayerCount>(); playerSpawner = FindObjectOfType <PlayerSpawner>(); //playerCombat = FindObjectOfType<PlayerCombat>(); playerInput = GetComponent <PlayerInput>(); controls = new PlayerInputMap(); if (playerCount != null) { playerCount.AddPlayerInputManager(gameObject); } }
void SetupInput() { inputActions = new PlayerInputMap(); inputActions.Playing.Move.performed += UpdateMoveVelocity; inputActions.Playing.Move.canceled += UpdateMoveVelocity; inputActions.Playing.Dash.performed += DashPerform; inputActions.Playing.Shoot.performed += ShootPerform; inputActions.Playing.MouseMove.performed += UpdateMousePosition; inputActions.Playing.MouseMove.canceled += UpdateMousePosition; inputActions.Playing.RotateCrosshair.performed += RotateCrosshair; inputActions.Playing.RotateCrosshair.canceled += RotateCrosshair; inputActions.Playing.Pause.performed += delegate { GameMgr.mgr.PauseGame(); }; }
void Awake() { // INITIALIZE STATIC PROPERTIES CollisionMap = new bool[MAX_TILE_SIZE, MAX_TILE_SIZE]; Food = new Collection <Vector2Int>(); Eggs = new Dictionary <Vector2Int, int>(); Walls = new Collection <Vector2Int>(); EnemySnakes = new List <Snake>(); Wobbles = new Dictionary <Vector2Int, Wobble>(); Score = 0; ScoreTextObject = GameObject.Find("ScoreText"); if (ScoreTextObject == null) { Debug.LogError("ScoreText object not found."); } GameAssets.Sound.SnekDance.Play(); SetTileDimension(9f); PlayerSnake = new Snake(true, new Vector2Int(CENTER_TILE_INDEX, CENTER_TILE_INDEX), 0, 0); if (AIMODE) { AddEnemySnake(new Vector2Int(TileIndexMin, CENTER_TILE_INDEX), 1); AddEnemySnake(new Vector2Int(TileIndexMax, CENTER_TILE_INDEX), 1); AddEnemySnake(new Vector2Int(CENTER_TILE_INDEX, TileIndexMin), 1); AddEnemySnake(new Vector2Int(CENTER_TILE_INDEX, TileIndexMax), 1); } Inputs = new PlayerInputMap(); Inputs.Enable(); Inputs.Player.Move.performed += ctx => Movement = ctx.ReadValue <Vector2>(); PlaceRandomFood(); PlaceWall(new Vector2Int(49, 49)); UpdateProgressBar(); }
void Awake() { sceneHandler = FindObjectOfType <SceneHandler>(); playerStats = FindObjectOfType <PlayerStats>(); playerCount = FindObjectOfType <PlayerCount>(); playerInput = GetComponent <PlayerInput>(); playerCombat = FindObjectOfType <PlayerCombat>(); controls = new PlayerInputMap(); playerCount.AddPlayer(gameObject); // Creates an array of PlayerMovement scripts for each player var playerControllers = FindObjectsOfType <PlayerMovement>(); var playerCombats = FindObjectsOfType <PlayerCombat>(); // Creates variable that holds the index of the player var index = playerInput.playerIndex; // Takes the first controller to give input and assigns it to index 0, continues till 4 players have joined with the final index "3" playerMovement = playerControllers.FirstOrDefault(m => m.GetPlayerIndex() == index); playerCombat = playerCombats.FirstOrDefault(m => m.GetPlayerIndex() == index); Debug.Log(index); }
private void Awake() { _playerInput = new PlayerInputMap(); }