Пример #1
0
    public AFStatesController buildHeroAnimation()
    {
        AFStatesController m_heroStates;

        UnityEngine.Debug.Log(AFAssetManager.GetPathTargetPlatformWithResolution() + "/" + "hero_sprites");
        AFTextureAtlas heroAtlas = AFAssetManager.Instance.Load <AFTextureAtlas>(AFAssetManager.GetPathTargetPlatformWithResolution() + "/" + "hero_sprites");

        m_heroStates = AFObject.Create <AFStatesController>("Hero Controller");

        AFMovieClip animation = AFObject.Create <AFMovieClip>("small_walk");

        animation.Init(heroAtlas.GetSprites("small_walk"));
        animation.gameObject.AddComponent <BoxCollider2D>();
        m_heroStates.Add("small_walk", animation, false);

        animation = AFObject.Create <AFMovieClip>("small_stop");
        animation.Init(heroAtlas.GetSprites("small_stop"));
        animation.gameObject.AddComponent <BoxCollider2D>();
        m_heroStates.Add("small_stop", animation, true);

        m_heroStates.gameObject.AddComponent <Rigidbody2D>();

        m_heroStates.transform.localScale = new UnityEngine.Vector3(3, 3, 3);

        return(m_heroStates);
    }
Пример #2
0
        public AFMovieClip BuildAnimation(string spritePath, string animationStateName)
        {
            AFMovieClip    L_animation;
            AFTextureAtlas L_heroAtlas = AFAssetManager.Instance.Load <AFTextureAtlas>(spritePath);

            L_animation = AFObject.Create <AFMovieClip>(animationStateName);
            L_animation.Init(L_heroAtlas.GetSprites(animationStateName));
            return(L_animation);
        }