public void PrepareAttack() { _enemyIntention.gameObject.SetActive(true); int tempAtkIndex = _atkIndex + 1; if (tempAtkIndex >= _attacks.Count) { tempAtkIndex = 0; } CurrentAttack = _attacks[tempAtkIndex]; //If this attack is out of range we should just move towards the player instead if (CurrentAttack.IsAttackInRange()) { _atkIndex = tempAtkIndex; } else { DesiredRange = CurrentAttack.Range; CurrentAttack = _moveInRange; } //Display how much damage/what type of attack it's going to deal //Text enemyText = GameObject.Find("EnemyText").GetComponent<Text>(); _enemyIntention.Text = "The enemy prepares to " + CurrentAttack.PrepareAttack(); BattleManager.Instance.PushAttack(CurrentAttack); }
//Wrapper method to determine how to filter champions given generic input public static List <Champion> FilterChampions(string input, string questionSymbol, List <Champion> champions) { if (input == "NoPref") { return(champions); } if (questionSymbol == LaneQuestion) { Lane.TryParse(input, out Lane lane); return(FilterChampionsByCriteria(lane, champions)); } if (questionSymbol == RoleQuestion) { AttackRange.TryParse(input, out AttackRange role); return(FilterChampionsByCriteria(role, champions)); } if (questionSymbol == DamageQuestion) { DamageType.TryParse(input, out DamageType dmg); return(FilterChampionsByCriteria(dmg, champions)); } if (questionSymbol == NewnessQuestion) { IsNew.TryParse(input, out IsNew n); return(FilterChampionsByCriteria(n, champions)); } return(champions); }
List <GameObject> GetEnemyInAttackRange(AttackRange range) { List <GameObject> mList = new List <GameObject>(); if (range == AttackRange.Forward) //得到主角前方的敌人 { foreach (GameObject enemy in TranscriptManager.instance.GetEnemyList()) { Vector3 pos = transform.InverseTransformPoint(enemy.transform.position); //将敌人坐标转换成主角的局部坐标 if (pos.z >= -0.5f) //前方的敌人 { float distance = Vector3.Distance(Vector3.zero, pos); //计算主角和敌人的距离 if (distance < forwardDistance) { mList.Add(enemy); } } } } else //得到主角攻击范围的敌人 { foreach (GameObject enemy in TranscriptManager.instance.GetEnemyList()) { Vector3 pos = transform.InverseTransformPoint(enemy.transform.position); //将敌人坐标转换成主角的局部坐标 float distance = Vector3.Distance(Vector3.zero, pos); //计算主角和敌人的距离 if (distance < aroundDistance) { mList.Add(enemy); } } } return(mList); }
public override IValue Serialize() => new Bencodex.Types.Dictionary(new Dictionary <IKey, IValue> { [(Text)"set_id"] = (Integer)SetId, [(Text)"stat"] = Stat.Serialize(), [(Text)"attack_range"] = AttackRange.Serialize(), [(Text)"spine_resource_path"] = (Text)SpineResourcePath, }.Union((Bencodex.Types.Dictionary)base.Serialize()));
ArrayList GetEnemyInAttackRanage(AttackRange attackRange) { ArrayList arrList = new ArrayList(); if (attackRange == AttackRange.Forward) { foreach (GameObject go in TranscriptManager._instance.GetEnemyList()) { Vector3 pos = transform.InverseTransformPoint(go.transform.position); if (pos.z > 0) { float distance = Vector3.Distance(Vector3.zero, pos); if (distance < distanceAttackForward) { arrList.Add(go); } } } } else { foreach (GameObject go in TranscriptManager._instance.GetEnemyList()) { float distance = Vector3.Distance(transform.position, go.transform.position); if (distance < distanceAttackAround) { arrList.Add(go); } } } return(arrList); }
void Awake() { character = GetComponent <GameCharacter>(); rb = GetComponent <Rigidbody2D>(); forwardPoint = transform.Find("ForwardPoint"); sightRange = transform.Find("SightRange").GetComponent <SightRange>(); attackRange = transform.Find("AttackRange").GetComponent <AttackRange>(); }
protected virtual void Awake() { myAttackRange = FindObjectOfType <AttackRange>().GetComponent <AttackRange>(); myAnimator = GetComponent <tk2dSpriteAnimator>(); projectileParent = GameObject.Find("ProjectilePool").GetComponent <Transform>(); upgradeLevel = 1; upgrade = new UnitUpgrade(firstUpgradePrice, 1); }
private Page CreateOpDetailPage(OpDetail op, int index) { Elite e = op.Elites[index]; DiscordEmbedBuilder embed = new DiscordEmbedBuilder() .WithTitle($"[{op.Rarity}★] {op.Name}") .AddField($"Level 1 → {e.MaxLevel}", $"{Formatter.Bold("Health:")} {e.Hp} → {e.MaxHp}\n" + $"{Formatter.Bold("Attack:")} {e.Atk} → {e.MaxAtk}\n" + $"{Formatter.Bold("Defense:")} {e.Def} → {e.MaxDef}\n" + $"{Formatter.Bold("Resistance:")} {e.MagicResistance}", true) .AddField("\u200b", $"{Formatter.Bold("Cost:")}{e.Cost}\n" + $"{Formatter.Bold("Block:")} {e.BlockCnt}\n" + $"{Formatter.Bold("Attack Time:")} 100\n" + $"{Formatter.Bold("Respawn Time:")} {e.RespawnTime}\n", true) .AddField("Range", AttackRange.GetAttackRange(op.Elites[index].RangeId), true); string img = string.Empty; switch (index) { case 1: { if (op.OperatorCode.Equals("Amiya")) { embed.WithThumbnail($"{s3.Url}avatars/{op.OperatorCode}_1+.png"); } else { embed.WithThumbnail($"{s3.Url}avatars/{op.OperatorCode}.png"); } break; } case 2: { embed.WithThumbnail($"{s3.Url}avatars/{op.OperatorCode}_2.png"); break; } } if (op.Talents != null && op.Talents.Count > 0) { string talent = string.Empty; foreach (Talent t in op.Talents) { if (t.Phase == index) { talent += $"{Formatter.Bold(t.Name + ':')} {t.Description} (Lvl.1,Potential {t.RequirePotential})\n"; } } if (!string.IsNullOrEmpty(talent)) { talent = talent.Substring(0, talent.Count() - 1); embed.AddField("Talents", talent); } } return(new Page { Embed = embed.Build() }); }
public override void Update(float delta) { var direction = (Target.Position - Enemy.Position).Normalized(); Enemy.MoveAndSlide(direction * 50); if (AttackRange.OverlapsBody(Target)) { StateMachine.ChangeState <EnemyAttackState>(StateTypes.Enemy); } }
private void InitComponents() { InitRigidbody2D(); spriteRender = GetComponent <SpriteRenderer>(); player = FindObjectOfType <Player>(); attackRange = GetComponentInChildren <AttackRange>(); hitArea = GetComponentInChildren <HitArea>(); fallingCondition = GetComponentInChildren <FallingCondition>(); }
public override string ReturnUnitInfo() { string result = unitName + "\nHP: " + FindDisplayHP().ToString() + "\nCan Capture: " + canCapture.ToString() + "\nMove type: " + MovementType.ToString() + "\nRange: " + minRange.ToString() + "-" + AttackRange.ToString() + "\nMovement range: " + TotalMovementPoints.ToString() + "\n" + description; return(result); }
public override void Update(float delta) { if (!AttackRange.OverlapsBody(Target)) { StateMachine.ChangeState <EnemyChaseState>(StateTypes.Enemy); } if (Enemy.AttackRate.IsStopped()) { Enemy.Attack(Target); Enemy.AttackRate.Start(); } }
private static List <Champion> FilterChampionsByCriteria(AttackRange range, List <Champion> champions) { List <Champion> options = new List <Champion>(); foreach (Champion champ in champions) { if (champ.Range == range) { options.Add(champ); } } return(options); }
public Weapon(string name, string id, int singleRange, int flatDamage, Dice baseDamage, Dice additionalDamage, int shotsPerBurst, AttackRange classification, DamageTypes damageType, WeaponSkillType weaponType, bool pen) { this.Name = name; this.ID = id; this.Range = singleRange; this.FlatDamage = flatDamage; this.BaseDamage = baseDamage; this.AdditionalDamage = additionalDamage; this.ShotsPerBurst = shotsPerBurst; this.Classification = classification; this.DamageType = damageType; this.WeaponType = weaponType; this.Penetrating = pen; }
// Start is called before the first frame update void Start() { rb = transform.GetComponent <Rigidbody2D>(); sr = transform.GetComponent <SpriteRenderer>(); animator = transform.GetComponent <Animator>(); playerTrail = transform.Find("Trail").gameObject; wings = transform.Find("Wings").gameObject; playerDamageable = transform.GetComponent <Damageable>(); playerDamageable.OnHurt += this.OnHurt; playerDamageable.OnDead += this.OnDead; GamePanel._instance.InitHP(playerDamageable.health); attackRange = transform.Find("attackRange").GetComponent <AttackRange>(); bulletPos = transform.Find("bulletPos"); playerDamage = transform.GetComponent <Damage>(); audioSound = transform.GetComponent <AudioSource>(); wingsSR = transform.Find("Wings").GetComponent <SpriteRenderer>(); }
void Start() { players = FindObjectsOfType <Player>(); Collider2D player = FindObjectOfType <Player>().GetComponent <Collider2D>(); Physics2D.IgnoreCollision(player, GetComponent <Collider2D>()); Enemy[] enemies = FindObjectsOfType <Enemy>(); foreach (var item in enemies) { Physics2D.IgnoreCollision(GetComponent <Collider2D>(), item.GetComponent <Collider2D>()); } attack = GetComponentInChildren <AttackRange>(); }
/// <summary> /// 判断前面的敌人 得到arrayList /// </summary> /// <returns></returns> public ArrayList GetEnemyFront(AttackRange atcRange) { ArrayList arrayList = new ArrayList(); if (atcRange == AttackRange.Forward)//是向前攻击 { foreach (var g in TranscriptManager.instance.enemyList) { Vector3 pos = transform.InverseTransformPoint(g.transform.position); //把怪物的坐标转化为人物的局部坐标 if (pos.z > -0.5f) //正向前方 { float distance = Vector3.Distance(Vector3.zero, pos); //敌人和人物的距离 if (distance < distanceAttackForward) { arrayList.Add(g); //添加的是gamobjct } } } } else if (atcRange == AttackRange.Around) { foreach (var g in TranscriptManager.instance.enemyList) { float distance = Vector3.Distance(transform.position, g.transform.position); //敌人和人物的距离 if (distance < distanceAttackAround) { arrayList.Add(g); } } } else { foreach (var g in TranscriptManager.instance.enemyList) { float distance = Vector3.Distance(transform.position, g.transform.position); //敌人和人物的距离 if (distance < distanceAttackNear) { arrayList.Add(g); } } } return(arrayList); }
private void Start() { stat = FindObjectOfType <StatWithElement>(); a = GetComponent <Animator>(); r = GetComponent <Rigidbody2D>(); attack = GetComponentInChildren <AttackRange>(); particle = FindObjectOfType <ParticleSystem>(); particle.gameObject.SetActive(false); menu = FindObjectOfType <UI.GameMenu>(); AudioClips.Add("jump", Resources.Load <AudioClip>("Sounds/Jump")); AudioClips.Add("attack", Resources.Load <AudioClip>("Sounds/Sword_Swing")); AudioClips.Add("taken", Resources.Load <AudioClip>("Sounds/Take_Hit")); AudioClips.Add("dash", Resources.Load <AudioClip>("Sounds/Sword_Swing")); AudioClips.Add("absorb", Resources.Load <AudioClip>("Sounds/Powerups")); }
private void OnTriggerStay2D(Collider2D collision) { AttackRange attckRange = collision.gameObject.GetComponent <AttackRange>(); if (attckRange != null && candamage == true) { UnitStatus ustatus = collision.gameObject.GetComponent <UnitStatus>(); if (ustatus.unitCheck != unitStatus.unitCheck) { candamage = false; ustatus.AddDamage(unitStatus.unitPower); StartCoroutine("Span"); } } UnitStatus status = GetComponent <UnitStatus>(); if (status != null) { if (collision.gameObject.tag == "Base" && candamage == true && status.unitCheck == false) { candamage = false; BaseStatus baseStatus = collision.gameObject.GetComponent <BaseStatus>(); if (baseStatus != null) { baseStatus.damage(unitStatus.unitPower); StartCoroutine("Span"); } } /* * else if (collision.gameObject.name == "EnemyBase" && candamage == true && status.unitCheck == true) * { * candamage = false; * BaseStatus baseStatus = collision.gameObject.GetComponent<BaseStatus>(); * baseStatus.damage(unitStatus.unitPower); * StartCoroutine("Span"); * } */ } }
public List <GameObject> GetEnermyInRange(AttackRange range, float attackDistance) { //1.获取在攻击范围内的敌人 List <GameObject> enermyInRangeList = new List <GameObject>(); List <GameObject> enermyList = TranscriptManager.Instance.GetEnermyList(); foreach (GameObject go in enermyList) { //计算每个敌人与玩家的距离,判断是否在攻击范围 Vector3 pos = transform.InverseTransformPoint(go.transform.position); if (pos.z > 0) //敌人在玩家前方 { float distance = Vector3.Distance(Vector3.zero, pos); if (distance <= attackDistance) { enermyInRangeList.Add(go); } } } return(enermyInRangeList); }
//得到在攻击范围内的敌人 ArrayList GetEnemyInRange(AttackRange attackRange) { ArrayList arrayList = new ArrayList(); if (attackRange == AttackRange.Forward) { foreach (GameObject go in TranscriptManager._Instance.enemyList) { //将敌人的坐标转化为玩家的相对坐标 Vector3 pos = transform.InverseTransformPoint(go.transform.position); if (pos.z > -0.5f) { //敌人和主角的距离 float distance = Vector3.Distance(Vector3.zero, pos); if (distance < attackDistanceForward) { arrayList.Add(go); } } } } else if (attackRange == AttackRange.Around) { foreach (GameObject go in TranscriptManager._Instance.enemyList) { //将敌人的坐标转化为玩家的相对坐标 Vector3 pos = transform.InverseTransformPoint(go.transform.position); //敌人和主角的距离 float distance = Vector3.Distance(Vector3.zero, pos); if (distance < attackDistanceForward) { arrayList.Add(go); } } } return(arrayList); }
/// <summary> /// 得到攻击范围内的敌人 /// </summary> /// <returns></returns> List <GameObject> GetEnemyInAttackRange(AttackRange attackRange) { List <GameObject> enemy = new List <GameObject>(); switch (attackRange) {//查找前方的敌人 case AttackRange.Forward: foreach (var item in TranscriptController.Instance.enemyList) { Vector3 pos = transform.InverseTransformPoint(item.transform.position); if (pos.z > -0.5f && Vector3.Distance(item.transform.position, transform.position) <= attackDistanceForward) { enemy.Add(item); } } break; //查找周围的敌人 case AttackRange.Around: foreach (var item in TranscriptController.Instance.enemyList) { if (Vector3.Distance(item.transform.position, transform.position) <= attackDistanceAround) { enemy.Add(item); } } break; default: break; } return(enemy); }
//得到攻击范围内的敌人 ArrayList getEnemyInAttckRange(AttackRange attackRange) { ArrayList arrayList = new ArrayList(); if (attackRange == AttackRange.Forward) { foreach (GameObject go in TranscriptManager._instance.enemyList) { //将世界坐标转化为局部坐标 if (go != null && go.GetComponent <Enemy>().HP > 0) { Vector3 pos = transform.InverseTransformPoint(go.transform.position); if (pos.z > -0.5f) { float distance = Vector3.Distance(Vector3.zero, pos); if (distance < forwarAttackDis) { arrayList.Add(go); } } } } } else { foreach (GameObject go in TranscriptManager._instance.enemyList) { if (go != null && go.GetComponent <Enemy>().HP > 0) { float distance = Vector3.Distance(transform.position, go.transform.position); if (distance < aroundAttackDis) { arrayList.Add(go); } } } } return(arrayList); }
private void comboWeaponChanged(object sender, EventArgs e) { if (this.comboWeapon.SelectedItem == null) { return; } AttackRange classification = ((Weapon)this.comboWeapon.SelectedItem).Classification; switch (classification) { case (AttackRange.Melee): this.comboAttackingMethod.DataSource = this.cWCMelee; break; case (AttackRange.ShortRange): this.comboAttackingMethod.DataSource = this.cWCSR; break; case (AttackRange.LongRange): this.comboAttackingMethod.DataSource = this.cWCLR; break; } }
protected virtual void InitializUnitStats(BaseStats baseStats) { Health = new Health(baseStats.BaseHealth); AttackDamage = new AttackDamage(baseStats.BaseAttackDamage); AbilityPower = new AbilityPower(); Armor = new Resistance(baseStats.BaseArmor); MagicResistance = new Resistance(baseStats.BaseMagicResistance); AttackSpeed = new AttackSpeed(baseStats.BaseAttackSpeed); CooldownReduction = new CooldownReduction(); CriticalStrikeChance = new CriticalStrikeChance(); MovementSpeed = new MovementSpeed(baseStats.BaseMovementSpeed); HealthRegeneration = new ResourceRegeneration(); Lethality = new Lethality(); ArmorPenetrationPercent = new ResistancePenetrationPercent(); MagicPenetrationFlat = new ResistancePenetrationFlat(); MagicPenetrationPercent = new ResistancePenetrationPercent(); LifeSteal = new PercentBonusOnlyStat(); SpellVamp = new PercentBonusOnlyStat(); AttackRange = new AttackRange(baseStats.BaseAttackRange); Tenacity = new Tenacity(); CriticalStrikeDamage = new CriticalStrikeDamage(); CriticalStrikeDamageReduction = new PercentBonusOnlyStat(); PhysicalDamageModifier = new DamageModifier(); MagicDamageModifier = new DamageModifier(); PhysicalDamageReceivedModifier = new DamageModifier(); MagicDamageReceivedModifier = new DamageModifier(); HealAndShieldPower = new PercentBonusOnlyStat(); SlowResistance = new SlowResistance(); GrievousWounds = new GrievousWounds(); ExtraAdjustments(); }
public void InitSettingData(int p_id, E_Camp p_camp) { ActorTableID = p_id; MyCamp = p_camp; m_ActorData = ActorTableData.GetI.GetActorTableData(ActorTableID); this.gameObject.layer = CalcManager.GetCampTypeTOLayerIndex(this); //m_AnimationCallFN.Clear(); //m_AnimationCallFN.Add(E_AniCallType.Attack01, Attack1); //m_AnimationCallFN.Add(E_AniCallType.Attack01, Attack1); m_AnimationCallFNArray = new Action <E_AniCallType> [(int)E_AniCallType.Max]; m_AnimationCallFNArray[(int)E_AniCallType.Attack01] = Attack1; m_AnimationCallFNArray[(int)E_AniCallType.Attack02] = Attack1; m_LinkAnimator = GetComponentInChildren <Animator>(); AttackRange.InitCollisionDetating(this, AttackCollistionEnter); SerchingRange.InitCollisionDetating(this, SerchingCollsionEnter); ActorAniEventCom.SetAnimationCallBackFN(ActorAttackEventCallFN, ActorAttackAniEventCallFN); // 공격 정보 얻기 AttackDataArray.Clear(); AttackData tempattackdata = AttackTableData.GetI.GetAttackDataID(1000); AttackDataArray.Add(tempattackdata); SetDataSetting(); m_ISInit = true; }
private void Awake() { sight = transform.Find("Sight").GetComponent <Sight>(); attackRange = transform.Find("AttackRange").GetComponent <AttackRange>(); effectManager = GetComponentInChildren <EffectManager>(); }
public List <Page> CreateOpDetailPages(OpDetail op, DiscordClient client) { List <DiscordEmoji> emojis = new List <DiscordEmoji> { DiscordEmoji.FromGuildEmote(client, 840489819812921384), DiscordEmoji.FromGuildEmote(client, 840489819481440267), DiscordEmoji.FromGuildEmote(client, 840489819594555414), DiscordEmoji.FromGuildEmote(client, 840489820177563648), DiscordEmoji.FromGuildEmote(client, 840489820924543016) }; int i = 0; string pot = "\u200b"; if (op.Potentials != null && op.Potentials.Any()) { foreach (var p in op.Potentials) { pot += $"{emojis[i]} {p.Desc}\n"; i++; } pot = pot.Substring(0, pot.Length - 1); } Console.WriteLine($"{s3.Url}avatars/{op.OperatorCode}.png"); List <Page> pages = new List <Page>(); DiscordEmbedBuilder embed = new DiscordEmbedBuilder() .WithTitle($"[{op.Rarity}★] {op.Name}") .WithDescription($"{op.ItemUsage}\n{op.ItemDesc}") .WithThumbnail($"{s3.Url}avatars/{op.OperatorCode}.png", 60, 60) .AddField("Detail", $"{Formatter.Bold("Affiliation:")} {TextUtil.ToTitleCase(op.Team)}\n" + $"{Formatter.Bold("Obtain:")} {op.ItemObtainApproach}", true) .AddField("\u200b", $"{Formatter.Bold("Tag:")} {op.TagList}\n" + $"{Formatter.Bold("Position:")} {TextUtil.ToTitleCase(op.Position)}\n" + $"{Formatter.Bold("Class:")} {TextUtil.ToTitleCase(op.Profession)}", true) .AddField("Range", AttackRange.GetAttackRange(op.Elites[0].RangeId), true) .AddField("Effect", op.Description) .AddField($"Level 1 → {op.Elites[0].MaxLevel}", $"{Formatter.Bold("Health:")} {op.Elites[0].Hp} → {op.Elites[0].MaxHp}\n" + $"{Formatter.Bold("Attack:")} {op.Elites[0].Atk} → {op.Elites[0].MaxAtk}\n" + $"{Formatter.Bold("Defense:")} {op.Elites[0].Def} → {op.Elites[0].MaxDef}\n" + $"{Formatter.Bold("Resistance:")} {op.Elites[0].MagicResistance}\n" + $"{Formatter.Bold("Cost:")} {op.Elites[0].Cost}\n" + $"{Formatter.Bold("AttackTime:")} 100\n" + $"{Formatter.Bold("Block:")} {op.Elites[0].BlockCnt}\n" + $"{Formatter.Bold("RespawnTime:")} {op.Elites[0].RespawnTime}\n", true) .AddField("Potentials", pot, true); if (op.Talents != null && op.Talents.Count > 0) { string talent = string.Empty; foreach (Talent t in op.Talents) { if (t.Phase == 0) { talent += $"{Formatter.Bold(t.Name + ':')} {t.Description} (Lv. 1,Potential {t.RequirePotential})\n"; } } if (!string.IsNullOrEmpty(talent)) { talent = talent.Substring(0, talent.Count() - 1); embed.AddField("Talents", talent); } } pages.Add(new Page { Embed = embed.Build() }); if (op.Elites.ElementAtOrDefault(1) != null) { pages.Add(CreateOpDetailPage(op, 1)); } if (op.Elites.ElementAtOrDefault(2) != null) { pages.Add(CreateOpDetailPage(op, 2)); } return(pages); }
//get the enemy in the attack range //the distance of the attack //de dao gongji fanwei zhinei de diren ArrayList GetEnemyInAttackRange(AttackRange attackRange){ ArrayList arrayList = new ArrayList (); if (attackRange == AttackRange.Forward) { foreach(GameObject go in TranscriptManager._instance.enemyList){ Vector3 pos = transform.InverseTransformPoint(go.transform.position); if(pos.z>-0.1f){ float distance = Vector3.Distance(Vector3.zero,pos); if(distance < distanceAttackForward){ arrayList.Add(go); } } } } else { foreach(GameObject go in TranscriptManager._instance.enemyList){ float distance = Vector3.Distance(transform.position, go.transform.position); if(distance < distanceAttackAround){ arrayList.Add(go); } } } return arrayList; }
//Scriptable Objectからのキャラ読み込み(コンストラクタ) public Unitdata(string scobj, int level = -1, int partyid = 0) { CharaData loaddata = ScriptableObject.Instantiate(Resources.Load(string.Format("BattleChara/{0}", scobj)) as CharaData); id = 0; //idcount中に未使用があるかを探索する for (int tempid = 1; tempid < idcount; tempid++) { bool contflag = false; foreach (Unitdata tempunit in BattleVal.unitlist) { if (tempunit.id == tempid) { contflag = true; break; } } if (contflag) { continue; } //ここに到達したという事は、そのtempidは使用されていない id = tempid; } if (id == 0) { id = idcount + 1; idcount++; } charaname = loaddata.charaname; jobname = loaddata.jobname; attackrange = loaddata.attackrange; status = loaddata.init_status; if (level > 0) { status.level = level; } faceimage = loaddata.faceimage; team = loaddata.init_team; gobj_prefab = loaddata.gobj; gobj = MonoBehaviour.Instantiate(gobj_prefab, new Vector3(), Quaternion.identity); attackeffect = loaddata.attackeffect; zocflag = loaddata.zocflag; zoclevel = loaddata.zoclevel; skillTrees = loaddata.skillTrees; skills = new List <Skill>(); foreach (SkillTree skilltree in loaddata.skillTrees) { if (loaddata.init_status.level >= skilltree.getlevel) { skills.Add(ScriptableObject.Instantiate <Skill>(skilltree.skill)); } } //skills = loaddata.skills; foreach (Skill skill in skills) { skill.use = skill.maxuse; } routin = loaddata.routin; savescobj = scobj; this.partyid = partyid; }
//ロード時のコンストラクタ public Unitdata(UnitSaveData save, bool instantiateflag = true, bool is_unitcheck = false) { CharaData loaddata = ScriptableObject.Instantiate(Resources.Load(string.Format("BattleChara/{0}", save.scobj)) as CharaData); id = 0; //戦闘パートの場合 if (!is_unitcheck) { //idcount中に未使用があるかを探索する for (int tempid = 1; tempid < idcount; tempid++) { bool contflag = false; foreach (Unitdata tempunit in BattleVal.unitlist) { if (tempunit.id == tempid) { contflag = true; break; } } if (contflag) { continue; } //ここに到達したという事は、そのtempidは使用されていない id = tempid; } if (id == 0) { id = idcount + 1; idcount++; } } charaname = loaddata.charaname; jobname = loaddata.jobname; attackrange = loaddata.attackrange; attackeffect = loaddata.attackeffect; status = loaddata.init_status; faceimage = loaddata.faceimage; team = loaddata.init_team; gobj_prefab = loaddata.gobj; if (instantiateflag) { gobj = MonoBehaviour.Instantiate(gobj_prefab, new Vector3(), Quaternion.identity); } zocflag = loaddata.zocflag; zoclevel = loaddata.zoclevel; skillTrees = loaddata.skillTrees; //skills = loaddata.skills; /* * foreach (Skill skill in skills) * skill.use = skill.maxuse; */ routin = loaddata.routin; //初期設定ファイルからの変更を獲得 savescobj = save.scobj; status.level = save.level; x = save.x; y = save.y; hp = save.hp; status.exp = save.exp; skills = new List <Skill>(); foreach (SkillTree skilltree in loaddata.skillTrees) { if (status.level >= skilltree.getlevel) { skills.Add(ScriptableObject.Instantiate <Skill>(skilltree.skill)); } } //スキル使用回数 if (skills.Count > 0) { for (int numskill = 0; numskill < save.skilluses.Count; numskill++) { //スキル名の一致するスキルを探索し、使用回数をロードする。 foreach (Skill skill in skills) { if (skill.skillname == save.skillname[numskill]) { skill.use = save.skilluses[numskill]; break; } } } } movable = save.movable; atackable = save.atackable; partyid = save.partyid; }
private void Start() { champion = GetComponent <Champion>(); attackRange = champion.StatsManager.AttackRange; EnableAutoAttack(); }