Exemple #1
0
    void OnEnable()
    {
        inputActions.Enable();

        inputActions.PlayerControls.Look.performed += LookPerformed;
        inputActions.PlayerControls.Look.canceled  += LookCancelled;
    }
    // Start is called before the first frame update
    void Start()
    {
        pia = new PlayerInputActions();
        pia.Enable();

        RefreshBulletCount();
    }
        private void OnEnable()
        {
            _inputActions.Enable();

            if (movementInput)
            {
                _inputActions.Player.Movement.performed += OnMoveInput;
            }

            _inputActions.Player.Interact.performed += OnInteractButton;

            if (analogRotationInput)
            {
                _inputActions.Player.AnalogAim.performed += OnAnalogAimInput;
            }

            if (mouseRotationInput)
            {
                _inputActions.Player.MouseAim.performed += OnMouseAimInput;
            }

            if (skillInput)
            {
                _inputActions.Player.Skill.performed += OnSkillButton;
            }
        }
    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);
        }
    }
Exemple #5
0
    private void Start()
    {
        inputActions = new PlayerInputActions(); 
 inputActions.Enable(); 
 inputActions.Player.Move.performed += ctx => movementInput = ctx.ReadValue <Vector2>(); 
 inputActions.Player.Move.canceled += ctx => movementInput = ctx.ReadValue <Vector2>();
        // inputActions.Player.Attack.performed += ctx => Attack();

        keys = new int[10];
    }
Exemple #6
0
    void OnEnable()
    {
        playerInputActions.Enable();

        //Player controls
        playerInputActions.PlayerControls.Move.performed  += Move_Performed;
        playerInputActions.PlayerControls.Move.canceled   += Move_Cancelled;
        playerInputActions.PlayerControls.Run.started     += Run_Performed;
        playerInputActions.PlayerControls.Run.canceled    += Run_Cancelled;
        playerInputActions.PlayerControls.Block.performed += Block_Performed;

        //Player actions
        playerInputActions.PlayerActions.Attack.performed += Attack_Performed;
        playerInputActions.PlayerActions.Attack.canceled  += Attack_Cancelled;
        playerInputActions.PlayerActions.Shoot.performed  += Shoot_Performed;
        playerInputActions.PlayerActions.Shoot.canceled   += Shoot_Cancelled;


        playerInputActions.PlayerActions.Interaction.performed += Interaction_Performed;


        playerInputActions.PlayerActions.Pause.performed += SetPauseMode;

        //playerInputActions.PlayerControls.QuitGame.performed += Exit_Game;
    }
Exemple #7
0
    public void OnEnable()
    {
        controls.Enable();

        controls.Player.Fire.started += context => {
            isHoldingDown = true;
            camAnimator.SetBool("aiming", true);
        };
        controls.Player.Fire.performed += context => {
            canShoot = true;
        };
        controls.Player.Fire.canceled += context => {
            if (canShoot)
            {
                ShootArrow();
            }
            isHoldingDown = canShoot = false;
            camAnimator.SetBool("aiming", false);
        };
        controls.Player.Move.performed += context => {
            if (!isHoldingDown)
            {
                Vector2 axis = context.ReadValue <Vector2>();
                if (axis.x < 0)
                {
                    sr.flipX = false;
                }
                if (axis.x > 0)
                {
                    sr.flipX = true;
                }
                animator.SetFloat("ySpeed", -1);
            }
        };
    }
    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);
    }
Exemple #9
0
 private void Awake()
 {
     _playerInputActions = new PlayerInputActions();
     _playerInputActions.Enable();
     _rb          = GetComponent <Rigidbody2D>();
     _boxCollider = GetComponent <BoxCollider2D>();
 }
Exemple #10
0
 private void OnEnable()
 {
     if (playerInputActions != null)
     {
         playerInputActions.Enable();
     }
 }
Exemple #11
0
 private void OnEnable()
 {
     if (input != null)
     {
         input.Enable();
     }
 }
Exemple #12
0
 public override void OnEnable()
 {
     if (photonView.IsMine)
     {
         inputActions.Enable();
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     health = controller.health;
     input  = new PlayerInputActions();
     input.Enable();
     input.MainActionMap.Attack.performed += Attack_performed;
 }
Exemple #14
0
    void OnEnable()
    {
        playerInputActions.Enable();

        playerInputActions.MainMenuController.StartGame.performed += StartGameAnim;
        playerInputActions.MainMenuController.ExitGame.performed  += ExitGameAnim;
    }
Exemple #15
0
        private void OnEnable()
        {
            playerInputAction.Enable();

            playerInputAction.Player.HorizontalMovement.performed += OnHorizontalMoveInput;

            playerInputAction.Player.VerticalMovement.performed += OnVerticalMoveInput;
        }
Exemple #16
0
    private void OnEnable()
    {
        _inputActions.Enable();

        if (movementInput)
        {
            _inputActions.ShipControls.Move.performed += OnMoveInput;
        }
    }
        public override void Initialise()
        {
            Filter = new Filter(typeof(Player));

            _inputActions.Enable();

            _inputActions.Explore.Move.performed     += ctx => OnMove(ctx.ReadValue <Vector2>());
            _inputActions.Explore.Interact.performed += ctx => OnInteract();
        }
Exemple #18
0
    void OnEnable()
    {
        playerInputActions.Enable();

        playerInputActions.MenuPlayerControls.Move.performed     += Move_Performed;
        playerInputActions.MenuPlayerControls.Move.canceled      += Move_Cancelled;
        playerInputActions.MenuPlayerControls.Use.performed      += Use_Performed;
        playerInputActions.MainMenuController.ExitGame.performed += Exit_Performed;
    }
Exemple #19
0
 void Start()
 {
     rigidbody       = GetComponent <Rigidbody>();
     animate         = GetComponent <MechaAnimate>();
     cameraTransform = Camera.main.transform;
     input           = new PlayerInputActions();
     input.Enable();
     input.Player.Movement.performed += Move;
     input.Player.Swipe.performed    += OnMouseMove;
 }
 public void ToggleControls(bool flag)
 {
     if (flag)
     {
         Actions.Enable();
     }
     else
     {
         Actions.Disable();
     }
 }
Exemple #21
0
 private void OnEnable()
 {
     Debug.Log("Enabling control handler");
     m_InputActions.Enable();
     m_InputActions.Player.Jump.performed   += OnJump;
     m_InputActions.Player.Jump.canceled    += OnJump;
     m_InputActions.Player.Move.performed   += OnMove;
     m_InputActions.Player.Move.canceled    += OnMove;
     m_InputActions.Player.Sprint.performed += OnSprint;
     m_InputActions.Player.Sprint.canceled  += OnSprint;
 }
    internal void Build()
    {
        Player_Rigidbody = GetComponent <Rigidbody>();
        Actions          = new PlayerInputActions();
        PlayerCamera     = GetComponent <Camera>();

        Cursor.visible = false;

        Actions.Player.Interact.performed += ctx => Interact();

        Actions.Enable();
    }
Exemple #23
0
        void OnEnable()
        {
            inputActions.Enable();
            inputActions.PlayerControls.Move.performed   += OnMovement;
            inputActions.PlayerControls.Jump.performed   += OnJump;
            inputActions.PlayerControls.Jump.canceled    += OnJump;
            inputActions.PlayerControls.Crouch.performed += OnCrouch;
            inputActions.PlayerControls.Crouch.canceled  += OnCrouch;
            inputActions.PlayerControls.Attack.performed += OnAttack;
            inputActions.PlayerControls.Attack.canceled  += OnAttack;
            inputActions.PlayerControls.Mouse.performed  += OnMousePosition;

            inputActions.PlayerControls.Quit.performed += OnQuit;
        }
    // Start is called before the first frame update
    void Start()
    {
        input = new PlayerInputActions();
        input.Enable();

        PlayerSettings.LoadConfig();
        NetworkingGlobal.LoadAllRoles();
        NetBase.DebugInfoReceived += s => Debug.Log(s);

        // We must shut down the server and/or client when the editor stops, since that doesn't happen automatically for us.
        Application.wantsToQuit += NetworkingGlobal.Application_quitting;

        StartCoroutine("AutoFadeRoutine");
    }
Exemple #25
0
        private void OnEnable()
        {
            _inputActions.Enable();

            if (_look != null)
            {
                _inputActions.Player.Look.performed += OnLook;
                _inputActions.Player.Look.canceled  += OnLook;
            }
            if (_move != null)
            {
                _inputActions.Player.Move.performed += OnMove;
                _inputActions.Player.Move.canceled  += OnMove;
            }
        }
Exemple #26
0
    // Start is called before the first frame update
    void Start()
    {
        gVelocity = Vector3.zero;
        pia       = new PlayerInputActions();
        pia.Enable();

        pia.Land.Pick.started  += (x) => Pickup();
        pia.Land.Pick.canceled += (x) => Drop();



        player = GetComponent <CharacterController>();

        Cursor.lockState = CursorLockMode.Locked;
    }
Exemple #27
0
    void OnEnable()
    {
        playerInputActions.Enable();

        playerInputActions.PlayerControls.Move.performed += Move_Performed;
        playerInputActions.PlayerControls.Move.canceled  += Move_Cancelled;
        playerInputActions.PlayerControls.Run.performed  += Run_Performed;
        playerInputActions.PlayerControls.Run.canceled   += Run_Cancelled;

        playerInputActions.PlayerControls.QuitGame.performed += Exit_Game;

        playerInputActions.PlayerControls.PickUpRelease.performed += Interaction_Performed;
        playerInputActions.PlayerControls.PickUpRelease.canceled  += Interaction_Canceled;
        playerInputActions.PlayerControls.Use.performed           += Use_Performed;
    }
Exemple #28
0
    void Start()
    {
        var view = GetComponentInParent <PhotonView>();

        if (view && view.IsMine)
        {
            Destroy(transform.parent.parent.gameObject);
            return;
        }
        if (!(barGuard && barHP && barHPRecovered && barHPLost && barGuardLost))
        {
            Debug.LogError("Player UI Bars Unassigned!");
        }
        input = new PlayerInputActions();
        input.Enable();
        input.MainActionMap.DebugNum1.performed += DebugNum1_performed;
        input.MainActionMap.DebugNum2.performed += DebugNum2_performed;
        input.MainActionMap.DebugNum4.performed += DebugNum4_performed;
        input.MainActionMap.DebugNum5.performed += DebugNum5_performed;
    }
    protected override void OnCreate()
    {
        playerArchetype = EntityManager.CreateArchetype(
            typeof(Translation),
            typeof(Rotation),
            typeof(Speed),
            typeof(Velocity),
            typeof(ColliderComponent),
            typeof(Faction),
            typeof(Damageable),
            typeof(Health),
            typeof(RenderMesh),
            typeof(RenderBounds),
            typeof(LocalToWorld),
            typeof(Player),
            typeof(Cooldown));
        Addressables.LoadAssetAsync <PlayerSettings>("PlayerSettings").Completed += OnPlayerSettingsLoad;

        PlayerInput = new PlayerInputActions();
        PlayerInput.Enable();
        pInput = PlayerInput.Player;
    }
Exemple #30
0
    private void OnEnable()
    {
        PlayerInputActions.Enable();
        PlayerInputActions.PlayerControls.MovementAxis.performed += HandleMovement;
        PlayerInputActions.PlayerControls.MovementAxis.canceled  += ctx => HandleMovementCancel();

        PlayerInputActions.PlayerControls.MouseAim.performed      += HandleMouseAim;
        PlayerInputActions.PlayerControls.MouseDeltaAim.performed += HandleMouseDeltaAim;
        PlayerInputActions.PlayerControls.MouseDeltaAim.canceled  += ctx => _cursorDeltaPosition = Vector2.zero;

        PlayerInputActions.PlayerControls.AnalogAim.performed += HandleAnalogAim;
        PlayerInputActions.PlayerControls.Run.started         += HandleRunPressed;
        PlayerInputActions.PlayerControls.Run.canceled        += HandleRunReleased;


        PlayerInputActions.PlayerControls.Jump.started  += HandleJumpStart;
        PlayerInputActions.PlayerControls.Jump.canceled += HandleJumpEnd;


        PlayerInputActions.PlayerControls.Scroll.started  += HandleStartScroll;
        PlayerInputActions.PlayerControls.Scroll.canceled += HandleEndScroll;

        InputUser.onChange += OnDeviceChanged;
    }