Пример #1
0
        public void Attack(ButtonPresses btns)
        {
            GameObject victim;

            if (btns.block)
            {
                m_IsBlocking = true;
            }
            else
            {
                m_IsBlocking = false;
            }

            if (btns.atkWeak)
            {
                m_IsAttacking = true;

                victim = UChar.actOnLayer(gameObject, (int)UGen.eLayerMask.ENEMY, 45f, .9f);
                if (victim != null)
                {
                    victim.SendMessage("TakeDamage", 50);
                }
            }
            else
            {
                m_IsAttacking = false;
            }
        }
Пример #2
0
 public void controlInterface(ButtonPresses btns)
 {
     // If pause button has been pressed, exit the pause menu
     if (btns.pause)
     {
         exitMenu();
         return;
     }
 }
Пример #3
0
 public void controlInterface(ButtonPresses btns)
 {
     // If quick menu button has been pressed, exit the quick menu
     if (btns.qMenu)
     {
         exitMenu();
         return;
     }
 }
Пример #4
0
        private NormalMovement normScheme; // A reference to the NormalMovement on the object



        // ===================
        // * PRIVATE METHODS *
        // ===================

        // Initialize Control Values
        private void Start()
        {
            // get class instances
            buttons    = new ButtonPresses();
            normScheme = GetComponent <NormalMovement>();

            // initialize button presses to false
            buttons.setAll(false);

            // initialize controlScheme to normal controls
            controlScheme = normScheme.Interface;
        }
Пример #5
0
 public void PauseButton(ButtonPresses btns)
 {
     // pause or unpause
     if (btns.pause)
     {
         if (UGen.isPaused())
         {
             UGen.resume();
         }
         else
         {
             UGen.pause();
         }
     }
 }
Пример #6
0
        /// <summary>
        /// Default movement control scheme.
        /// </summary>
        /// <param name="btns">The buttons that have been pressed since last update.</param>
        public void Interface(ButtonPresses btns)
        {
            // read inputs
            float h = Input.GetAxis("Horizontal");
            float v = Input.GetAxis("Vertical");

            // calculate move direction to pass to character
            if (m_Cam != null)
            {
                // calculate camera relative direction to move:
                m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized;
                m_Move       = v * m_CamForward + h * m_Cam.right;
            }
            else
            {
                // we use world-relative directions in the case of no main camera
                m_Move = v * Vector3.forward + h * Vector3.right;
            }

            // don't jump in mid-air
            if (!m_Jump)
            {
                m_Jump = btns.jump;

                if (m_Jump && stateInfo.shortNameHash != airborneStateHash)
                {
                    audio.Play();
                }
            }

            // toggle crouch
            if (btns.crouch)
            {
                m_crouch = !m_crouch;
            }

            Attack(btns);

            // pass all to rigidbody movement to be handled and animator to be updated
            Move(m_Move, m_crouch, m_Jump);
            m_Jump = false;

            // call interact script
            Interact(btns.interact);
            m_interact = false;
        }
Пример #7
0
        private QuickMenu quickMenu;                    // Quick Menu object



        // ===================
        // * PRIVATE METHODS *
        // ===================

        // Initialize Control Values
        private void Awake()
        {
            controls = this;

            // get class instances
            buttons        = new ButtonPresses();
            normalMovement = GetComponent <NormalMovement>();
            pauseMenu      = GetComponent <PauseMenu>();
            quickMenu      = GetComponent <QuickMenu>();

            // initialize button presses and joysticks to false
            buttons.setPresses(false);
            buttons.setPersistent(false);

            // initialize controlScheme to default
            controlScheme = normalMovement;
        }