Example #1
0
 void Update()
 {
     if ((hotkeys.IsLeftPress() != hotkeys.IsRightPress()) && walkAudio.enabled)
     {
         walkAudio.Play();
     }
     if ((!hotkeys.IsLeftPressed() && !hotkeys.IsRightPressed()) || !playerMovement.IsGrounded())
     {
         walkAudio.Stop();
     }
     if (playerMovement.JustLanded() && (playerMovement.GetVelocityX() != 0f) && walkAudio.enabled)
     {
         walkAudio.Play();
     }
 }
Example #2
0
    public void BlinkMov()
    {
        Vector3 movX = Vector3.right * 2;
        Vector3 movY = Vector3.up * 2;

        if (hotkeys.IsUpPress())
        {
            imgInst.transform.position = playerBlinking.GetPosition() + movY;
        }
        else if (hotkeys.IsDownPress())
        {
            imgInst.transform.position = playerBlinking.GetPosition() - movY;
        }
        else if (hotkeys.IsRightPress())
        {
            imgInst.transform.position = playerBlinking.GetPosition() + movX;
        }
        else if (hotkeys.IsLeftPress())
        {
            imgInst.transform.position = playerBlinking.GetPosition() - movX;
        }
        blinkDurationTimer -= Time.deltaTime;
    }