Exemple #1
0
    private void Start()
    {
        // Player Components
        playerController = PlayerController.current;
        shootingScript   = PlayerController.shootingScript;
        meleeSystem      = PlayerController.meleeSystem;

        // Dialogue manager
        dialogueManager = GetComponent <DialogueManager>();


        controls.Player.Disable();
        controls.Player.Enable();

        #region Gameplay Input
        // Jumping
        controls.Player.Jump.started  += ctx => { playerController.RecieveJumpInput(); jumpHeld = true; };
        controls.Player.Jump.canceled += ctx => jumpHeld = false;
        // Shooting
        controls.Player.Fire.started  += ctx => { shootingScript.InitialShot(); shootHeld = true; };
        controls.Player.Fire.canceled += ctx => { shootingScript.ReleaseShot(); shootHeld = false; };
        // Attacking
        controls.Player.Attack.started += ctx => meleeSystem.Attack();
        // Dashing
        controls.Player.Dash.started += ctx => {
            playerController.InitializeDash();
            dashReleased = false;
        };
        controls.Player.Dash.canceled += ctx => dashReleased = true;
        // Interaction
        controls.Player.Interact.started += ctx => CheckForItem();

        // Pause Menu
        controls.Player.Pause.started  += ctx => Pause();
        controls.Pause.Unpause.started += ctx => EscUnpause();

        // Dialogue
        controls.Dialogue.Next.started  += ctx => dialogueManager.OnButtonPressed();
        controls.Dialogue.Next.canceled += ctx => dialogueManager.OnButtonReleased();

        #endregion
    }