Beispiel #1
0
        public void CustomGenerateTest()
        {
            CustomObject o = TypeAccessor <CustomObject> .CreateInstanceEx();

            Type type = o.GetType();

            NonInheritedAttribute attr = (NonInheritedAttribute)
                                         Attribute.GetCustomAttribute(type, typeof(NonInheritedAttribute));

            Assert.That(attr, Is.Not.Null);
            Assert.That(attr.Type, Is.EqualTo(typeof(int)));
            Assert.That(attr.NamedArgument, Is.EqualTo("NamedValue"));
        }
Beispiel #2
0
 public float EntityValue(CustomObject entity)
 {
     //const int m_maxWeight = 500;
     if (entity.GetType() == typeof(BasicMine)) return 5f;
     if (entity.GetType() == typeof(Portal)) return BasicPlanerAI.MaxWeight;
     if (entity.GetType() == typeof(DistantPortalEnter)&&(entity as DistantPortalEnter).Status>0) return BasicPlanerAI.MaxWeight;
     if (entity.GetType() == typeof(WeaponPrototype)) return BasicPlanerAI.MaxWeight;
     if (entity.GetType() == typeof(RedFireflySpawner)) return BasicPlanerAI.MaxWeight;
     if (entity.GetType() == typeof(Anchor)) return BasicPlanerAI.MaxWeight;
     return 0;
 }
Beispiel #3
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private static List <string> PropertyNames(this CustomObject obj)
        {
            return(obj.GetType().PropertyNames().Where(x => x != "CustomData").Concat(obj.CustomData.Keys.ToList()).ToList());
        }
Beispiel #4
0
 public void OnInteractEnter(CustomObject obj, InteractType type)
 {
     if (TargetTrigger == null) return;
     if (type == InteractType.Enter) return;
     if (TargetTrigger.IsAssignableFrom(obj.GetType()))
     {
             Activate();
     }
 }