当前位置: 首页>>代码示例>>C#>>正文


C# ParameterCollection.Get方法代码示例

本文整理汇总了C#中ParameterCollection.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterCollection.Get方法的具体用法?C# ParameterCollection.Get怎么用?C# ParameterCollection.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParameterCollection的用法示例。


在下文中一共展示了ParameterCollection.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildEntity

 protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
 {
     entity.Transform.Position = parameters.Get<Vector2>(0);
     entity.AddFromPool<CDrop>().Initialize(DropType.Weapon);
     entity.AddFromPool<CWeaponDrop>().Initialize(parameters.Get<WeaponType>(1));
     entity.AddFromPool<CLifeTime>().Initialize(WeaponDropPrefab.LifeTime);
     entity.Tag = EntityTags.Drop;
 }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:8,代码来源:WeaponDropPrefab.cs

示例2: BuildEntity

        // todo: instead of doing something like this, how about make a callback "OnCollided(Entity entity (or Vector2 position tms))" and then the weapon itself (whos callback it will be calling) decides the damage etc. this.. could be A LOT better!
        protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
        {
            const float Speed = SkypieaConstants.PixelsPerMeter * 25;
            CTransform2D transform = parameters.Get<CTransform2D>(0);

            entity.Transform.Position = transform.Position;
            entity.Transform.Rotation = transform.Rotation;

            entity.AddFromPool<CBullet>().Initialize(RocketLauncherBulletPrefab.BulletSize, parameters.Get<RocketLauncher>(1));
            entity.AddFromPool<CVelocity2D>().Initialize(FlaiMath.GetAngleVector(transform.Rotation), Speed);
            entity.AddFromPool<CParticleEmitter2D>().Initialize(ParticleEffectID.RocketSmoke, new BurstTriggerController(0.01f, entity.Transform));
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:13,代码来源:RocketLauncherBulletPrefab.cs

示例3: BuildEntity

        protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
        {
            CTransform2D transform = parameters.Get<CTransform2D>(0);
            BulletWeapon weapon = parameters.Get<BulletWeapon>(1);
            float angleOffset = parameters.GetOrDefault<float>(2);
            float speed = parameters.GetOrDefault<float>(3, DefaultSpeed);

            entity.Transform.Position = transform.Position;
            entity.Transform.Rotation = transform.Rotation + angleOffset;

            entity.AddFromPool<CBullet>().Initialize(NormalBulletPrefab.BulletSize, weapon);
            entity.AddFromPool<CVelocity2D>().Initialize(FlaiMath.GetAngleVector(entity.Transform.Rotation), speed);
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:13,代码来源:NormalBulletPrefab.cs

示例4: BuildEntity

        protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
        {
            const float Speed = SkypieaConstants.PixelsPerMeter * 20;
            CTransform2D transform = parameters.Get<CTransform2D>(0);
            float rotationOffset = parameters.GetOrDefault<float>(2);

            entity.Transform.Position = transform.Position;
            entity.Transform.Rotation = transform.Rotation;

            entity.AddFromPool<CBullet>().Initialize(BouncerBulletPrefab.BulletSize, parameters.Get<Bouncer>(1));
            entity.AddFromPool<CVelocity2D>().Initialize(FlaiMath.GetAngleVector(transform.Rotation + rotationOffset), Speed);
            entity.AddFromPool<CRotater2D>().Initialize(BouncerBulletPrefab.RotationAmount);
            entity.AddFromPool<CBouncerBullet>().Initialize(3);
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:14,代码来源:BouncerBulletPrefab.cs

示例5: BuildEntity

 protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
 {
     entity.Transform.Position = parameters.Get<Vector2>(0);
     entity.AddFromPool<CDrop>().Initialize(DropType.BlackBox);
     entity.AddFromPool<CLifeTime>().Initialize(100f);
     entity.Tag = EntityTags.Drop;
 }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:7,代码来源:BlackBoxPrefab.cs

示例6: BuildEntity

        protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
        {
            const float MaxAngleOffset = 0.3f;
            const float Speed = SkypieaConstants.PixelsPerMeter * 14.25f;

            CTransform2D transform = parameters.Get<CTransform2D>(0);
            BulletWeapon weapon = parameters.Get<BulletWeapon>(1);
            float angleOffset = Global.Random.NextFloat(-MaxAngleOffset, MaxAngleOffset);

            entity.Transform.Position = transform.Position;
            entity.Transform.Rotation = transform.Rotation + angleOffset;

            entity.AddFromPool<CBullet>().Initialize(FlamethrowerBulletPrefab.BulletSize, weapon);
            entity.AddFromPool<CVelocity2D>().Initialize(FlaiMath.GetAngleVector(entity.Transform.Rotation), Speed);
            entity.AddFromPool<CLifeTime>().Initialize(0.5f);
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:16,代码来源:FlamethrowerBulletPrefab.cs

示例7: BuildEntity

 protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
 {
     entity.Transform.Position = parameters.Get<Vector2>(0);
     entity.AddFromPool<CRusherZombieAI>();
     entity.AddFromPool<CZombieInfo>().Initialize(ZombieType.Rusher, RusherZombiePrefab.Size);
     entity.AddFromPool<CHealth>().Initialize(10);
     entity.Tag = EntityTags.Zombie;
 }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:8,代码来源:RusherZombiePrefab.cs

示例8: BuildEntity

        protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
        {
            entity.Transform.Position = parameters.Get<Vector2>(0);
            entity.Add(new CPlayerInfo(2));
            entity.Add<CCamera2D>(new CPlayerCamera2D());
            entity.Add<CWeapon>().Weapon = WeaponFactory.CreateDefaultWeapon();

            entity.Tag = EntityTags.Player;
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:9,代码来源:PlayerPrefab.cs

示例9: BuildEntity

        protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
        {
            entity.Transform.Position = parameters.Get<Vector2>(0);
            entity.AddFromPool<CGoldenGoblinAI>().Initialize(entity.Transform.Position);
            entity.AddFromPool<CZombieInfo>().Initialize(ZombieType.GoldenGoblin, GoldenGoblinPrefab.Size);
            entity.AddFromPool<CHealth>().Initialize(125);
            entity.AddFromPool<CParticleEmitter2D>().Initialize(ParticleEffectID.GoldenGoblinPath, new BurstTriggerController(0.025f, entity.Transform));

            // okay.. awful... entities can have only one component of a single type so I must create a child entity...
            // another option would be "CMultiParticleEmitter2D" tms
            Entity childEntity = entityWorld.CreateEntity();
            childEntity.AddFromPool<CParticleEmitter2D>().Initialize(ParticleEffectID.GoldenGoblinSpray, new BurstTriggerController(0.1f, entity.Transform));
            entity.AttachChild(childEntity);

            entity.Tag = EntityTags.Zombie;
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:16,代码来源:GoldenGoblinPrefab.cs

示例10: TestCollections2

        public void TestCollections2()
        {
            //
            // => Initialize
            //
            // ---------------                
            // |  P = 1,1,1  | (Root1)        
            // |  V = 2,2,2  |                
            // |  VP = V+P   |                
            // ---------------                
            //        
            // ---------------           ---------------
            // |  P = 3,3,3  | (Root2)   |  P = 5,5,5  | (Root3)    
            // |             |           |  V = P      |
            // |             |           |             |
            // ---------------           ---------------         
            var root1Collection = new ParameterCollection("Root1");
            var root2Collection = new ParameterCollection("Root2");
            var root3Collection = new ParameterCollection("Root3");

            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");
            var paramVP = new ParameterKey<Vector3>("ViewProj");

            root1Collection.Set(paramP, new Vector3(1, 1, 1));
            root1Collection.Set(paramV, new Vector3(2, 2, 2));
            root1Collection.AddDynamic(paramVP, ParameterDynamicValue.New(paramV, paramP, (ref Vector3 paramVArg, ref Vector3 paramPArg, ref Vector3 output) => output = paramVArg + paramPArg));

            root2Collection.Set(paramP, new Vector3(3, 3, 3));

            root3Collection.Set(paramP, new Vector3(5, 5, 5));
            root3Collection.AddDynamic(paramV, ParameterDynamicValue.New(paramP, (ref Vector3 paramPArg, ref Vector3 paramVArg) => paramVArg = paramPArg));

            //
            // => Add Root1 as a source of Root2
            //
            // ---------------                
            // |  P = 1,1,1  | (Root1)        
            // |  V = 2,2,2  |                
            // |  VP = V+P   |                
            // ---------------                
            //        |
            // ---------------           ---------------
            // |  P = 3,3,3  | (Root2)   |  P = 5,5,5  | (Root3)    
            // |  V = ^,^,^  |           |  V = P      |
            // |  VP= ^,^,^  |           |             |
            // ---------------           ---------------
            //
            // Root1: VP = 3,3,3
            // Root2: VP = 5,5,5
            //
            // Number of registered Dynamic Values: 3
            // Root1: 1 => VP = Root1.V + Root1.P 
            // Root2: 1 => VP = Root1.V + Root2.P
            // Root3: 1 => V = Root3.P
            root2Collection.AddSources(root1Collection);

            //
            // => Add Root2 and Root3 as source of child collection
            //
            // ---------------                
            // |  P = 1,1,1  | (Root1)        
            // |  V = 2,2,2  |                
            // |  VP = V+P   |                
            // ---------------                
            //        |
            // ---------------           ---------------
            // |  P = 3,3,3  | (Root2)   |  P = 5,5,5  | (Root3)    
            // |  V = ^,^,^  |         / |  V = P      |
            // |  VP= ^,^,^  |        /  |             |
            // ---------------       /   ---------------
            //        |             /
            // ---------------
            // |  P = ^,^,^  | (Child)    
            // |  V = ^,^,^  |
            // |  VP =^,^,^  |
            // ---------------
            //
            // Root1: VP = 3,3,3
            // Root2: VP = 5,5,5
            // Root3: V = 5,5,5
            // Child: VP = 10,10,10
            //
            // Number of registered Dynamic Values: 4
            // Root1: 1 => VP = Root1.V + Root1.P 
            // Root2: 1 => VP = Root1.V + Root2.P
            // Root3: 1 => V = Root3.P
            // Child: 1 => VP = Root3.V + Root3.P
            var childCollection = new ParameterCollection("Child");
            childCollection.AddSources(root2Collection, root3Collection);

            Assert.AreEqual(childCollection.Get(paramVP), new Vector3(10, 10, 10));

            //
            // => Overrides P in child
            //
            // ---------------                
            // |  P = 1,1,1  | (Root1)        
            // |  V = 2,2,2  |                
            // |  VP = V+P   |                
//.........这里部分代码省略.........
开发者ID:Powerino73,项目名称:paradox,代码行数:101,代码来源:TestParameters.cs

示例11: TestCollectionsBasicValues

        public void TestCollectionsBasicValues()
        {
            //
            // => Initialize
            //
            // ---------------
            // |             | (Root)
            // |             |
            // ---------------
            //        |
            // ---------------
            // |             | (Child)    
            // |             |
            // ---------------
            var rootCollection = new ParameterCollection("Root");
            var childCollection = new ParameterCollection("Child");
            childCollection.AddSources(rootCollection);

            //
            // => Set P and V on Root (1,1,1)
            //
            // ---------------
            // |   V = 1,1,1 | (Root)
            // |   P = 1,1,1 |
            // ---------------
            //        |
            // ---------------
            // |   V = ^,^,^ | (Child)    
            // |   P = ^,^,^ |
            // ---------------
            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");
            rootCollection.Set(paramV, new Vector3(1, 1, 1));
            rootCollection.Set(paramP, new Vector3(1, 1, 1));

            // Verify collection.Count
            Assert.AreEqual(childCollection.Count, 2);

            // Verify collection.Contains
            Assert.AreEqual(childCollection.ContainsKey(paramV), true);
            Assert.AreEqual(childCollection.ContainsKey(paramP), true);

            //
            // => Set V in Root, Get from Child
            //
            // ---------------
            // |   V = 2,2,2 | (Root) 
            // |   P = 1,1,1 |
            // ---------------
            //        |
            // ---------------
            // |   V = ^,^,^ | (Child)   
            // |   P = ^,^,^ |
            // ---------------
            // Verify the Get and returned value
            Assert.AreEqual(childCollection.Get(paramV), new Vector3(1, 1, 1));
            rootCollection.Set(paramV, new Vector3(2,2,2));
            Assert.AreEqual(childCollection.Get(paramV), new Vector3(2, 2, 2));

            //
            // => Remove P from Root
            //
            // ---------------
            // |   V = 2,2,2 | (Root)  
            // |             |
            // ---------------
            //        |
            // ---------------
            // |   V = ^,^,^ | (Child)    
            // ---------------
            rootCollection.Remove(paramP);
            Assert.AreEqual(childCollection.Count, 1);

            //
            // => Overrides V in Child (3,3,3)
            //
            // ---------------
            // |   V = 2,2,2 | (Root)  
            // |             |
            // ---------------
            //        |
            // ---------------
            // |   V = 3,3,3 | (Child)    
            // ---------------            
            childCollection.Set(paramV, new Vector3(3, 3, 3));
            Assert.AreEqual(childCollection.Get(paramV), new Vector3(3, 3, 3));
            Assert.AreEqual(rootCollection.Get(paramV), new Vector3(2, 2, 2));

            //
            // => Reset Key V on Child
            //
            // ---------------
            // |   V = 2,2,2 | (Root)  
            // |             |
            // ---------------
            //        |
            // ---------------
            // |   V = ^,^,^ | (Child)    
            // ---------------            
            childCollection.Reset(paramV);
//.........这里部分代码省略.........
开发者ID:Powerino73,项目名称:paradox,代码行数:101,代码来源:TestParameters.cs

示例12: TestCollections1

        public void TestCollections1()
        {
            //
            // => Initialize
            //
            // ---------------                ---------------
            // |  P = 1,1,1  | (Root1)        |  P = 3,3,3  | (Root2)
            // |  V = 2,2,2  |                |             |
            // ---------------                ---------------
            //        
            // ---------------
            // |             | (Child)    
            // |             |
            // ---------------
            var root1Collection = new ParameterCollection("Root1");
            var root2Collection = new ParameterCollection("Root2");
            var childCollection = new ParameterCollection("Child");

            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");
            root1Collection.Set(paramP, new Vector3(1, 1, 1));
            root1Collection.Set(paramV, new Vector3(2, 2, 2));
            root2Collection.Set(paramP, new Vector3(3, 3, 3));

            //
            // => Add source Roo1 and Root2 to Child
            //
            // ---------------                ---------------
            // |  P = 1,1,1  | (Root1)        |  P = 3,3,3  | (Root2)
            // |  V = 2,2,2  |                |             |
            // ---------------                ---------------
            //        |                    / 
            // ---------------           /
            // |  P = ^,^,^  | (Child) / 
            // |  V = ^,^,^  |
            // ---------------
            // P = 3,3,3
            // V = 2,2,2
            childCollection.AddSources(root1Collection, root2Collection);

            Assert.AreEqual(childCollection.Count, 2);
            Assert.AreEqual(childCollection.Get(paramP), new Vector3(3, 3, 3));
            Assert.AreEqual(childCollection.Get(paramV), new Vector3(2, 2, 2));

            //
            // => Add source Roo1 and Root2 to Child
            //
            // ---------------                ---------------
            // |  P = 1,1,1  | (Root1)        |             | (Root2)
            // |  V = 2,2,2  |                |  V = 3,3,3  |
            // ---------------                ---------------
            //        |                    / 
            // ---------------           /
            // |  P = ^,^,^  | (Child) / 
            // |  V = ^,^,^  |
            // ---------------
            // P = 1,1,1
            // V = 3,3,3
            root2Collection.Remove(paramP);
            root2Collection.Set(paramV, new Vector3(3,3,3));
            Assert.AreEqual(childCollection.Count, 2);
            Assert.AreEqual(childCollection.Get(paramP), new Vector3(1, 1, 1));
            Assert.AreEqual(childCollection.Get(paramV), new Vector3(3, 3, 3));

            //
            // => Remove source Root1 for Child
            //
            // ---------------                ---------------
            // |  P = 1,1,1  | (Root1)        |             | (Root2)
            // |  V = 2,2,2  |                |  V = 3,3,3  |
            // ---------------                ---------------
            //                            / 
            // ---------------           /
            // |             | (Child) / 
            // |  V = ^,^,^  |
            // ---------------
            // V = 3,3,3
            childCollection.RemoveSource(root1Collection);
            Assert.AreEqual(childCollection.Count, 1);
            Assert.AreEqual(childCollection.Get(paramV), new Vector3(3, 3, 3));

            //
            // => Inherit Root1 from Child
            //
            // ---------------               ---------------
            // |             | (Child) ------|             | (Root2)
            // |  V = ^,^,^  |               |  V = 3,3,3  |
            // ---------------               ---------------
            //        |                     
            // ---------------           
            // |  P = 1,1,1  | (Root1) 
            // |  V = 2,2,2  |         
            // ---------------         
            root1Collection.AddSources(childCollection);
            Assert.AreEqual(root1Collection.Count, 2);
            Assert.AreEqual(root1Collection.Get(paramP), new Vector3(1, 1, 1));
            Assert.AreEqual(root1Collection.Get(paramV), new Vector3(2, 2, 2));
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:98,代码来源:TestParameters.cs

示例13: TestDynamicArrayValues1

        public void TestDynamicArrayValues1()
        {
            //
            // => Initialize, set V and P
            //
            // -------------------------------
            // |  VArray = {1,2,3}           | (Test)
            // |  PArray = {0,1,0}           |
            // -------------------------------
            var collection = new ParameterCollection("Test");
            var paramVArray = new ParameterKey<float[]>("VArray",3);
            var paramPArray = new ParameterKey<float[]>("PArray",3);

            // Set paramV and paramP
            collection.SetArray(paramVArray, new float[] { 1, 2, 3 });
            collection.SetArray(paramPArray, new float[] { 0, 1, 0 });

            //
            // => Set VDyn1 and VDyn2
            //
            // -------------------------------
            // |  VArray = {1,2,3}           | (Test)
            // |  PArray = {0,1,0}           |
            // |  VPDynArray = VArray+PArray |
            // -------------------------------
            var paramVPDynArray = new ParameterKey<float[]>("VPDynArray", 3);
            // paramViewProjDyn2 = paramV - paramP
            collection.AddDynamic(paramVPDynArray, ParameterDynamicValue.New(paramVArray, paramPArray, 
                (ref float[] paramVArg, ref float[] paramPArg, ref float[] output) =>
                    {
                        for (int i = 0; i < 3; i++)
                            output[i] = paramVArg[i] + paramPArg[i];
                    }));


            float[] result;
            collection.Get(paramVPDynArray, out result);
            Assert.AreEqual(new Vector3(result), new Vector3(1, 3, 3));

            // Remove value from array
            collection.Remove(paramVPDynArray);
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:42,代码来源:TestParameters.cs

示例14: TestBasicValues

        public void TestBasicValues()
        {
            //
            // => Initialize, Set V (1,1,1)
            //
            // ---------------
            // |  V = 1,1,1  | (Test)
            // |             |
            // ---------------
            var collection = new ParameterCollection("Test");

            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");
            collection.Set(paramV, new Vector3(1, 1, 1));

            // Verify collection.Count
            Assert.AreEqual(collection.Count, 1);

            // Verify collection.Contains
            Assert.AreEqual(collection.ContainsKey(paramV), true);

            // Verify collection.Keys Enumerator
            int count = 0;
            foreach(var key in collection.Keys)
            {
                Assert.AreEqual(key, paramV);
                count++;
            }
            Assert.AreEqual(count, 1);

            // Verify the Get and returned value
            var value = collection.Get(paramV);
            Assert.AreEqual(value, new Vector3(1,1,1));

            //
            // => Set P (2,2,2)
            //
            // ---------------
            // |  V = 1,1,1  | (Test)
            // |  P = 2,2,2  |
            // ---------------
            collection.Set(paramP, new Vector3(2,2,2));
            Assert.AreEqual(collection.Count, 2);
            Assert.AreEqual(collection.Get(paramP), new Vector3(2, 2, 2));

            //
            // => Remove param V
            //
            // ---------------
            // |             | (Test)
            // |  P = 2,2,2  |
            // ---------------
            collection.Remove(paramV);
            Assert.AreEqual(collection.Count, 1);

            // Check that param
            Assert.AreEqual(collection.Get(paramP), new Vector3(2, 2, 2));

            //
            // => Remove param P
            //
            // ---------------
            // |             | (Test)
            // |             |
            // ---------------
            collection.Remove(paramP);
            Assert.AreEqual(collection.Count, 0);

            //
            // => Set param V
            //
            // ---------------
            // |  V = 2,2,2  | (Test)
            // |             |
            // ---------------
            // Just add same key to test that everything is going fine
            collection.Set(paramV, new Vector3(2, 2, 2));
            Assert.AreEqual(collection.Count, 1);
            Assert.AreEqual(collection.Get(paramV), new Vector3(2, 2, 2));
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:80,代码来源:TestParameters.cs

示例15: TestDynamicValues3

        public void TestDynamicValues3()
        {
            //
            // => Initialize, set V and P
            //
            // ------------------------
            // |  V = 1,2,3           | (Test)
            // |  P = 0,1,0           |
            // ------------------------
            var collection = new ParameterCollection("Test");
            var paramV = new ParameterKey<Vector3>("View");
            var paramP = new ParameterKey<Vector3>("Proj");

            // Set paramV and paramP
            collection.Set(paramV, new Vector3(1, 2, 3));
            collection.Set(paramP, new Vector3(0, 1, 0));

            //
            // => Set VDyn1 and VDyn2
            //
            // ------------------------
            // |  V = 1,2,3           | (Test)
            // |  P = 0,1,0           |
            // |  VDyn1 = V + P       |
            // |  VDyn2 = V - P       |
            // ------------------------
            // VDyn1 = (1,3,3)
            // VDyn2 = (1,1,3)
            var paramViewProjDyn1 = new ParameterKey<Vector3>("ViewProjDyn1");
            var paramViewProjDyn2 = new ParameterKey<Vector3>("ViewProjDyn2");
            var valueViewProjDyn1 = ParameterDynamicValue.New(paramV, paramP, (ref Vector3 paramVArg, ref Vector3 paramPArg, ref Vector3 output) => output = paramVArg + paramPArg);
            collection.AddDynamic(paramViewProjDyn1, valueViewProjDyn1);

            // paramViewProjDyn2 = paramV - paramP
            collection.AddDynamic(paramViewProjDyn2, ParameterDynamicValue.New(paramP, paramV, (ref Vector3 paramPArg, ref Vector3 paramVArg, ref Vector3 output) => output = paramVArg - paramPArg));

            Assert.AreEqual(collection.Get(paramViewProjDyn1), new Vector3(1, 3, 3));
            Assert.AreEqual(collection.Get(paramViewProjDyn2), new Vector3(1, 1, 3));

            //
            // => Set VDyn1 and VDyn2
            //
            // ------------------------
            // |  V = 1,2,3           | (Test)
            // |  P = 0,1,0           |
            // |  VDyn1 = V + P       |
            // |  VDyn2 = V + P       |
            // ------------------------
            // VDyn1 = (1,3,3)
            // VDyn2 = (1,3,3)
            collection.AddDynamic(paramViewProjDyn2, valueViewProjDyn1);
            Assert.AreEqual(collection.Get(paramViewProjDyn2), new Vector3(1, 3, 3));

            //
            // => Remove all variables
            //
            // ------------------------
            // |                      | (Test)
            // |                      |
            // ------------------------
            collection.Remove(paramViewProjDyn1);
            collection.Remove(paramViewProjDyn2);
            collection.Remove(paramV);
            collection.Remove(paramP);

            Assert.AreEqual(collection.Count, 0);
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:67,代码来源:TestParameters.cs


注:本文中的ParameterCollection.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。