Example #1
0
    public void UpdatePlayer()
    {
        if (Input.GetKeyDown(KeyCode.I))
        {
            HealthPopupManager.Instance.ModHP(transform, 2.5f);
        }

        InputManager.InputInfo inputInfo = InputManager.Instance.GetInputInfo();
        lastMovedDir = (inputInfo.dirPressed == new Vector2()) ? lastMovedDir : inputInfo.dirPressed;

        if (inputInfo.pickDropPressed)
        {
            if (carryingObject)
            {
                DroppedPresed();
            }
            else
            {
                PickupPressed();
            }
        }

        if (inputInfo.makePotionPressed)
        {
            if (carryingObject)
            {
                GameObject toThrow = DeattachCarryingItem();
                StartCoroutine(ThrowCarriedObject(toThrow, lastMovedDir.normalized * GV.Player_Throw_Distance, GV.Player_Throw_Time));
            }
            else
            {
                MakePotionPressed();
            }
        }
    }
Example #2
0
        public virtual void AttemptUseSkill(ref InputManager.InputInfo input, StateManager stateManager)
        {
            if (stateManager.playerState == StateManager.PlayerStates.HOLD || stateManager.playerState == StateManager.PlayerStates.DEAD)
            {
                return;
            }

            if (input.pressed && CanUseSkill(stateManager))
            {
                OnStartSkill(stateManager);
            }
        }
Example #3
0
 public void PhysicsRefresh(float fdt)
 {
     if (isAlive)
     {
         inputInfo = inputManager.GetInfo();
         VelocityCheck();
         if (canMove)
         {
             PlayerMove(inputInfo.inputDir);
         }
     }
 }
Example #4
0
    public void Refresh(float dt)
    {
        inputManager.InputUpdate(dt);
        // torch.Refresh();
        if (this.isAlive)
        {
            inputInfo = inputManager.GetInfo();

            if (canMove)
            {
                PlayerJump(inputInfo.jumpPressed);
                if (inputInfo.throwPressed)
                {
                    /* Debug.Log("Pressed");*/
                    if (carried)
                    {
                        GameObject throwObject = DetachObject();
                        ThrowTorch(throwObject);
                    }
                }
                if (inputInfo.pickUp)
                {
                    Pickup();
                }
                //SoundManager.instance.PlaySFX("Run", this.gameObject);
            }
            else
            {
                //Debug.Log("Animator working");
                jump        = false;
                rb.velocity = new Vector2(0, rb.velocity.y);
            }
            ManageJump(dt);
            GravityCheck();
            PlayerAnimationStates();
        }
    }
Example #5
0
 public void FixedUpdatePlayer()
 {
     InputManager.InputInfo inputInfo = InputManager.Instance.GetInputInfo();
     Move(inputInfo.dirPressed);
 }
Example #6
0
 public void FixedUpdatePlayer(float dt)
 {
     InputManager.InputInfo inputInfo = inputManager.GetInputInfo();
     Move(inputInfo.dirPressed);
 }