public void UseSkill(BattleSystem battleSystem, int EnemySlot, Skill_SO skill) { SkillPatternUtil skillPattern = new SkillPatternUtil(); skillPattern.WhichSkillToUse(battleSystem, EnemySlot, skill); //EndOfPlayersTurn(battleSystem); }
public void Skill_Has_Amout() { Skill_SO testSkill = ScriptableObject.CreateInstance <Skill_SO>(); testSkill.skillAmout = 10; Assert.AreEqual(testSkill.skillAmout, 10); }
public void InitSkillItem(Skill_SO _skill) { skill = _skill; toggleActive.SetActive(false); skillIcon.sprite = skill.skillIcon; RefreshSkillItem(); }
/* * [ ][ ][ ][ ][ ] * [ ][ ][X][X][ ] */ public void DoubleSlot(BattleSystem battleSystem, int slotSelected, Skill_SO skill) { for (int i = slotSelected; i <= slotSelected + 1; i++) { AttackEnemyWithSkill(battleSystem, i, skill); } }
public void Skill_Has_Name() { Skill_SO testSkill = ScriptableObject.CreateInstance <Skill_SO>(); testSkill.skillName = "Test"; Assert.AreEqual(testSkill.skillName, "Test"); }
protected virtual void Awake() { skillData = Instantiate(tmp_skillData); animator = GetComponent <Animator>(); stats = GetComponent <LiveStats>(); controller = GetComponent <ControllerBase>(); skillData.cooldown = 0; }
public void Add_Skill_To_Character() { CharacterStats_SO testCharacter = ScriptableObject.CreateInstance <CharacterStats_SO>(); Skill_SO testSkill = ScriptableObject.CreateInstance <Skill_SO>(); testCharacter.SkillList.Add(testSkill); Assert.AreEqual(testCharacter.SkillList.Count, 1); }
public void AttackEnemyWithSkill(BattleSystem battleSystem, int EnemySlot, Skill_SO skill) { if (battleSystem.EnemyPrefabsInBattle[EnemySlot - 1] != null) { CharacterStats Enemy = battleSystem.EnemyPrefabsInBattle[EnemySlot - 1].GetComponent <CharacterStats>(); int damage = GetDamageType(battleSystem, skill) + skill.skillAmout; Enemy.TakeDamage(damage); } }
/// <summary> /// The state of skill /// 1 = unlock /// 0 = can be unlocked /// 1 = still can not be unlocked /// </summary> public int IsUnlocked(Skill_SO skill) { int index; switch (skill.skillType) { case SkillType.MELEE: index = meleeSkills.IndexOf(skill.id); if (index < playerData.meleeSkill.level) { return(1); } if (index == playerData.meleeSkill.level) { return(0); } if (index > playerData.meleeSkill.level) { return(-1); } break; case SkillType.GUN: index = gunSkills.IndexOf(skill.id); if (index < playerData.gunSkill.level) { return(1); } if (index == playerData.gunSkill.level) { return(0); } if (index > playerData.gunSkill.level) { return(-1); } break; case SkillType.BODY: index = bodySkills.IndexOf(skill.id); if (index < playerData.bodySkill.level) { return(1); } if (index == playerData.bodySkill.level) { return(0); } if (index > playerData.bodySkill.level) { return(-1); } break; } return(-1); }
/* * [ ][ ][ ][ ][ ] * [X][X][ ][X][X] */ public void Quad2X2Slot(BattleSystem battleSystem, int slotSelected, Skill_SO skill) { for (int i = slotSelected; i < slotSelected + 5; i++) { if (i != slotSelected + 2) { AttackEnemyWithSkill(battleSystem, i, skill); } } }
/* * [ ][ ][ ][ ][ ] * [X][ ][X][ ][X] */ public void TripleEveryOtherSlot(BattleSystem battleSystem, int slotSelected, Skill_SO skill) { for (int i = slotSelected; i < slotSelected + 5; i++) { if (i == slotSelected || i == slotSelected + 2 || i == slotSelected + 4) { AttackEnemyWithSkill(battleSystem, i, skill); } } }
public void InitSkillEquipped(Skill_SO _skill) { skill = _skill; if (skill != null) { skillIcon.gameObject.SetActive(true); skillIcon.sprite = skill.skillIcon; } else { skillIcon.gameObject.SetActive(false); } }
/// <summary> /// get color of skill icon /// </summary> public Color GetIconColor(Skill_SO skill) { int lockState = IsUnlocked(skill); if (lockState == 1 || lockState == 0) { return(Color.white); } else { return(Color.black); } }
public void InitSkillButton(Skill_SO _skill) { skill = _skill; if (skill == null) { gameObject.SetActive(false); } else { gameObject.SetActive(true); skillIcon.color = SkillManager.Instance.GetIconColor(skill); skillIcon.sprite = skill.skillIcon; reloadBar.fillAmount = 0; } }
/// <summary> /// check if the skill is already equipped /// </summary> public bool IsEquipped(Skill_SO skill) { switch (skill.skillType) { case SkillType.MELEE: return(meleeSkill == skill); case SkillType.GUN: return(gunSkill == skill); case SkillType.BODY: return(bodySkill == skill); } return(false); }
public void UseSkillTest() { GameManger.gameManger.EncounteredEnemyNames.Add(testBattleEnemy1.name); _battleSystem.InstantiateCharactersForBattle(); _battleSystem.startState.PopulatePrefabsInBattle(_battleSystem); _battleSystem.startState.PopulateCharactersInBattle(_battleSystem); Skill_SO testSkill = ScriptableObject.CreateInstance <Skill_SO>(); testSkill.skillAmout = 10; _battleSystem.playerState.UseSkill(_battleSystem, 1, testSkill); Assert.AreEqual(testBattleEnemy1.GetComponent <CharacterStats>().characterDefinition.currentHealth, 0); }
public void SelectSkill(Skill_SO skill) { if (skill == null) { if (currentSelectedSkill == null) { currentSelectedSkill = skillManager.skills[skillManager.meleeSkills[0]]; } } else { currentSelectedSkill = skill; } RefreshSkillList(); skillDesc.InitSkillDesc(); }
/// <summary> /// get bg color of skill icon /// </summary> public Color GetBgColor(Skill_SO skill) { int lockState = IsUnlocked(skill); if (lockState == 1) { switch (skill.skillType) { case SkillType.MELEE: if (skill == meleeSkill) { return(meleeColor); } else { return(meleeOffColor); } case SkillType.GUN: if (skill == gunSkill) { return(gunColor); } else { return(gunOffColor); } case SkillType.BODY: if (skill == bodySkill) { return(bodyColor); } else { return(bodyOffColor); } default: return(offColor); } } else { return(offColor); } }
/// <summary> /// Change skill data equipped /// </summary> public void UnequipSkill(Skill_SO skill) { switch (skill.skillType) { case SkillType.MELEE: meleeSkill = null; break; case SkillType.GUN: gunSkill = null; break; case SkillType.BODY: bodySkill = null; break; } }
/// <summary> /// Unlock skill /// </summary> public void UnlockSkillData(Skill_SO skill) { switch (skill.skillType) { case SkillType.MELEE: playerData.meleeSkill.level++; break; case SkillType.GUN: playerData.gunSkill.level++; break; case SkillType.BODY: playerData.bodySkill.level++; break; } }
public static int GetDamageType(BattleSystem battleSystem, Skill_SO skill) { int PlayerDamage; switch (skill.skillType) { case Skill_SO.SkillType.ATK: PlayerDamage = battleSystem.charactersInBattle.First().GetComponent <CharacterStats>().characterDefinition.currentAttack; break; case Skill_SO.SkillType.SPATK: PlayerDamage = battleSystem.charactersInBattle.First().GetComponent <CharacterStats>().characterDefinition.currentSpecialAttack; break; default: PlayerDamage = 0; break; } return(PlayerDamage); }
public void WhichSkillToUse(BattleSystem battleSystem, int EnemySlot, Skill_SO skill) { switch (skill.skillPattern) { case Skill_SO.SkillPattern.Single: SingleSlot(battleSystem, EnemySlot, skill); break; case Skill_SO.SkillPattern.Double: DoubleSlot(battleSystem, EnemySlot, skill); break; case Skill_SO.SkillPattern.DoubleEveryOther: DoubleEveryOtherSlot(battleSystem, EnemySlot, skill); break; case Skill_SO.SkillPattern.Triple: TripleSlot(battleSystem, EnemySlot, skill); break; case Skill_SO.SkillPattern.TripleEveryOther: TripleEveryOtherSlot(battleSystem, EnemySlot, skill); break; case Skill_SO.SkillPattern.Quad: QuadSlot(battleSystem, EnemySlot, skill); break; case Skill_SO.SkillPattern.Quad2X2Slot: Quad2X2Slot(battleSystem, EnemySlot, skill); break; case Skill_SO.SkillPattern.Penta: PentaSlot(battleSystem, EnemySlot, skill); break; default: break; } }
/* * [ ][ ][ ][ ][ ] * [ ][ ][X][ ][ ] */ public void SingleSlot(BattleSystem battleSystem, int slotSelected, Skill_SO skill) { AttackEnemyWithSkill(battleSystem, slotSelected, skill); }
/* * [ ][ ][ ][ ][ ] * [ ][X][ ][X][ ] */ public void DoubleEveryOtherSlot(BattleSystem battleSystem, int slotSelected, Skill_SO skill) { AttackEnemyWithSkill(battleSystem, slotSelected, skill); AttackEnemyWithSkill(battleSystem, slotSelected + 2, skill); }