コード例 #1
0
    private void AddHighestPriorityEnvironmentsFromPortals(UnityEngine.Vector3 position)
    {
        for (var i = 0; i < activePortals.Count; i++)
        {
            var portal = activePortals[i];
            if (portal.EnvironmentsShareAuxBus)
            {
                var env = portal.environments[0];
                if (env == null)
                {
                    continue;
                }

                var index = activeEnvironmentsFromPortals.BinarySearch(env, AkEnvironment.s_compareByPriority);
                if (index < 0 || index >= AkEnvironment.MAX_NB_ENVIRONMENTS)
                {
                    continue;
                }

                var auxBusID = env.data.Id;
                if (!auxSendValues.Contains(auxBusID))
                {
                    auxSendValues.Add(auxBusID, 1.0f);
                    if (auxSendValues.isFull)
                    {
                        return;
                    }
                }
                continue;
            }

            for (var j = 0; j < AkEnvironmentPortal.MAX_ENVIRONMENTS_PER_PORTAL; j++)
            {
                var env = portal.environments[j];
                if (env == null)
                {
                    continue;
                }

                var index = activeEnvironmentsFromPortals.BinarySearch(env, AkEnvironment.s_compareByPriority);
                if (index < 0 || index >= AkEnvironment.MAX_NB_ENVIRONMENTS)
                {
                    continue;
                }

                var auxBusID = env.data.Id;
                if (!auxSendValues.Contains(auxBusID))
                {
                    auxSendValues.Add(auxBusID, portal.GetAuxSendValueForPosition(position, j));
                    if (auxSendValues.isFull)
                    {
                        return;
                    }
                }
            }
        }
    }
コード例 #2
0
    private void AddHighestPriorityEnvironments(UnityEngine.Vector3 position)
    {
        if (!auxSendValues.isFull && auxSendValues.Count() < activeEnvironments.Count)
        {
            for (var i = 0; i < activeEnvironments.Count; i++)
            {
                var env      = activeEnvironments[i];
                var auxBusID = env.GetAuxBusID();

                if ((!env.isDefault || i == 0) && !auxSendValues.Contains(auxBusID))
                {
                    auxSendValues.Add(auxBusID, env.GetAuxSendValueForPosition(position));

                    //No other environment can be added after an environment with the excludeOthers flag set to true
                    if (env.excludeOthers || auxSendValues.isFull)
                    {
                        break;
                    }
                }
            }
        }
    }