Ejemplo n.º 1
0
        public void Update()
        {
            horizontalInput = Input.GetAxisRaw("Horizontal");

            FlyingState fs = new FlyingState(horizontalInput);

            fs.setTargetHold(fs.findClosestAnchor());
            SwingingState ss;

            checkValidity();

            if (!_parent.GroundCheck())
            {
                Print.Log("STATE TRANSITION grounded -> flying");
                _parent.currentState = fs;
                return;
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (fs.targetHold != null)
                {
                    Print.Log("STATE TRANSITION grounded -> swinging");
                    ss = new SwingingState(fs.targetHold);
                    _parent.currentState = ss;

                    // Play hook audio
                    AudioManager.instance.Play("hook");
                }
            }

            _parent.Walk(horizontalInput);
        }
Ejemplo n.º 2
0
 public void ResetTongueIfSwinging()
 {
     if (currentState is SwingingState)
     {
         SwingingState swingingState = (SwingingState)currentState;
         swingingState.ResetTongue();
     }
 }