Esempio n. 1
0
        public static Bullet Bullet <TAmmoType>(Vec2 position, AmmoTypeModifier modifier, Thing owner = null, float angleDegress = 0, Thing firedFrom = null)
            where TAmmoType : AmmoType, new()
        {
            var ammoType = FastNew.CreateInstance <TAmmoType>();

            modifier(ref ammoType.bulletSpeed, ref ammoType.range);
            return(ammoType.FireBullet(position, owner, angleDegress, firedFrom));
        }
Esempio n. 2
0
        public void FN_Struct_PrivateConstructor()
        {
            const int    expectedNum  = int.MaxValue;
            const string expectedText = "test";
            var          value        = FastNew <TStructPrivateConstructor, int, string> .CreateInstance(expectedNum, expectedText);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(expectedNum, value.i);
                Assert.AreEqual(expectedText, value.text);
            });
        }
Esempio n. 3
0
        public void FN_Class_Parameters()
        {
            const int    expectedNum  = int.MaxValue;
            const string expectedText = "test";
            var          value        = FastNew <TClassWithParam, int, string> .CreateInstance(expectedNum, expectedText);

            Assert.Multiple(() =>
            {
                Assert.NotNull(value);
                Assert.AreEqual(expectedNum, value.i);
                Assert.AreEqual(expectedText, value.text);
            });
        }
Esempio n. 4
0
 public Example FastNewT() =>
 FastNew <Example> .CreateInstance();
Esempio n. 5
0
        public void FN_Struct()
        {
            var value = FastNew <TStruct> .CreateInstance();

            Assert.AreEqual(default(TStruct), value);
        }
Esempio n. 6
0
        public void FN_Class()
        {
            var value = FastNew <TClass> .CreateInstance();

            Assert.NotNull(value);
        }
Esempio n. 7
0
        public void FN_Object()
        {
            var value = FastNew <object> .CreateInstance();

            Assert.NotNull(value);
        }
Esempio n. 8
0
 public ExampleValueType FastNewT() =>
 FastNew <ExampleValueType> .CreateInstance();
Esempio n. 9
0
 private static TAmmoType GetAmmoTypeInstance <TAmmoType>()
     where TAmmoType : AmmoType, new()
 {
     return(FastNew.CreateInstance <TAmmoType>());
     //return InstanceOf<TAmmoType>.instance;
 }