Ejemplo n.º 1
0
 private void DartOnJuiceSucked(object sender, JuiceSuckedEventArgs juiceSuckedEventArgs)
 {
     _hpScript.CurrentHp += juiceSuckedEventArgs.HpSucked;
     if (_delayManager.OtherReady)
     {
         m_SappingAudioSource = PlayNewSound(m_SappingAudioSource, Transfering);
         //SoundManager.PlaySFX(Transfering);
         _delayManager.AddOtherDelay(Settings.m_transferSoundDelay);
     }
 }
Ejemplo n.º 2
0
        public void Move(float move, bool dash, bool jump, bool imobile, bool isShooting, bool doubleJump)
        {
            //CheckPassThrough();

            if (m_DashTimer < Time.time && !m_CanDash && IsGrounded)
            {
                CheckDrag();
                OnPlayerCanDashAgain();
                m_CanDash    = true;
                m_AirControl = true;
            }

            // Set whether or not the character is crouching in the animator
            //m_Anim.SetBool("Crouch", dash);

            //only control the player if grounded or airControl is turned on
            if ((IsGrounded || m_AirControl) && m_CanDash)
            {
                // Reduce the speed in air by the airSpeed multiplier
                float toMove = (!IsGrounded ? move * m_AirSpeed : move);

                if (isShooting && IsGrounded && !m_shootinDelayAdded)
                {
                    m_delayManager.AddOtherDelay(m_ShootingDelayToSlow);
                    m_shootinDelayAdded = true;
                }

                if (!isShooting && m_shootinDelayAdded)
                {
                    m_shootinDelayAdded = false;
                }

                toMove = (isShooting && IsGrounded && m_delayManager.OtherReady ? move * m_ShootingSpeed : move);

                if (imobile && IsGrounded)
                {
                    toMove = 0;
                }

                // The Speed animator parameter is set to the absolute value of the horizontal input.
                m_Anim.SetFloat("Speed", Mathf.Abs(toMove));

                // Move the character
                m_Rigidbody2D.velocity = new Vector2(toMove * m_MaxSpeed, m_Rigidbody2D.velocity.y);

                // If the input is moving the player right and the player is facing left...
                if ((move > 0 && !m_Controller.m_FacingRight) || (move < 0 && m_Controller.m_FacingRight))
                {
                    Flip();                                                                                        // ... flip the player.
                }
            }

            // If the player should jump...
            if (m_HasDoubleJump && !IsGrounded && !m_UsedDoubleJump)
            {
                jump = jump || doubleJump;
            }
            if (jump)
            {
                Jump();
            }

            // If the player should dash
            if (m_CanDash && dash)
            {
                PhysicsDash();
            }
        }