public void PlayEffects(OffensiveAbility oa) { if (obj != null) { Destroy(obj); } endPos = new Vector3(5, 0, 0); switch (oa.AttackElement()) { case ElementType.FIRE: obj = (GameObject)Instantiate(fireball, new Vector3(-3, 0, 0), Quaternion.identity); break; case ElementType.EARTH: obj = (GameObject)Instantiate(earthball, new Vector3(-3, 0, 0), Quaternion.identity); break; case ElementType.WATER: obj = (GameObject)Instantiate(waterball, new Vector3(-3, 0, 0), Quaternion.identity); break; case ElementType.NONE: obj = (GameObject)Instantiate(standardAttack, new Vector3(-3, 0, 0), Quaternion.identity); break; default: obj = null; break; } }
public bool UseAbility(OffensiveAbility ab, List <Enemy> targets) { bool result = false; result = ab.Execute(targets); return(result); }
public void CreateTurnAbilityButtons() { int x = 100; int y = 50; int count = 0; foreach (OffensiveAbility oa in offensiveAbilities) { GameObject button = new GameObject(); OffensiveAbility captured = oa; buttons.Add(button); buttons[count] = (GameObject)Instantiate(buttonPrefab, new Vector3(x, 50 + y * count, 0), Quaternion.identity); buttons[count].GetComponentInChildren <Text> ().text = oa.GetAbilityTag(); buttons[count].GetComponentInChildren <Button> ().onClick.AddListener(() => SetSelectedOffensiveAbility(captured)); buttons[count].transform.SetParent(canvas.transform); count++; } foreach (DefensiveAbility da in defensiveAbilities) { GameObject button = new GameObject(); DefensiveAbility captured = da; buttons.Add(button); buttons[count] = (GameObject)Instantiate(buttonPrefab, new Vector3(x, 50 + y * count, 0), Quaternion.identity); buttons[count].GetComponentInChildren <Text> ().text = da.GetAbilityTag(); buttons[count].GetComponentInChildren <Button> ().onClick.AddListener(() => SetSelectedDefensiveAbility(captured)); buttons[count].transform.SetParent(canvas.transform); count++; } }
public void RemoveOffensiveAbility(OffensiveAbility oa) { foreach (OffensiveAbility i in offensiveAbilities) { if (i.GetAbilityTag() == oa.GetAbilityTag()) { offensiveAbilities.Remove(i); break; } } }
public void AddOffensiveAbility(OffensiveAbility oa) { bool present = false; foreach (OffensiveAbility i in offensiveAbilities) { if (i.GetAbilityTag() == oa.GetAbilityTag()) { present = true; } } if (!present) { offensiveAbilities.Add (oa); Debug.Log ("Ability" + oa.GetAbilityTag () + " added."); } else { Debug.Log ("Ability" + oa.GetAbilityTag () + " already present."); } }
public void AddOffensiveAbility(OffensiveAbility oa) { bool present = false; string log; foreach (OffensiveAbility i in offensiveAbilities) { if (i.GetAbilityTag() == oa.GetAbilityTag()) { present = true; } } if (!present) { offensiveAbilities.Add(oa); log = ("\nAbility " + oa.GetAbilityTag() + " added.\n"); Debug.Log(log); WriteToOutputFile(log); } else { Debug.Log("Ability " + oa.GetAbilityTag() + " already present."); } }
public bool UseAbility(OffensiveAbility ab, List<Enemy> targets) { bool result = false; //PlayEffects (ab); if (targets.Count == 1) { Enemy target = targets [0]; result = ab.Execute (target); } else { result = ab.Execute (targets); } return result; }
public void SetSelectedOffensiveAbility(OffensiveAbility oa) { selectedOffensiveAbility = oa; selectedAbility = oa; }
public void ResetSelectedAbilities() { selectedOffensiveAbility = null; selectedDefensiveAbility = null; selectedAbility = null; }
public void RemoveOffensiveAbility(OffensiveAbility oa) { foreach (OffensiveAbility i in offensiveAbilities) { if (i.GetAbilityTag() == oa.GetAbilityTag()) { offensiveAbilities.Remove (i); break; } } }
public void ResetSelectedAbilities() { selectedOffensiveAbility = null; selectedDefensiveAbility = null; selectedAbility = null; }
public void SetSelectedOffensiveAbility(OffensiveAbility oa) { selectedOffensiveAbility = oa; selectedAbility = oa; }