/// <summary>
        /// Adds a command only if the registry is active, the odorant command is not in the blacklist and
        /// there is not already another odorant destine for the same slot.
        /// </summary>
        /// <param name="command">Incoming odorant commands from Odorant components in the scene.</param>
        public void AddOdorantCommand(OdorantCommand command)
        {
            // active
            if (!IsActive)
            {
                return;
            }

            // not in blacklist
            if (Get()._blacklist != null)
            {
                if (Get()._blacklist.Slots().Contains(command.Slot) || Get()._blacklist.Names().Contains(command.Name))
                {
                    return;
                }
            }

            // not already full of commands and command is none zero
            if (_odorantCommands.Count >= Get()._maxNumOdorants || command.Intensity == 0)
            {
                return;
            }

            // take average value if there are more than one of the same command.
            var indexOfDuplicate = _odorantCommands.FindIndex(c => c.Slot == command.Slot);

            if (indexOfDuplicate >= 0)
            {
                _odorantCommands[indexOfDuplicate].Intensity = (byte)((command.Intensity + _odorantCommands[indexOfDuplicate].Intensity) / 2);
            }

            _odorantCommands.Add(command);
        }
Exemplo n.º 2
0
        public void AddCommand(OdorantCommand command)
        {
            if (_commands.Count >= _maxCommandsPerPacket)
            {
                return;
            }

            _commands.Add(command);
        }
        /// <summary>
        /// The proximity odorant node registers itself with the Olfactory component.
        /// </summary>
        void Start()
        {
            Validate();
            OdorantCommand = new OdorantCommand(OdorantConfig, OdorantAlgorithm.Burst);

            // Have to do this to set inner and outer radius squared properties
            InnerRadius = _innerRadius;
            OuterRadius = _outerRadius;
        }
        void Start()
        {
            Validate();
            // Have to do this to set inner and outer radius squared properties
            InnerRadius = _innerRadius;
            OuterRadius = _outerRadius;

            OdorantCommand  = new OdorantCommand(OdorantConfig, OdorantAlgorithm.Burst);
            _particleSystem = GetComponent <ParticleSystem>();
            _particles      = new ParticleSystem.Particle[_particleSystem.main.maxParticles];
        }
Exemplo n.º 5
0
 void Start()
 {
     Validate();
     OdorantCommand = new OdorantCommand(OdorantConfig, OdorantAlgorithm.Ambient, Intensity);
 }
Exemplo n.º 6
0
 void Start()
 {
     Validate();
     OdorantCommand = new OdorantCommand(OdorantConfig, OdorantAlgorithm.Burst);
     DecaySeconds   = _decaySeconds;
 }
Exemplo n.º 7
0
 void Start()
 {
     Validate();
     OdorantCommand = new OdorantCommand(OdorantConfig, OdorantAlgorithm.Burst);
 }