Example #1
0
        public void OnDrawGizmos()
        {
            if (Bake)
            {
                if (AnimationStates != null && AnimationStates.Length > 0)
                {
                    SAnimator sa = gameObject.AddComponent <SAnimator>();
                    sa.AnimationAddresses = new AnimationAddress[AnimationStates.Length];
                    for (int i = 0; i < AnimationStates.Length; i++)
                    {
                        CLLContainer container = SerializationUtilits.SerialazingAnimation(AnimationStates[i].Sprites);
                        sa.AnimationAddresses[i] = new AnimationAddress(AnimationStates[i].Name, container);
                    }

                    sa.DeffaultAnimation = DeffaultAnimation == default(string) ? AnimationStates[0].Name : DeffaultAnimation;

                    if (DestoryIteself)
                    {
                        DestroyImmediate(this);
                    }
                }
                else
                {
                    Bake = false;
                }
            }
        }
Example #2
0
        private static CLLContainer CircleLinkedListToScriptableObject(Sprite[] sprites, string folderName)
        {
            CLLContainer aniationContainer = ScriptableObject.CreateInstance <CLLContainer>();

            aniationContainer.Sprites = sprites;
            AssetDatabase.CreateAsset(aniationContainer, folderName + BakeFileName);
            AssetDatabase.SaveAssets();
            Selection.activeObject = aniationContainer;
            return(aniationContainer);
        }
        public void OnDrawGizmos()
        {
            if (Bake)
            {
                if (StateOfHero != null && StateOfHero.IsReady())
                {
                    SHeroAnimator sa = gameObject.AddComponent <SHeroAnimator>();
                    sa.AnimationAddresses = new AnimationAddress[7];
                    CLLContainer container = SerializationUtilits.SerialazingAnimation(StateOfHero.RunSprites);
                    sa.AnimationAddresses[0] = new AnimationAddress("Run", container, true);

                    container = SerializationUtilits.SerialazingAnimation(StateOfHero.JumpUpSprites);
                    sa.AnimationAddresses[1] = new AnimationAddress("JumpUp", container, false);

                    container = SerializationUtilits.SerialazingAnimation(StateOfHero.JumpDownSprites);
                    sa.AnimationAddresses[2] = new AnimationAddress("JumpDown", container, false);

                    container = SerializationUtilits.SerialazingAnimation(StateOfHero.JumpSprites);
                    sa.AnimationAddresses[3] = new AnimationAddress("Jump", container, true);

                    container = SerializationUtilits.SerialazingAnimation(StateOfHero.SlideUpSprites);
                    sa.AnimationAddresses[4] = new AnimationAddress("SlideUp", container, false);

                    container = SerializationUtilits.SerialazingAnimation(StateOfHero.SlideDownSprites);
                    sa.AnimationAddresses[5] = new AnimationAddress("SlideDown", container, false);

                    container = SerializationUtilits.SerialazingAnimation(StateOfHero.SlideSprites);
                    sa.AnimationAddresses[6] = new AnimationAddress("Slide", container, true);

                    sa.DeffaultAnimation = "Run";

                    Bake = false;
                    if (DestoryIteself)
                    {
                        DestroyImmediate(this);
                    }
                }
                else
                {
                    Bake = false;
                    throw new ArgumentException("YOu have some problem with state", "StateOfHero");
                }
            }
        }