コード例 #1
0
        public void Constant_Reference_Clamps()
        {
            var clamped = new FloatVariableReferenceClamped();

            var first  = new FloatVariableReference();
            var second = new FloatVariableReference();

            first.Type  = ReferenceType.Constant;
            second.Type = ReferenceType.Constant;

            Clamped_Reference_Clamps(first, second, clamped);
        }
コード例 #2
0
        private void Clamped_Reference_Clamps(FloatVariableReference first, FloatVariableReference second,
                                              FloatVariableReferenceClamped clamped)
        {
            first.Value  = 0;
            second.Value = 20;

            clamped.Min = first;
            clamped.Max = second;

            Assert.AreEqual(first.Value, clamped.Value);
            clamped.Value = 50;
            Assert.AreEqual(second.Value, clamped.Value);
        }
コード例 #3
0
        public void Shared_Reference_Clamps()
        {
            var clamped = new FloatVariableReferenceClamped();

            var firstVariable  = ScriptableObject.CreateInstance(typeof(FloatVariable)) as FloatVariable;
            var secondVariable = ScriptableObject.CreateInstance(typeof(FloatVariable)) as FloatVariable;

            var first  = new FloatVariableReference();
            var second = new FloatVariableReference();

            first.Variable  = firstVariable;
            second.Variable = secondVariable;

            first.Type  = ReferenceType.Shared;
            second.Type = ReferenceType.Shared;

            Clamped_Reference_Clamps(first, second, clamped);
        }
コード例 #4
0
        public void Instanced_Reference_Clamps()
        {
            var clamped = new FloatVariableReferenceClamped();

            var firstVariable  = ScriptableObject.CreateInstance(typeof(FloatVariable)) as FloatVariable;
            var secondVariable = ScriptableObject.CreateInstance(typeof(FloatVariable)) as FloatVariable;

            var first  = new FloatVariableReference();
            var second = new FloatVariableReference();

            var gameObject             = new GameObject();
            var instancedVariableOwner = gameObject.AddComponent <InstanceOwner>();

            first.Connection  = instancedVariableOwner;
            second.Connection = instancedVariableOwner;

            first.Variable  = firstVariable;
            second.Variable = secondVariable;

            first.Type  = ReferenceType.Instanced;
            second.Type = ReferenceType.Instanced;

            Clamped_Reference_Clamps(first, second, clamped);
        }