Ejemplo n.º 1
0
    //private bool menuOpen;

    private void Awake()
    {
        //instance = this;

        controls = new PlayerInputActions();
        controls.Player.Movement.performed += ctx => Move(ctx.ReadValue <Vector2>());
        controls.Player.Movement.canceled  += context => MoveCancelled(context.ReadValue <Vector2>());

        controls.Player.Inventory.performed += ctx => Inventory();


        //controls.Player.Movement.performed += context => Move(context.ReadValue<Vector2>());

        //        controls.Player.Select.performed += context => InventoryItemAction(0);      // Select
        //        controls.Player.Drop.performed += context => InventoryItemAction(1);        // Drop
        //        controls.Player.Swap.performed += context => InventoryItemAction(2);        // Swap
        //        controls.Player.Cancel.performed += context => InventoryItemAction(3);      // Cancel

        //        controls.Player.StartMenu.performed += context => StartMenu();
        //        controls.Player.Inventory.performed += context => InventoryButton();
        //        controls.Player.Sprint.performed += context => speed = 10.0f;
        //        controls.Player.Sprint.canceled += context => speed = 7f;
        //        //controls.Player.Movement.performed += context => directionFacing = context.ReadValue<Vector2>();
        //controls.Player.Movement.canceled += context => directionFacing = context.ReadValue<Vector2>();

        //        invMenuOpen = false;
        //        startMenuOpen = false;
        //        manipulatingItem = false;
    }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Awake()
 {
     inputAction = new PlayerInputActions();
     inputAction.PlayerControls.Walk.performed += ctx => navigationInput = ctx.ReadValue <Vector2>();
     //Setup input for horizontal movement release
     inputAction.PlayerControls.Walk.canceled += ctx => navigationInput = ctx.ReadValue <Vector2>();
 }
Ejemplo n.º 3
0
        private void InitializeInputSystem()
        {
            _inputActionsVar = new PlayerInputActions();

            _inputActionsVar.PlayerControls.Fire.performed        += FireProjectile;
            _inputActionsVar.PlayerControls.ContextMenu.performed += SpecialAction;
        }
Ejemplo n.º 4
0
 void Awake()
 {
     this.playerActions    = new PlayerInputActions();
     this.spawnManager     = GameObject.Find(SpawnManager.NAME).GetComponent <SpawnManager>();
     this.uiManager        = GameObject.Find(UIManager.NAME).GetComponent <UIManager>();
     this.laserAudioSource = GetComponent <AudioSource>();
 }
Ejemplo n.º 5
0
        private void Awake()
        {
            _playerInputActions = new PlayerInputActions();

            _playerInputActions.PlayerControls.Move.performed  += HandlePlayerMoved;
            _playerInputActions.PlayerControls.Shoot.performed += HandlePlayerShot;
        }
    private void Awake()
    {
        dialogText.text = "";

        _inputAction = new PlayerInputActions();
        // _inputAction.DialogControls.NextDialog.performed += ctx => dialogControlClicked = true;
    }
Ejemplo n.º 7
0
    void Awake()
    {
        //Physics
        rb = GetComponent <Rigidbody>();

        //Input
        inputAction = new PlayerInputActions();

        if (playerNumber == 1)
        {
            inputAction.PlayerControls.P1Move.performed     += ctx => moveInput = ctx.ReadValue <Vector2>();
            inputAction.PlayerControls.P1Jump.performed     += ctx => jumpInput = ctx.ReadValue <float>();
            inputAction.PlayerControls.P1Dash.performed     += ctx => dashInput = ctx.ReadValue <float>();
            inputAction.PlayerControls.P1Interact.performed += ctx => interactInput = ctx.ReadValue <float>();
            inputAction.PlayerControls.P1Throw.performed    += ctx => throwInput = ctx.ReadValue <float>();
            inputAction.PlayerControls.P1Use.performed      += ctx => useInput = ctx.ReadValue <float>();
        }
        else if (playerNumber == 2)
        {
            inputAction.PlayerControls.P2Aim.performed      += ctx => cursorInput = ctx.ReadValue <Vector2>();
            inputAction.PlayerControls.P2Move.performed     += ctx => moveInput = ctx.ReadValue <Vector2>();
            inputAction.PlayerControls.P2Jump.performed     += ctx => jumpInput = ctx.ReadValue <float>();
            inputAction.PlayerControls.P2Dash.performed     += ctx => dashInput = ctx.ReadValue <float>();
            inputAction.PlayerControls.P2Interact.performed += ctx => interactInput = ctx.ReadValue <float>();
            inputAction.PlayerControls.P2Throw.performed    += ctx => throwInput = ctx.ReadValue <float>();
            inputAction.PlayerControls.P2Use.performed      += ctx => useInput = ctx.ReadValue <float>();
        }
    }
Ejemplo n.º 8
0
        protected override void OnCreate()
        {
            base.OnCreate();

            _playerInputActions = new PlayerInputActions();
            _playerInputActions.PlayerControls.SetCallbacks(this);
        }
Ejemplo n.º 9
0
    void Awake()
    {
        inputActions = new PlayerInputActions();
        inputActions.PlayerControls.Movement.performed += context => movementInput = context.ReadValue <Vector2>();

        rigidBody = GetComponent <Rigidbody2D>();
    }
    protected override void OnCreate()
    {
        playerInput = new PlayerInputActions();
        playerInput.Enable();
        pInput = playerInput.Player;

        bulletArchetype = EntityManager.CreateArchetype(
            typeof(LocalToWorld),
            typeof(Translation),
            typeof(Rotation),
            typeof(Scale),
            typeof(Velocity),
            typeof(Speed),
            typeof(Lifetime),
            typeof(Faction),
            typeof(ColliderComponent),
            typeof(RenderBounds),
            typeof(RenderMesh),
            typeof(Bullet));
        Addressables.LoadAssetAsync <BulletPrefabList>("BulletPrefabList").Completed += OnBulletPrefabListLoadDone;
        var query = new EntityQueryDesc
        {
            All = new ComponentType[] { typeof(BulletPrefabListComponent) }
        };

        bulletPrefabListQuery = GetEntityQuery(query);
    }
Ejemplo n.º 11
0
    // Awake
    void Awake()
    {
        // Component setup
        inputActions     = new PlayerInputActions();
        inputComponent   = this.GetComponentInParent <PlayerInput>();
        triggeredActions = new Dictionary <string, bool>();
        bufferCoroutines = new Dictionary <string, IEnumerator>();
        heldActions      = new Dictionary <string, bool>();

        // Axis init
        mouseAxis = Vector2.zero;

        // Queue setup
        inputQueueActions     = new Queue <string>();
        inputQueueExpirations = new Queue <float>();

        // Subscribed actions
        inputActions.PlayerControls.Action1.performed += context => BufferInput(context);
        inputActions.PlayerControls.Action2.performed += context => BufferInput(context);
        inputActions.PlayerControls.Action3.performed += context => BufferInput(context);
        inputActions.PlayerControls.Action4.performed += context => BufferInput(context);

        inputActions.InspectControls.Exit.performed += context => BufferInput(context);

        inputActions.LockControls.ExitLock.performed         += context => BufferInput(context);
        inputActions.LockControls.EnterCombination.performed += context => BufferInput(context);
    }
Ejemplo n.º 12
0
 // Start is called before the first frame update
 void Awake()
 {
     if (players.Length == 0)//For debug, sometimes there may already be players in the array for debug purposes
     {
         players = new GameObject[4];
     }
     GameObject[] playerInfo = GameObject.FindGameObjectsWithTag("SpellSelectCursor");
     for (int i = 0; i < playerInfo.Length; i++)
     {
         //create player in world at spawn point
         GameObject player = Instantiate(Resources.Load <GameObject>("Prefabs/Wizard"), playerSpawnPoints[i], Quaternion.identity);
         //Add the player's selected spells to the created player object
         GameObject[] playerSpells = playerInfo[i].GetComponent <SpellSelectScript>().GetSpellSelection();
         for (int s = 0; s < playerSpells.Length; s++)
         {
             player.GetComponent <PlayerSpellcasting>().AddSpellToSlot(playerSpells[s]);
         }
         //Track player
         players[i] = player;
         players[i].GetComponent <PlayerInputScript>().SetPlayerNumber(i);
         //Get rid of extraneous cursor object
         Destroy(playerInfo[i]);
     }
     //Get Pause input
     inputAction = new PlayerInputActions();
     inputAction.PlayerControls.Pause.performed += ctx => pauseInput = ctx.ReadValue <float>();
     inputAction.PlayerControls.Pause.canceled  += ctx => pauseInput = ctx.ReadValue <float>();
 }
Ejemplo n.º 13
0
    private static void Scheme_B_KeyboardInputs(ref PlayerInputActions playerInputActions)
    {
        //playerInputActions.Device =  //TODO: find keyboard device!
        if (isInverted)
        {
            playerInputActions.menuLeft.AddDefaultBinding(Key.RightArrow);
            playerInputActions.menuRight.AddDefaultBinding(Key.LeftArrow);
            playerInputActions.menuUp.AddDefaultBinding(Key.DownArrow);
            playerInputActions.menuDown.AddDefaultBinding(Key.UpArrow);
            playerInputActions.menuSelect.AddDefaultBinding(Key.Return);

            playerInputActions.left.AddDefaultBinding(Key.D);
            playerInputActions.right.AddDefaultBinding(Key.A);
            playerInputActions.up.AddDefaultBinding(Key.S);
            playerInputActions.down.AddDefaultBinding(Key.W);

            playerInputActions.menuSelect.AddDefaultBinding(Key.K);
            playerInputActions.interact.AddDefaultBinding(Key.K);

            playerInputActions.pause.AddDefaultBinding(Key.Escape);
            playerInputActions.pause.AddDefaultBinding(Key.Tab);
            playerInputActions.back.AddDefaultBinding(Key.J);
            playerInputActions.secondAttack.AddDefaultBinding(Key.J);
            playerInputActions.thirdAttack.AddDefaultBinding(Key.O);

            playerInputActions.roll.AddDefaultBinding(Key.LeftShift);
            playerInputActions.previousTrack.AddDefaultBinding(Key.Q);
            playerInputActions.nextTrack.AddDefaultBinding(Key.E);

            playerInputActions.dance.AddDefaultBinding(Key.J);
        }
        else
        {
            playerInputActions.menuLeft.AddDefaultBinding(Key.LeftArrow);
            playerInputActions.menuRight.AddDefaultBinding(Key.RightArrow);
            playerInputActions.menuUp.AddDefaultBinding(Key.UpArrow);
            playerInputActions.menuDown.AddDefaultBinding(Key.DownArrow);
            playerInputActions.menuSelect.AddDefaultBinding(Key.Return);

            playerInputActions.left.AddDefaultBinding(Key.A);
            playerInputActions.right.AddDefaultBinding(Key.D);
            playerInputActions.up.AddDefaultBinding(Key.W);
            playerInputActions.down.AddDefaultBinding(Key.S);

            playerInputActions.menuSelect.AddDefaultBinding(Key.J);
            playerInputActions.interact.AddDefaultBinding(Key.J);

            playerInputActions.pause.AddDefaultBinding(Key.Escape);
            playerInputActions.pause.AddDefaultBinding(Key.Tab);
            playerInputActions.back.AddDefaultBinding(Key.K);
            playerInputActions.secondAttack.AddDefaultBinding(Key.K);
            playerInputActions.thirdAttack.AddDefaultBinding(Key.I);

            playerInputActions.roll.AddDefaultBinding(Key.LeftShift);
            playerInputActions.previousTrack.AddDefaultBinding(Key.Q);
            playerInputActions.nextTrack.AddDefaultBinding(Key.E);

            playerInputActions.dance.AddDefaultBinding(Key.O);
        }
    }
Ejemplo n.º 14
0
 void Awake()
 {
     //InputActions
     _inputAction = new PlayerInputActions();
     boostAction  = _inputAction.Player.Boost;
     _remindBoost = true;
 }
Ejemplo n.º 15
0
 void InitializeInputControls()
 {
     if (controls == null)
     {
         controls = new PlayerInputActions();                   //Grab reference to Input System Asset "Controls"
     }
 }
Ejemplo n.º 16
0
 void Awake()
 {
     //InputActions
     _inputAction   = new PlayerInputActions();
     cancel         = _inputAction.UI.Cancel;
     Time.timeScale = 1f;
 }
Ejemplo n.º 17
0
 protected virtual void Awake()
 {
     levelManager = GameObject.FindGameObjectWithTag("LevelController").GetComponent <LevelManager>();
     inputActions = new PlayerInputActions();
     inputActions.UI.CloseDialog.Enable();
     inputActions.UI.Pause.Enable();
 }
Ejemplo n.º 18
0
 void Awake()
 {
     rbody_        = GetComponent <Rigidbody2D>();
     renderer_     = GetComponentInChildren <PlayerRenderer>();
     input_action_ = new PlayerInputActions();
     input_action_.PlayerControls.Move.performed += ctx => movement_input_ = ctx.ReadValue <Vector2>();
 }
Ejemplo n.º 19
0
    void Awake()
    {
        //InputActions
        _inputAction = new PlayerInputActions();

        mapAction = _inputAction.Player.Map;
    }
    protected override void Initialize()
    {
        Debug.Log("GameManager.Initialize()");
        base.Initialize();

        events = new EventManager();
        EventManager.OnSceneLoadEnd += OnSceneLoadEnd;

        resources = new int[startResources.Length];
        for (int i = 0; i < startResources.Length; ++i)
        {
            resources[i] = startResources[i];
        }

        actions = new PlayerInputActions();
        actions.Enable();

        StartCoroutine(DelayedSetup());

        IEnumerator DelayedSetup()
        {
            yield return(null);

            yield return(null);

            events.CallOnOnApplicationStart();
            events.CallOnSceneLoadEnd(null);
        }
    }
Ejemplo n.º 21
0
 void Awake()
 {
     //Cursor.lockState = CursorLockMode.Locked;
     if (photonView.IsMine)
     {
         anim                  = GetComponent <Animator>();
         bulletLine            = GetComponent <LineRenderer>();
         healthSlider.maxValue = health;
         healthSlider.value    = health;
         isDead                = false;
         inputActions          = new PlayerInputActions();
         inputActions.PlayerActions.Move.performed   += ctx => movementInput = ctx.ReadValue <Vector2>();
         inputActions.PlayerActions.Move.canceled    += ctx => movementInput = ctx.ReadValue <Vector2>();
         inputActions.PlayerActions.Sprint.performed += ctx => isRunning = true;
         inputActions.PlayerActions.Sprint.canceled  += ctx => isRunning = false;
         inputActions.PlayerActions.Crouch.performed += ctx => CrouchPressed();
         inputActions.PlayerActions.Look.performed   += ctx => lookInput = ctx.ReadValue <Vector2>();
         inputActions.PlayerActions.Look.canceled    += ctx => lookInput = ctx.ReadValue <Vector2>();
         inputActions.PlayerActions.Jump.canceled    += ctx => jumpInput = true;
         inputActions.PlayerActions.Fire.canceled    += ctx => FireGun();
         body           = GetComponent <Rigidbody>();
         isGrounded     = false;
         bodyRotation   = transform.rotation;
         cameraRotation = playerCamera.transform.localRotation;
         GetClothesMats();
     }
     if (!photonView.IsMine)
     {
         playerCamera.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 22
0
    // Start is called before the first frame update
    void Start()
    {
        pia = new PlayerInputActions();
        pia.Enable();

        RefreshBulletCount();
    }
Ejemplo n.º 23
0
 private void Awake()
 {
     // Get Unity's new Input System
     _inputActions = new PlayerInputActions();
     _inputActions.PlayerControls.Move.performed += ctx => _movementInput = ctx.ReadValue <Vector2>();
     _inputActions.PlayerControls.Drop.performed += Drop;
 }
Ejemplo n.º 24
0
        private SphereAttack sphereAttack; // later we should probably interface this up so we can swap 'weapons' out

        private void Awake()
        {
            inputActions = new PlayerInputActions();

            moter        = GetComponent <IMotor>();
            sphereAttack = GetComponent <SphereAttack>();
        }
Ejemplo n.º 25
0
        private bool nocked = false; // flags that player intends to release an arrow

        protected override void Awake()
        {
            base.Awake();
            armsAnimator       = arms.GetComponent <Animator>();
            armsSpriteRenderer = arms.GetComponent <SpriteRenderer>();
            inputActions       = new PlayerInputActions();
        }
Ejemplo n.º 26
0
 private void Awake()
 {
     if (playerInputActions == null)
     {
         playerInputActions = new PlayerInputActions();
     }
 }
Ejemplo n.º 27
0
    private void Awake()
    {
        //InputActions
        _inputAction = new PlayerInputActions();

        collectDustSound = collectDustSoundContainer.GetComponent <AudioSource>();
    }
Ejemplo n.º 28
0
    // Use this for initialization
    public virtual void Start()
    {
        playerInputActions = PlayerInputHelper.LoadData(0);
        menuButtons.ForEach(menuButton => menuButton.AddEventListener(this.gameObject));

        SelectFirstButton();
    }
Ejemplo n.º 29
0
    private void Awake()
    {
        inputAction = new PlayerInputActions();
        inputAction.MenuHandler.PauseMenu.performed += ctx => HandlePause();

        playerMovement = FindObjectOfType <PlayerMovement>();
    }
 private void Awake()
 {
     _controller   = GetComponent <CharacterController>();
     _inputActions = new PlayerInputActions();
     _inputActions.PlayerControls.Move.performed += ctx => _movementInput = ctx.ReadValue <Vector2>();
     _camera = Camera.main;
 }