public void AddClip_WithLegacyClip_Throws_ArgumentException()
        {
            SimpleAnimation animation = Instantiate();
            var             clip      = new AnimationClip();

            clip.legacy = true;
            Assert.Throws <ArgumentException>(() => { animation.AddClip(clip, "DefaultName"); });
        }
Exemplo n.º 2
0
        //  Initialization  -----------------------------------
        private void Initialize()
        {
            _renderers = GetComponentsInChildren <Renderer>().ToList <Renderer>();

            foreach (AnimationClip animationClip in _animationClips)
            {
                _simpleAnimation.AddClip(animationClip, animationClip.name);
            }
        }
 public void SetUp()
 {
     GoCamera = new GameObject("Camera");
     GoCamera.AddComponent <Camera>();
     GoCube          = GameObject.CreatePrimitive(PrimitiveType.Cube);
     SimpleAnimation = GoCube.AddComponent <SimpleAnimation>();
     SimpleAnimation.playAutomatically = false;
     SimpleAnimation.cullingMode       = AnimatorCullingMode.AlwaysAnimate;
     SimpleAnimation.AddClip(Resources.Load <AnimationClip>("Animations/Move"), "Move");
     SimpleAnimation.AddClip(Resources.Load <AnimationClip>("Animations/Scale"), "Scale");
 }
Exemplo n.º 4
0
    public int AddClip(out AnimationClip clip, string animationPath)
    {
        clip = Resources.Load(animationPath, typeof(AnimationClip)) as AnimationClip;

        if (clip == null)
        {
            string msg = "AddClip() : animationClip Path is wrong Path = " + animationPath;
            Debug.LogError(msg);
            return(-1);
        }
        return(_simpleAnimation.AddClip(clip, animationPath));
    }
        public void GetStates_ModifyStates_IEnumerator_MoveNext_Throws()
        {
            SimpleAnimation animation    = Instantiate();
            var             clip         = Resources.Load <AnimationClip>("LinearX");
            var             clipInstance = Object.Instantiate <AnimationClip>(clip);

            animation.AddClip(clipInstance, "SingleClip");
            IEnumerable <SimpleAnimation.State> states = animation.GetStates();
            var it = states.GetEnumerator();

            animation.RemoveState("SingleClip");
            Assert.Throws <InvalidOperationException>(() => { it.MoveNext(); });
        }
Exemplo n.º 6
0
 public void PlaySimpleAnime()
 {
     if (simpleAnime.GetState("fire") == null)
     {
         //animationClip.wrapMode = WrapMode.Once;
         animationClip.wrapMode = WrapMode.Clamp;                            // Same as Once
         //animationClip.wrapMode = WrapMode.ClampForever;
         simpleAnime.AddClip(animationClip, "fire");
     }
     simpleAnime.Play("fire");
     //simpleAnime.Play()
     //simpleAnime.CrossFade("fire_anime");
 }
        public void GetStates_WithSingleState_IEnumerator_Returns_ValidState()
        {
            SimpleAnimation animation    = Instantiate();
            var             clip         = Resources.Load <AnimationClip>("LinearX");
            var             clipInstance = Object.Instantiate <AnimationClip>(clip);

            animation.AddClip(clipInstance, "SingleClip");
            IEnumerable <SimpleAnimation.State> states = animation.GetStates();
            var it = states.GetEnumerator();

            it.MoveNext();
            SimpleAnimation.State state = it.Current;
            Assert.AreEqual("SingleClip", state.name);
        }
Exemplo n.º 8
0
    private void Start()
    {
        sa = GetComponent <SimpleAnimation>();
        if (sa == null)
        {
            sa = gameObject.AddComponent <SimpleAnimation>();
        }

        AnimationClip[] clips = Resources.LoadAll <AnimationClip>("animation_clip");
        name = new string[clips.Length];

        for (int i = 0; i < clips.Length; i++)
        {
            var c = clips[i];
            name[i] = c.name;
            sa.AddClip(c, name[i]);
        }

        sa.Play(name[cnt]);
    }