Exemple #1
0
    private void Update()
    {
        if (SceneManager.GetActiveScene().name.Equals("MainMenu"))
        {
            PlayAudio?.Invoke("ThemeSong", 0f);
            StopAudio?.Invoke("ExpositionSong");
            StopAudio?.Invoke("GameSong");
        }
        if (SceneManager.GetActiveScene().name.Equals("Exposition"))
        {
            PlayAudio?.Invoke("ExpositionSong", 0f);
            StopAudio?.Invoke("ThemeSong");
            StopAudio?.Invoke("GameSong");
        }
        if (SceneManager.GetActiveScene().name.Equals("GGJ"))
        {
            PlayAudio?.Invoke("GameSong", 0f);
            StopAudio?.Invoke("ExpositionSong");
            StopAudio?.Invoke("ThemeSong");
        }

        if (input == null)
        {
            input = FindObjectOfType <InputController>();
            SubscribeToInput(input);
        }

        if (MissedDeliveries >= LoseState)
        {
            GameOver(Score);
        }
    }
 public void OnRelease()
 {
     if (currentGrabItem != null)
     {
         currentGrabItem.Release(currentInput);
         currentGrabItem = null;
         CallAnimationTrigger?.Invoke("", null);
         PlayAudio?.Invoke("Release", 0f);
     }
 }
 private void DetermineAudioCall()
 {
     if (isDashing)
     {
         PlayAudio?.Invoke("Dash", 0f);
         CallVFX?.Invoke(this.transform.position - new Vector3(0, 1, 0), Quaternion.identity, .1f);
     }
     else
     {
         if (currentInput != Vector2.zero)
         {
             PlayAudio?.Invoke("Walking", .1f);
         }
     }
 }
Exemple #4
0
        private int apuFrameTicksBeforePlayAudio = 40; // church, delay before play

        private void WriteFrameCounterAudio()
        {
            if (apuFrameTicksBeforePlayAudio >= 1)
            {
                apuFrameTicksBeforePlayAudio--;
            }
            if (apuFrameTicksBeforePlayAudio == 0)
            {
                PlayAudio.Invoke();
            }

            float paAudio = 0f, pbAudio = 0f, trAudio = 0f, nsAudio = 0f, dmAudio = 0f;

            for (var i = 0; i < samplesPerAPUFrameTick; i++)
            {
                if (r.Status.PulseAEnabled || pulseA.LengthCounter != 0)
                {
                    paAudio = pulseA.GetAudio();
                }
                if (r.Status.PulseBEnabled || pulseB.LengthCounter != 0)
                {
                    pbAudio = pulseB.GetAudio();
                }
                if (r.Status.TriangleEnabled && triangle.LengthCounter != 0 && triangle.LinearCounter != 0)
                {
                    trAudio = triangle.GetAudio();
                }
                if (r.Status.NoiseEnabled && noise.LengthCounter != 0)
                {
                    nsAudio = noise.GetAudio();
                }
                if (r.Status.DmcEnabled)
                {
                    // dmAudio = modulation.GetAudio(); // disabled, not impl. reason: No games with DMC on Mapper 0 (NROM)
                }

                // TODO: impl. APU Mixer http://wiki.nesdev.com/w/index.php/APU_Mixer instead of (n + n + n + n + n) / 5
                (Buffer as AudioBuffer).Write(((paAudio + pbAudio + trAudio + nsAudio + dmAudio) / 5f) * 0.85f);
            }
        }
Exemple #5
0
    private void Update()
    {
        if (Dropping)
        {
            DropBoi();
        }
        if (joint != null)
        {
            if (joint.connectedBody != null)
            {
                isGrabbed = true;
            }
            else
            {
                isGrabbed = false;
            }
        }

        if (motor != null && Time.timeScale != 0)
        {
            if (motor.velocity.magnitude >= .1f)
            {
                if (isGrabbed)
                {
                    StopAudio?.Invoke("Pushed");
                    PlayAudio?.Invoke("Drag", 0f);
                }
                else
                {
                    StopAudio?.Invoke("Drag");
                    PlayAudio?.Invoke("Pushed", 0f);
                }
            }
            else
            {
                motor.velocity = Vector2.zero;
            }
        }
    }
    public void OnGrab()
    {
        if (character == null)
        {
            return;
        }
        Ray          ray    = new Ray(this.transform.position, lookDirection.normalized * character.GetInteractionRange());
        RaycastHit2D hitBox = Physics2D.CircleCast(ray.GetPoint(character.GetInteractionRange() / 2), character.GetInteractionRange() / 2, lookDirection.normalized, character.GetInteractionRange(), interactionLayer);

        if (hitBox)
        {
            RaycastHit2D hitInfo = Physics2D.Raycast(this.transform.position, hitBox.transform.position - this.transform.position, character.GetInteractionRange(), interactionLayer);
            if (hitInfo)
            {
                IGrabbable item = hitInfo.transform.gameObject.GetComponentInParent <IGrabbable>();
                if (item != null)
                {
                    currentGrabItem = item.Grab(motor, hitInfo.point);
                    CallAnimationTrigger?.Invoke("", null);
                    PlayAudio?.Invoke("Grab", 0f);
                }
            }
        }
    }
Exemple #7
0
 private void Start()
 {
     PlayAudio?.Invoke("ThemeSong", 0f);
 }