2022-09-27 10:01:43 +03:00
|
|
|
using System;
|
2022-10-01 18:02:11 +03:00
|
|
|
using System.Collections.Generic;
|
2022-09-27 10:01:43 +03:00
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.U2D;
|
|
|
|
|
[CreateAssetMenu(fileName = "AnimationSO", menuName = "Darklings-FightingGame/AnimationSO", order = 0)]
|
|
|
|
|
public class AnimationSO : ScriptableObject
|
|
|
|
|
{
|
|
|
|
|
public SpriteAtlas[] spriteAtlas;
|
|
|
|
|
public AnimationCelsGroup[] animationCelsGroup;
|
|
|
|
|
|
|
|
|
|
public Sprite GetSprite(int skin, int group, int cel)
|
|
|
|
|
{
|
|
|
|
|
return spriteAtlas[skin].GetSprite(animationCelsGroup[group].animationCel[cel].sprite.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AnimationCelsGroup GetGroup(int group)
|
|
|
|
|
{
|
|
|
|
|
return animationCelsGroup[group];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AnimationCel GetCel(int group, int cel)
|
|
|
|
|
{
|
|
|
|
|
return animationCelsGroup[group].animationCel[cel];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetGroupId(string name)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < animationCelsGroup.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (animationCelsGroup[i].celName == name)
|
|
|
|
|
{
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public struct AnimationCelsGroup
|
|
|
|
|
{
|
|
|
|
|
public string celName;
|
|
|
|
|
public bool loop;
|
2022-10-06 17:42:26 +03:00
|
|
|
public CameraShakerSO cameraShake;
|
2022-10-01 18:02:11 +03:00
|
|
|
public List<AnimationCel> animationCel;
|
2022-09-27 10:01:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
2022-10-01 18:02:11 +03:00
|
|
|
public class AnimationCel
|
2022-09-27 10:01:43 +03:00
|
|
|
{
|
|
|
|
|
public int frames;
|
|
|
|
|
public Sprite sprite;
|
2022-10-06 17:42:26 +03:00
|
|
|
public AnimationEvent animationEvent;
|
2022-10-02 12:58:34 +03:00
|
|
|
public List<AnimationBox> hitboxes;
|
|
|
|
|
public List<AnimationBox> hurtboxes;
|
2022-09-27 10:01:43 +03:00
|
|
|
}
|
|
|
|
|
|
2022-10-06 17:42:26 +03:00
|
|
|
[Serializable]
|
|
|
|
|
public class AnimationEvent
|
|
|
|
|
{
|
|
|
|
|
public bool jump;
|
|
|
|
|
public bool footstep;
|
|
|
|
|
public bool throwEnd;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-27 10:01:43 +03:00
|
|
|
[Serializable]
|
2022-10-02 12:58:34 +03:00
|
|
|
public class AnimationBox
|
2022-09-27 10:01:43 +03:00
|
|
|
{
|
2022-10-02 12:58:34 +03:00
|
|
|
public Vector2 size;
|
|
|
|
|
public Vector2 offset;
|
2022-09-27 10:01:43 +03:00
|
|
|
}
|