public Skill(string[] temps) { int offset = 0; ID = temps[offset].ToString(); offset++; Name = temps[offset].ToString(); offset++; Ico = temps[offset].ToString(); offset++; SkillType = (Global.SkillType) int.Parse(temps[offset]); offset++; SkillMono = temps[offset].ToString(); offset++; SkillEndDelay = float.Parse(temps[offset].ToString()); offset++; IsPassiveSkill = temps[offset].ToString() == "0" ? false : true; offset++; SkillEffectPaths = new List <string>(); SkillEffectPaths.AddRange(temps[offset].ToString().Split(new string[] { "|" }, System.StringSplitOptions.RemoveEmptyEntries)); offset++; ActiveState = (Global.BuffActiveState) int.Parse(temps[offset]); offset++; TargetType = (Global.SkillTargetType) int.Parse(temps[offset]); offset++; Level = int.Parse(temps[offset]); offset++; CostHeroProperty = new HeroProperty(temps[offset]); offset++; DelayTurn = int.Parse(temps[offset]); offset++; CauseHeroProperty = new HeroProperty(temps[offset]); offset++; HurtHeroProperty = new HeroProperty(temps[offset]); offset++; CriticalChance = int.Parse(temps[offset]); offset++; SkillBuff = new List <Buff>(); string[] buffs = temps[offset].ToString().Split(';'); offset++; for (int i = 0; i < buffs.Length; i++) { string[] bf = buffs[i].Split('|'); if (bf.Length == 2) { SkillBuff.Add(new Buff(bf[0], int.Parse(bf[1]))); } } Description = temps[offset].ToString(); offset++; }
/// <summary> /// Buff构造函数 /// </summary> /// <param name="ID">ID</param> public Buff(string ID) { this.ID = ID; this.Name = "Buff"; this.BuffType = Global.BuffType.IncreaseLife; this.TargetType = Global.BuffTargetType.None; this.BuffActiveState = Global.BuffActiveState.BeforeAction; this.ChangeHeroProperty = new HeroProperty(); this.IsBuff = true; this.Description = "buff描述"; }
/// <summary> /// 复制构造函数 /// </summary> /// <param name="property"></param> public HeroProperty(HeroProperty property) { this.MaxLife = property.MaxLife; this.MaxMagic = property.MaxMagic; this.CurrentLife = property.CurrentLife; this.CurrentMagic = property.CurrentMagic; this.Attack = property.Attack; this.Defense = property.Defense; this.MagicAttack = property.MagicAttack; this.MagicDefense = property.MagicDefense; this.Speed = property.Speed; this.Turn = property.Turn; }
/// <summary> /// 根据技能进行构造数据 /// </summary> /// <param name="ID">技能ID</param> /// <param name="chance">技能成功几率</param> public Buff(string ID, int chance) { Buff buff = BuffTable.Instance.GetBuffByID(ID); this.ID = buff.ID; this.Name = buff.Name; this.BuffType = buff.BuffType; this.TargetType = buff.TargetType; this.BuffActiveState = buff.BuffActiveState; this.StayTurn = buff.StayTurn; this.ChangeHeroProperty = buff.ChangeHeroProperty; this.IsBuff = buff.IsBuff; this.Description = buff.Description; this.SuccessChance = chance; }
/// <summary> /// 通过读取表格数据使用的构造函数 /// </summary> /// <param name="temps">读取的一条表格数据</param> public Buff(string[] temps) { int offset = 0; ID = temps[offset].ToString(); offset++; Name = temps[offset].ToString(); offset++; BuffType = (Global.BuffType) int.Parse(temps[offset]); offset++; TargetType = (Global.BuffTargetType) int.Parse(temps[offset]); offset++; BuffActiveState = (Global.BuffActiveState) int.Parse(temps[offset]); offset++; ChangeHeroProperty = new HeroProperty(temps[offset]); offset++; IsBuff = temps[offset] == "0" ? false : true; offset++; SuccessChance = int.Parse(temps[offset]); offset++; Description = temps[offset].ToString(); offset++; //赋值buff持续回合 StayTurn = ChangeHeroProperty.Turn; }
public void Init(Hero hero, bool isPlayer) { _Hero = hero; //获取动画控制器 Animator = GetComponent <Animator>(); //获取英雄的图像 Img = GetComponentInChildren <Image>(); CurrentTargets = new List <HeroMono>(); IsPlayerHero = isPlayer; //翻转对象 if (IsPlayerHero) { //AttackPosition.localPosition = new Vector3(AttackPosition.localPosition.x * -1f, AttackPosition.localPosition.y, AttackPosition.localPosition.z); Img.transform.localScale = new Vector3(-1f, 1f, 1f); } else { //AttackPosition.localPosition = new Vector3(AttackPosition.localPosition.x * -1f, AttackPosition.localPosition.y, AttackPosition.localPosition.z); Img.transform.localScale = new Vector3(1f, 1f, 1f); } //初始化buff debuff列表 _BuffList = new List <Buff>(); _DebuffList = new List <Buff>(); //初始化数据 _CurrentHero = new HeroProperty(_Hero, SystemSetting.HeroSpeedMix); //创建一个血量和提示变化用的对象池 ObjectPool.Instance.InitComponentPools <BattleHeroHub>(Name + "_Hub", HeroHubPrefab, 1); //注册这个英雄的UI信息 if (IsPlayerHero) { BattleController.Instance.CurrentBattleUI.RegisterPlayerHero(this); } else { BattleController.Instance.CurrentBattleUI.RegisterEnemyHero(this); } //向SkillController注册技能 _Skills = new Dictionary <Global.SkillType, BaseSkill>(); for (int i = 0; i < _Hero.Skills.Count; i++) { BaseSkill skill = SkillController.Instance.CreateSkillTo(_Hero.Skills[i], this); if (skill != null) { _Skills.Add(_Hero.Skills[i].SkillType, skill); } } }
/// <summary> /// 编辑器使用的构造函数 /// </summary> /// <param name="ID">ID</param> /// <param name="Level">等级</param> public Skill(string ID, int Level) { this.ID = ID; this.Level = Level; this.Name = "新技能"; this.Ico = ""; this.SkillType = Global.SkillType.Physic; this.SkillMono = "BaseSkill"; this.SkillEndDelay = 0f; this.IsPassiveSkill = false; this.SkillEffectPaths = new List <string>(); this.ActiveState = Global.BuffActiveState.Actioning; this.TargetType = Global.SkillTargetType.None; this.CostHeroProperty = new HeroProperty(); this.DelayTurn = 0; this.CauseHeroProperty = new HeroProperty(); this.HurtHeroProperty = new HeroProperty(); this.CriticalChance = 0; this.SkillBuff = new List <Buff>(); this.Description = "技能描述"; }