Exemplo n.º 1
0
        private void NextCharacterMap()
        {
            SpriterCharacterMap[] maps = currentAnimator.Entity.CharacterMaps;
            if (maps == null || maps.Length == 0)
            {
                return;
            }
            SpriterCharacterMap charMap = currentAnimator.CharacterMap;

            if (charMap == null)
            {
                charMap = maps[0];
            }
            else
            {
                int index = charMap.Id + 1;
                if (index >= maps.Length)
                {
                    charMap = null;
                }
                else
                {
                    charMap = maps[index];
                }
            }

            currentAnimator.CharacterMap = charMap;
        }
Exemplo n.º 2
0
    private void PushCharacterMap()
    {
        SpriterCharacterMap[] maps = animator.Entity.CharacterMaps;
        if (maps == null || maps.Length == 0)
        {
            return;
        }
        SpriterCharacterMap charMap = animator.SpriteProvider.CharacterMap;

        if (charMap == null)
        {
            charMap = maps[0];
        }
        else
        {
            int index = charMap.Id + 1;
            if (index >= maps.Length)
            {
                charMap = null;
            }
            else
            {
                charMap = maps[index];
            }
        }

        if (charMap != null)
        {
            animator.SpriteProvider.PushCharMap(charMap);
        }
    }
Exemplo n.º 3
0
        public static void PushNextCharacterMap <TSprite, TSound>(this Animator <TSprite, TSound> animator)
        {
            SpriterCharacterMap[] maps = animator.Entity.CharacterMaps;
            if (maps == null || maps.Length == 0)
            {
                return;
            }
            SpriterCharacterMap charMap = animator.SpriteProvider.CharacterMap;

            if (charMap == null)
            {
                charMap = maps[0];
            }
            else
            {
                int index = charMap.Id + 1;
                if (index >= maps.Length)
                {
                    charMap = null;
                }
                else
                {
                    charMap = maps[index];
                }
            }

            if (charMap != null)
            {
                animator.SpriteProvider.PushCharMap(charMap);
            }
        }
Exemplo n.º 4
0
        protected virtual void ApplyCharMap(SpriterCharacterMap charMap)
        {
            if (charMap == null)
            {
                CharMapValues.Clear();
                return;
            }

            for (int i = 0; i < charMap.Maps.Length; ++i)
            {
                SpriterMapInstruction map = charMap.Maps[i];
                T sprite = GetAsset(map.FolderId, map.FileId);
                if (sprite == null)
                {
                    continue;
                }

                CharMapValues[sprite] = new KeyValuePair <int, int>(map.TargetFolderId, map.TargetFileId);
            }
        }
Exemplo n.º 5
0
 public virtual void PushCharMap(SpriterCharacterMap charMap)
 {
     ApplyCharMap(charMap);
     CharMaps.Push(charMap);
 }