예제 #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);
            }
        }
예제 #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();
                }
            }
        }
예제 #3
0
 public void Awake()
 {
     animator     = GetComponentInParent <Animator>();
     frostieSound = GetComponent <FrostieSoundManager>();
 }