예제 #1
0
    public void PlayLitSfx(GameObject litObject)
    {
        if (Time.time - lastLitTime > 2.5f)
        {
            litSfxIndex = 0;
        }
        else
        {
            litSfxIndex = (litSfxIndex + 1) % 3;
        }


        lastLitTime = Time.time;
        NodeGravity nodeGravity = litObject.GetComponent <NodeGravity>();

        if (nodeGravity != null)
        {
            if (nodeGravity.IsNodeEverTouched())
            {
                litSfxIndex = 0;
            }
            if (nodeGravity.IsNodeDepleted())
            {
                return;
            }
        }

        consectiveLitSfx[litSfxIndex].Play();
    }
예제 #2
0
    public void PlayActivateSfx(GameObject activeObject)
    {
        if (activatedObjects.Contains(activeObject))
        {
            return;
        }

        /*
         * NodeGravity nodeGravity = activeObject.GetComponent<NodeGravity>();
         * int index = 0;
         * if (nodeGravity && nodeGravity.nodeRadius >= 5.0f)
         * {
         *      index = 1;
         * }
         * if (nodeGravity && nodeGravity.nodeRadius >= 10.0f)
         * {
         *      index = 2;
         * }
         *
         * activateSfx[index].Play();
         */

        if (Time.time - lastActivateTime > 5.0f)
        {
            activateSfxIndex = 0;

            Debug.Log("Reset activate sound");
        }
        else
        {
            activateSfxIndex = (activateSfxIndex + 1) % 9;
        }


        lastActivateTime = Time.time;
        NodeGravity nodeGravity = activeObject.GetComponent <NodeGravity>();

        if (nodeGravity != null)
        {
            if (nodeGravity.IsNodeEverTouched())
            {
                return;
            }
            if (nodeGravity.IsNodeDepleted())
            {
                return;
            }
        }

        activateSfx[activateSfxIndex].Play();

        activatedObjects.Add(activeObject);
    }