Exemplo n.º 1
0
        public void move(float inputX)
        {
            viewDirection = transform.localScale.x / Mathf.Abs(transform.localScale.x);

            if (viewDirection * inputX < 0)
            {
                Vector3 scale = transform.localScale;
                scale.x *= -1;
                transform.localScale = scale;
                viewDirection       *= -1;
            }

            movement = speed * inputX;

            bool value = (movement != 0.0f);

            if (isWalking != value)
            {
                isWalking = value;

                FrostieAnimationManager frostieAnimationManager = GetComponent <FrostieAnimationManager>();
                if (frostieAnimationManager != null)
                {
                    frostieAnimationManager.animateWalking(isWalking);
                }
                else
                {
                    Animator animator = GetComponentInChildren <Animator>();
                    animator.SetBool("IsWalking", isWalking);
                }
            }

            FrostieSoundManager frostieSoundManager = GetComponent <FrostieSoundManager>();

            if (frostieSoundManager != null)
            {
                frostieSoundManager.playWalkingSound(movement);
            }
        }
Exemplo n.º 2
0
        public void Jump()
        {
            Debug.Log("Jump");

            PlayerMovement frostieMoveScript = FrostiePartManager.instance.activePart.GetComponent <PlayerMovement>();

            if (frostieMoveScript != null)
            {
                frostieMoveScript.doJump();
                FrostieSoundManager soundManager = transform.GetComponentInChildren <FrostieSoundManager>();
                if (soundManager == null)
                {
                    soundManager = transform.parent.GetComponentInChildren <FrostieSoundManager>();
                }
                if (soundManager == null)
                {
                    soundManager = transform.parent.parent.GetComponentInChildren <FrostieSoundManager>();
                }
                if (soundManager != null)
                {
                    soundManager.playJumpSound();
                }
            }
        }
Exemplo n.º 3
0
 public void Awake()
 {
     animator     = GetComponentInParent <Animator>();
     frostieSound = GetComponent <FrostieSoundManager>();
 }