Ejemplo n.º 1
0
    void OnCollisionEnter(Collision coll)
    {
        if (Time.time - m_LastPlaySfxTime < m_SfxIntarvalTime)
        {
            return;
        }

        if (coll.relativeVelocity.sqrMagnitude < m_HitSfxVelThreshold)
        {
            return;
        }

        if (m_Rigidbody.velocity.sqrMagnitude < m_HitSfxVelThreshold)
        {
            return;
        }

        Rigidbody rb = coll.gameObject.GetComponent <Rigidbody>();

        if (rb == null)
        {
            PlaySfx(coll.gameObject.tag);
        }
        else if (m_Rigidbody.velocity.sqrMagnitude >= rb.velocity.sqrMagnitude)
        {
            SfxManager.Play(SfxName.Hit);
        }
        else
        {
            return;
        }

        m_LastPlaySfxTime = Time.time;
    }
Ejemplo n.º 2
0
        internal static void Play([NotNull] this SfxManager sfx, [CanBeNull] string fileName, [NotNull, ItemNotNull] IEnumerable <IAudioFormat> formats)
        {
            if (fileName == null)
            {
                return;
            }

            var format = GetFormatForFile(formats, fileName);

            if (format != null)
            {
                sfx.Play(fileName, format);
            }
        }
Ejemplo n.º 3
0
    void PlaySfx(string tag)
    {
        switch (tag)
        {
        case "NonSfx":
            break;

        case "Spring":
            SfxManager.Play(SfxName.Spring);
            break;

        default:
            SfxManager.Play(SfxName.Hit);
            break;
        }
    }
Ejemplo n.º 4
0
    void LaunchBall(float force)
    {
        if (IsBallInCamber() == false)
        {
            return;
        }
        if (m_ChamberBall == null)
        {
            return;
        }
        m_ChamberBall.transform.position = m_MuzzleT.position;
        Rigidbody rb = m_ChamberBall.GetComponent <Rigidbody>();

        rb.AddForce(m_MuzzleT.forward * force);
        m_ChamberBall.ballState = Ball.BallState.InBoard;
        m_ChamberBall           = null;
        SfxManager.Play(SfxName.Shot);
    }
Ejemplo n.º 5
0
 public void OnHolein()
 {
     BallLoader.AddBall(m_AddingBallCount);
     SfxManager.Play(SfxName.Holein);
     OpenAnotherGateIfNeeded();
 }