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;
                }
            }
        }
        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");
                }
            }
        }
Example #3
0
 public void OnDrawGizmos()
 {
     if (Bake)
     {
         if (Sprites != null && Sprites.Length > 0)
         {
             var sa = gameObject.AddComponent <SAnimation>();
             sa.Container = SerializationUtilits.SerialazingAnimation(Sprites);
             gameObject.GetComponent <SpriteRenderer>().sprite = Sprites[0];
             Bake = false;
             if (DestorIteself)
             {
                 DestroyImmediate(this);
             }
         }
         else
         {
             Bake = false;
         }
     }
 }