Skip to content

develop Character Stat Base

Jeon-YJ1004 edited this page Mar 24, 2023 · 1 revision

세팅사항

  • Resource>CharacterData에 캐릭터 별 scriptableObject 생성하여 스탯 설정

image

  • Resource>CharacterSprite 에 캐릭터 대표 스프라이트 넣기

image

[CharacterScriptableObject.cs]

[CreateAssetMenu(fileName = "Character", menuName = "ScriptableObjects/Character")]
public class CharacterScriptableObject : ScriptableObject
{
    [Header("#Main Info")]
    public CharacterType characterType;
    
    public int MaxHealth;//100hp
    public float Recovery;//0 HP/s
    public int Armor;//0 Armor
    public float MoveSpeed;//1
    public float Might;//1
    //public float MaxMight;//10
    public float Area;//1
    //public float MaxArea;//10
    public float ProjectileSpeed;//1
    //public float MaxProjectileSpeed;//5
    public float Duration;//1
    //public float MaxDuration;//5
    public int Amount;//0
    //public int MaxAmount;//10
    public float Cooldown;//1
    //public float MaxCooldown;//0.1
    public float Luck;//1
    public float Growth;//1
    public float Greed;//1
    public float Curse;//1
    public float MagnetBonus;//1 //Magnet = 30 * character bonus * PowerUp multiplier
    public int Revival;//0
    public int Reroll;//0
    public int Skip;//0
    public int Banish;//0
    
    public int Ommi;
    public int Reflection;
    public Weapon startingWeapon;
    //ToDo: 특수 능력 구현
}

[Enums.cs]

 public enum CharacterType
    { 
        Rogue,//Antonio,
        StormMage,//Imelda,      
        Barbarian,//Gennaro,      
        FireMage, //Arca
        Necromancer,//Porta,
        Warlock,//Poe,
        Alchemist,//Clerici
    }

[Character.cs]
 //캐릭터의 스탯지정
 public CharacterScriptableObject characterData;
 void Start()
    {   
        string resourceName = "CharacterData/";
        try
        {
            resourceName += DataManager.instance.currentCharcter;
        }
        catch (NullReferenceException ex)
        {
            resourceName += "Alchemist";
        }
        characterData = Resources.Load<CharacterScriptableObject>(resourceName);
   }

characterData.MagnetBonus 형식으로 사용 가능

Clone this wiki locally