Ejemplo n.º 1
0
 void InputRead()
 {
     if (_player.GetButtonDown("Jump"))
     {
         _buffer     = BufferInput.JumpInput;
         _bufferTime = BufferWindow;
         _animator.SetBool(_buffer.ToString(), true);
     }
     else if (_player.GetButtonDown("Dash"))
     {
         _buffer     = BufferInput.DashInput;
         _bufferTime = BufferWindow;
         _animator.SetBool(_buffer.ToString(), true);
     }
     else if (_player.GetButtonDown("BasicAttack"))
     {
         _buffer     = BufferInput.BasicAttackInput;
         _bufferTime = BufferWindow;
         _animator.SetBool(_buffer.ToString(), true);
     }
     else if (_player.GetButtonDown("SpecialAttack"))
     {
         _buffer     = BufferInput.SpecialAttackInput;
         _bufferTime = BufferWindow;
         _animator.SetBool(_buffer.ToString(), true);
     }
 }
Ejemplo n.º 2
0
 void BufferTick()
 {
     if (_bufferTime > 0)
     {
         _bufferTime -= Time.deltaTime;
         if (_bufferTime <= 0)
         {
             _animator.SetBool(_buffer.ToString(), false);
             _buffer = BufferInput.None;
         }
     }
 }
Ejemplo n.º 3
0
    // Send inputs to animator.
    // Has a few rules to check if player has stamina but that may need
    // to be moved to the input buffer on request.
    void UpdateAnimations(float a_x, float a_y, BufferInput a_input)
    {
        // I need a way to consume data without actually going in
        // x axis
        m_animator.SetFloat("Input/X", a_x);
        // y axis
        m_animator.SetFloat("Input/Z", a_y);
        // If attack pressed and enough stamina.
        if (a_input.m_lightAttack && EntityStats.Instance.CanEntityMoveOccur("Player", this.m_attackStamina[0]))
        {
            m_animator.SetBool("Input/AttackLight", true);
        }
        else
        {
            m_animator.SetBool("Input/AttackLight", false);
        }
        if (a_input.m_heavyAttack && EntityStats.Instance.CanEntityMoveOccur("Player", this.m_attackStamina[1]))
        {
            m_animator.SetBool("Input/AttackHeavy", true);
        }
        else
        {
            m_animator.SetBool("Input/AttackHeavy", false);
        }


        if (a_input.m_dash && EntityStats.Instance.CanEntityMoveOccur("Player", this.m_rollStaminaDrain) && !m_animator.GetBool("Output/IsRolling"))
        {
            m_animator.SetBool("Input/Roll", true);
        }
        else
        {
            m_animator.SetBool("Input/Roll", false);
        }
        m_animator.SetBool("Input/Running", a_input.m_run);
    }
Ejemplo n.º 4
0
    // Camera and input detection occurs here.
    // Every frame
    void Update()
    {
        //Debug.Log(EntityStats.Instance.GetHealthOfEntity("Player"));
        //if (EntityStats.Instance.GetHealthOfEntity("Player") <= 0)
        //{
        //    EntityStats.Instance.GetObjectOfEntity("Player").GetComponent<Player>().m_animator.SetInteger("AnyState/Death", 1);
        //}

        if (!PauseMenuController.isPaused || m_disableControls)
        {
            float axisX = XCI.GetAxis(XboxAxis.LeftStickX);
            float axisZ = XCI.GetAxis(XboxAxis.LeftStickY);

            // Camera lockon
            if (XCI.GetButtonDown(XboxButton.RightStick))
            {
                GameObject Boss = EntityStats.Instance.GetObjectOfEntity("Boss");
                if (this.m_lockon || Boss.GetComponent <BossVariables>().m_dead)
                {
                    this.m_lockon = false;
                }
                else
                {
                    // Target aquizition needs to occur here.

                    Vector3 direction = m_target.transform.position - this.transform.position;

                    //Ray toBoss = new Ray(this.transform.position + (this.transform.up / 2), this.transform.position + direciton);
                    float lockOnRange = 20;

                    float largestDistance = Mathf.Max(Mathf.Abs(direction.x), Mathf.Abs(direction.z));
                    if (lockOnRange > largestDistance && !Boss.GetComponent <BossVariables>().m_dead)
                    {
                        //Debug.Log(largestDistance);
                        this.m_lockon = true;
                    }
                    else
                    {
                        Camera.main.GetComponent <CameraRotation>().Recenter(this.transform.forward);
                    }
                    // Raycast to target
                }
            }

            m_currentFrame = m_inputBuffer.GetBufferInput();


            if (!m_animator.GetBool("Input/Stop") || m_Dead == false)
            {
                UpdateAnimations(axisX, axisZ, m_currentFrame);
            }


            if (m_animator.GetBool("Input/Roll") && !m_animator.GetBool("Output/IsRolling"))
            {
                StartRoll(axisX, axisZ);
            }
        }
        //else if(/*Cutscene*/)
        //{

        //    // do fade and play complete cutscene.
        //}
    }