Exemplo n.º 1
0
        public void CreateNewLayerSetsDefaultState()
        {
            var stub  = new AnimatorStub(_go);
            var layer = stub.AddLayer("Test");

            Assert.IsNotNull(layer.stateMachine.defaultState);
        }
        public void Setup()
        {
            _runtime = new GameObject("AnimatorRuntime").AddComponent <AnimatorHelperRuntime>();
            _stub    = new AnimatorStub();

            _stub.AnimatorCtrl.AddParameter(new AnimatorControllerParameter {
                name = "bool",
                type = AnimatorControllerParameterType.Bool
            });

            _stub.AnimatorCtrl.AddParameter(new AnimatorControllerParameter {
                name = "float",
                type = AnimatorControllerParameterType.Float
            });

            _stub.AnimatorCtrl.AddParameter(new AnimatorControllerParameter {
                name = "int",
                type = AnimatorControllerParameterType.Int
            });

            _stub.AnimatorCtrl.AddParameter(new AnimatorControllerParameter {
                name = "trigger",
                type = AnimatorControllerParameterType.Trigger
            });
        }
Exemplo n.º 3
0
        public void CreateNewLayerCreatesAtLeastOneState()
        {
            var stub  = new AnimatorStub(_go);
            var layer = stub.AddLayer("Test");

            Assert.IsTrue(layer.stateMachine.states.Length >= 1);
        }
Exemplo n.º 4
0
        public void CreateNewLayerReturnsLayer()
        {
            var stub  = new AnimatorStub(_go);
            var layer = stub.AddLayer("Test");

            Assert.IsNotNull(layer);
        }
Exemplo n.º 5
0
        public void CreateNewLayerAddsAnotherLayer()
        {
            var stub = new AnimatorStub(_go);

            stub.AddLayer("Test");

            Assert.AreEqual(stub.AnimatorCtrl.layers.Length, 2);
        }
Exemplo n.º 6
0
        public void CreateNewLayerSetsName()
        {
            var layerName = "Test";
            var stub      = new AnimatorStub(_go);
            var layer     = stub.AddLayer(layerName);

            Assert.AreEqual(layerName, layer.name);
        }
Exemplo n.º 7
0
        public void AttachRuntimeController()
        {
            var stub = new AnimatorStub(_go);

            stub.InjectCtrl();

            Assert.AreSame(stub.Animator.runtimeAnimatorController, stub.AnimatorCtrl);
        }
        public void Teardown()
        {
            Object.DestroyImmediate(_stub.Animator.gameObject);
            _stub = null;

            Object.DestroyImmediate(_runtime.gameObject);
            AnimatorHelperRuntime.ClearSingleton();
            _runtime = null;
        }
Exemplo n.º 9
0
        public void RuntimeControllerNameSameAsCreationName()
        {
            var stub = new AnimatorStub(_go);

            stub.AnimatorCtrl.name = "asdf";
            stub.InjectCtrl();

            Assert.AreEqual(stub.AnimatorCtrl.name, stub.Animator.runtimeAnimatorController.name);
            Assert.AreNotEqual(stub.Animator.gameObject.name, stub.Animator.runtimeAnimatorController.name);
        }
        public void Setup()
        {
            _animParCol = new AnimatorParametersCollection();
            _stub       = new AnimatorStub();

            _stub.AnimatorCtrl.AddParameter(new AnimatorControllerParameter {
                defaultBool = true,
                name        = "a",
                type        = AnimatorControllerParameterType.Bool
            });
        }
Exemplo n.º 11
0
        public void GetAnimatorParameter()
        {
            var          stub  = new AnimatorStub(_go);
            const string param = "test";

            stub.AnimatorCtrl.AddParameter(param, AnimatorControllerParameterType.Bool);
            stub.InjectCtrl();
            var result = stub.Animator.GetBool(param);

            Assert.IsFalse(result);
        }
Exemplo n.º 12
0
        public void SetupAnimatorPlayback()
        {
            _playback = ScriptableObject.CreateInstance <AnimatorPlayback>();

            _stub = new AnimatorStub(new GameObject("AnimatorStub"));
            _stub.AnimatorCtrl.AddParameter("bool", AnimatorControllerParameterType.Bool);
            _stub.AnimatorCtrl.AddParameter("float", AnimatorControllerParameterType.Float);
            _stub.AnimatorCtrl.AddParameter("int", AnimatorControllerParameterType.Int);
            _stub.AnimatorCtrl.AddParameter("trigger", AnimatorControllerParameterType.Trigger);

            _stub.InjectCtrl();
        }
Exemplo n.º 13
0
        public void PlayAdvancesToTheNextState()
        {
            var          stub      = new AnimatorStub(_go);
            var          layer     = stub.AnimatorCtrl.layers[0];
            const string stateName = "New State";
            var          state     = layer.stateMachine.AddState(stateName);
            var          trans     = layer.stateMachine.defaultState.AddTransition(state);

            layer.stateMachine.defaultState.AddTransition(state);
            trans.hasExitTime = true;
            stub.InjectCtrl();
            stub.Animator.Update(10);

            var stateInfo = stub.Animator.GetCurrentAnimatorStateInfo(0);

            Assert.IsTrue(stateInfo.IsName(stateName));
        }
Exemplo n.º 14
0
 public void TeardownAnimatorPlayback()
 {
     Object.DestroyImmediate(_stub.Animator.gameObject);
     _playback = null;
     _stub     = null;
 }
Exemplo n.º 15
0
        public void DoesNotFailCreationIfNoGameObject()
        {
            var stub = new AnimatorStub(null);

            Assert.IsTrue(stub.IsValid);
        }
Exemplo n.º 16
0
        public void CreatesIfGameObjectPassedIn()
        {
            var stub = new AnimatorStub(_go);

            Assert.IsTrue(stub.IsValid);
        }
 public void Setup()
 {
     _stub = new AnimatorStub();
 }
 public void Teardown()
 {
     Object.DestroyImmediate(_stub.Animator.gameObject);
     _stub = null;
 }
Exemplo n.º 19
0
 public void Setup()
 {
     _runtime = new GameObject("AnimatorRuntime").AddComponent <AnimatorHelperRuntime>();
     _stub    = new AnimatorStub();
 }