Esempio n. 1
0
        public EquipmentAttribute ReinforcementByIncreaseAttributeType(HeroEquipmentFormat equipmentData)
        {
            var _randAttributeTypeList = EquipmentReinforceAttributeRangeTableReader.Instance.DefaultCachedList;
            List <EquipmentReinforceAttributeRangeTable> attributeRandomList = _randAttributeTypeList.CloneEx();

            for (int i = 0; i < _randAttributeTypeList.Count; i++)
            {
                for (int j = 0; j < equipmentData.EquipmentAttributeBaseList.Count; j++)
                {
                    //remove the type that already existed
                    if (_randAttributeTypeList [i].AttributeType == equipmentData.EquipmentAttributeBaseList [j].AttributeType)
                    {
                        attributeRandomList.Remove(_randAttributeTypeList [i]);
                    }
                }
            }

            //rand the new type from type list except the types that already exist
            int            _randTypeIndex = Random.Range(0, attributeRandomList.Count);
            ATTRIBUTE_TYPE _randType      = _randAttributeTypeList [_randTypeIndex].AttributeType;
            //rand the value
            int _randValue = Random.Range(_randAttributeTypeList [_randTypeIndex].RandMin, _randAttributeTypeList [_randTypeIndex].RandMax + 1);

            EquipmentAttribute _attributeOffset = new EquipmentAttribute(_randType, _randValue);

            return(_attributeOffset);
        }
Esempio n. 2
0
 // To restore one from a file
 public FixtureAttribute(SerializationInfo info, StreamingContext ctxt)
 {
     _type          = (ATTRIBUTE_TYPE)info.GetValue("Type", typeof(ATTRIBUTE_TYPE));
     _name          = info.GetString("Name");
     _snapOn        = info.GetBoolean("SnapOn");
     _photons       = (List <Photon>)info.GetValue("Photons", typeof(List <Photon>));
     _parentFixture = (Fixture)info.GetValue("parent", typeof(Fixture));
 }
 /*
  * CONSTRUCTORS
  * Allows you to define an attribute controlling either a single
  * channel, a list of channels, or a list of photons
  */
 public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, bool SnapOn, List<Photon> Photons, Fixture ParentFixture)
 {
     _type = Type;
     _name = Name;
     _snapOn = SnapOn;
     _photons = Photons;
     _parentFixture = ParentFixture;
 }
Esempio n. 4
0
 /*
  * CONSTRUCTORS
  * Allows you to define an attribute controlling either a single
  * channel, a list of channels, or a list of photons
  */
 public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, bool SnapOn, List <Photon> Photons, Fixture ParentFixture)
 {
     _type          = Type;
     _name          = Name;
     _snapOn        = SnapOn;
     _photons       = Photons;
     _parentFixture = ParentFixture;
 }
        public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, bool SnapOn, int Channel, Fixture ParentFixture)
        {
            _type = Type;
            _name = Name;
            _snapOn = SnapOn;
            _photons = new List<Photon>();
            _parentFixture = ParentFixture;

            _photons.Add(new Photon(Channel, 255));
        }
Esempio n. 6
0
        public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, bool SnapOn, int Channel, Fixture ParentFixture)
        {
            _type          = Type;
            _name          = Name;
            _snapOn        = SnapOn;
            _photons       = new List <Photon>();
            _parentFixture = ParentFixture;

            _photons.Add(new Photon(Channel, 255));
        }
        public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, bool SnapOn, List<int> Channels, Fixture ParentFixture)
        {
            _type = Type;
            _name = Name;
            _snapOn = SnapOn;
            _photons = new List<Photon>();
            _parentFixture = ParentFixture;

            foreach (int chan in Channels)
            {
                _photons.Add(new Photon(chan, 255));
            }
        }
Esempio n. 8
0
        public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, bool SnapOn, List <int> Channels, Fixture ParentFixture)
        {
            _type          = Type;
            _name          = Name;
            _snapOn        = SnapOn;
            _photons       = new List <Photon>();
            _parentFixture = ParentFixture;

            foreach (int chan in Channels)
            {
                _photons.Add(new Photon(chan, 255));
            }
        }
Esempio n. 9
0
        public EquipmentAttribute ReinforcementByIncreaseAttributeValue(HeroEquipmentFormat equipmentData, EquipmentReinforceValueRangeTable equipmentReinforceRange)
        {
            //random a type to reinforce
            int            _randTypeID      = Random.Range(0, equipmentData.EquipmentAttributeBaseList.Count);
            int            _normalAttribute = equipmentData.EquipmentAttributeBaseList [_randTypeID].Attribute;
            ATTRIBUTE_TYPE _type            = equipmentData.EquipmentAttributeBaseList [_randTypeID].AttributeType;
            //random value of the type
            double _randOffset = System.Math.Round(Random.Range(equipmentReinforceRange.RandMin, equipmentReinforceRange.RandMax), 2);
            int    _value      = equipmentReinforceRange.Base + Mathf.FloorToInt((float)(_normalAttribute * _randOffset));

            EquipmentAttribute _attributeOffset = new EquipmentAttribute(_type, _value);

            return(_attributeOffset);
        }
 public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, List<Photon> Photons, Fixture ParentFixture)
     : this(Type, Name, false, Photons, ParentFixture)
 {
 }
Esempio n. 11
0
 public EquipmentAttribute(ATTRIBUTE_TYPE attributeType, int attribute)
 {
     this.AttributeType = attributeType;
     this.Attribute     = attribute;
 }
 // To restore one from a file
 public FixtureAttribute(SerializationInfo info, StreamingContext ctxt)
 {
     _type = (ATTRIBUTE_TYPE)info.GetValue("Type", typeof(ATTRIBUTE_TYPE));
     _name = info.GetString("Name");
     _snapOn = info.GetBoolean("SnapOn");
     _photons = (List<Photon>)info.GetValue("Photons", typeof(List<Photon>));
     _parentFixture = (Fixture)info.GetValue("parent", typeof(Fixture));
 }
Esempio n. 13
0
 public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, int Channel, Fixture ParentFixture)
     : this(Type, Name, false, Channel, ParentFixture)
 {
 }
Esempio n. 14
0
 public AttributePresetSetting(ATTRIBUTE_TYPE type)
 {
     _type   = type;
     _active = false;
     _value  = 0;
 }
Esempio n. 15
0
 public EquipmentAttribute()
 {
     this.AttributeType = ATTRIBUTE_TYPE.NONE;
     this.Attribute     = 0;
 }
 public AttributePresetSetting(ATTRIBUTE_TYPE type)
 {
     _type = type;
     _active = false;
     _value = 0;
 }
Esempio n. 17
0
 public AttributePresetSetting(SerializationInfo info, StreamingContext ctxt)
 {
     _type   = (ATTRIBUTE_TYPE)info.GetValue("_type", typeof(ATTRIBUTE_TYPE));
     _active = info.GetBoolean("_active");
     _value  = info.GetInt32("_value");
 }
 public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, int Channel, Fixture ParentFixture)
     : this(Type, Name, false, Channel, ParentFixture)
 {
 }
Esempio n. 19
0
 public FixtureAttribute(ATTRIBUTE_TYPE Type, string Name, List <Photon> Photons, Fixture ParentFixture)
     : this(Type, Name, false, Photons, ParentFixture)
 {
 }
 public AttributePresetSetting(SerializationInfo info, StreamingContext ctxt)
 {
     _type = (ATTRIBUTE_TYPE)info.GetValue("_type", typeof(ATTRIBUTE_TYPE));
     _active = info.GetBoolean("_active");
     _value = info.GetInt32("_value");
 }
Esempio n. 21
0
        public virtual EquipmentReinforceAttributeRangeTable FindDefaultUniqueByAttributeType(ATTRIBUTE_TYPE type)
        {
            var _cacheList = this.DefaultCachedList.FindAll(row => {
                return(row.AttributeType == type);
            });

            if (_cacheList.Count == 0)
            {
                throw new System.NullReferenceException();
            }

            if (_cacheList.Count > 1)
            {
                throw new System.Exception("Find Unique but got duplicated!");
            }

            return(_cacheList[0]);
        }