You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1019 B
39 lines
1019 B
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "CharacterProperty", menuName = "ScriptableObject/Character/CharacterProperty")]
|
|
public class CharacterProperty : ScriptableObject
|
|
{
|
|
public uint id;
|
|
public Character prefab;
|
|
|
|
public StatCreator[] stats;
|
|
public SkillProperty[] skills;
|
|
}
|
|
|
|
public class CharacterData
|
|
{
|
|
CharacterProperty property;
|
|
|
|
StatGroup statGroup;
|
|
SkillData[] skills;
|
|
|
|
public uint ID => property.id;
|
|
public Character Prefab => property.prefab;
|
|
public IReadOnlyList<SkillData> Skills => skills;
|
|
|
|
public CharacterData(CharacterProperty property)
|
|
{
|
|
this.property = property;
|
|
|
|
statGroup = new StatGroup(property.stats);
|
|
|
|
skills = new SkillData[property.skills.Length];
|
|
for (int i = 0; i < skills.Length; i++)
|
|
{
|
|
skills[i] = new SkillData(property.skills[i]);
|
|
}
|
|
}
|
|
|
|
public bool TryGetStat(StatID id, out StatData stat) => statGroup.TryGetStat(id, out stat);
|
|
}
|