public void Init(CharacterData d, bool monster) { config = CharacterConfigManager.instance.Get(d.configId); data = d; isMonster = monster; speed = d.speed + config.speed; attack = d.attack + config.attack; crit = d.crit + config.crit; critDamge = (d.critDamage + config.critDamage) / 100f; defense = config.defense; hp = d.hp + config.hp; special = d.specialType; maxHp = hp; if (config.skillId1 > 0) { skill = SkillManager.instance.CreateSkill(config.skillId1, this); } if (config.passiveSkillId > 0) { passiveSkill = PassiveSkillManager.instance.CreateSkill(config.passiveSkillId, this); } normalAttackSkill = SkillManager.instance.CreateSkill(config.normalAttackSkillId, this); animation = GetComponentInChildren <Animation>(); }
public void ReadFromJson(JsonData json) { id = json.ReadInt("id"); configId = json.ReadInt("configId"); name = json.ReadString("name"); hp = json.ReadInt("hp"); attack = json.ReadInt("attack"); crit = json.ReadInt("crit"); critDamage = json.ReadInt("critDamage"); speed = json.ReadInt("speed"); defense = json.ReadInt("defense"); specialType = (CharacterSpecialType)json.ReadInt("specialType"); }