// Use this for initialization void Start() { isInstant = true; //button.GetComponent<SkillBar>().isInstantSpell = true; hasDefended = false; isWait = true; hasAttacked = false; player = gameObject; telegrams = gameObject.GetComponent <TeleGrams>(); isPressed = false; button.GetComponent <SkillBar>().globalTime = 0; button.GetComponent <SkillBar>().isInstantAbility = true; AbilityCreatorClass abilityCreator = new AbilityCreatorClass(); var classInfo = abilityCreator.GetAbility(ID); Type type = classInfo.GetType(); foreach (var f in type.GetFields().Where(f => f.IsPublic)) { if (f.Name == "duration") { var temp = f.GetValue(classInfo).ToString(); duration = int.Parse(temp); //Debug.Log(duration); break; } } }
private void GetShieldAmount() { AbilityCreatorClass abilityCreator = new AbilityCreatorClass(); var classInfo = abilityCreator.GetAbility(ID); ShieldProtectionAbility shieldProt = (ShieldProtectionAbility)classInfo; shieldProt.GetShieldBuff(); Debug.Log(GameInformation.PlayerShield); }
// Only for inital stuff private void Init() { AbilityCreatorClass abilityCreator = new AbilityCreatorClass(projector); var classInfo = abilityCreator.GetAbility(ID); Type type = classInfo.GetType(); foreach (var f in type.GetFields().Where(f => f.IsPublic)) { if (f.Name == "range") { var temp = f.GetValue(classInfo).ToString(); range = int.Parse(temp); } } }
// To calc the damage everytime void CalcDamage() { AbilityCreatorClass abilityCreator = new AbilityCreatorClass(projector); var classInfo = abilityCreator.GetAbility(ID); Type type = classInfo.GetType(); foreach (var f in type.GetFields().Where(f => f.IsPublic)) { if (f.Name == "baseDamage") { var temp = f.GetValue(classInfo).ToString(); float temp2 = float.Parse(temp); damage = (int)temp2; break; } } }
void SetUpSpellBook() // We might just create and destroy this? hmm { for (int i = whereIDStarts; i < whereIDStarts + spellCount; i++) { AbilityCreatorClass abilityCreator = new AbilityCreatorClass(); // This will create the summonInfo Dynically var classInfo = abilityCreator.GetAbility(i); Type type = classInfo.GetType(); SpellStatsInformation spells = new SpellStatsInformation(); GameObject temp = Instantiate(informationHolder); temp.transform.parent = this.transform; spells.ID = i; foreach (var f in type.GetFields().Where(f => f.IsPublic)) { Debug.Log(f.Name); if (f.Name == "title") { // The main name of the ability spells.title = f.GetValue(classInfo).ToString(); } if (f.Name == "description") { // The description of the ability spells.description = f.GetValue(classInfo).ToString(); Debug.Log(spells.description); } if (f.Name == "type") { // The type of ability spells.type = f.GetValue(classInfo).ToString(); } } temp.GetComponentInChildren <Text>().text = spells.title; temp.GetComponent <SpellBookButtonScript>().description = spells.description; temp.GetComponent <SpellBookButtonScript>().ID = spells.ID; temp.GetComponent <SpellBookButtonScript>().abilityInformation = abilityInfo; } }
public void Init(int ID) { GameObject projector = null; GameObject healProjector = null; AbilityCreatorClass abilityCreator = new AbilityCreatorClass(); // This will create the summonInfo Dynically var classInfo = abilityCreator.GetAbility(ID); Type type = classInfo.GetType(); summonInfo = new SummonInfo(); int damage = 0; int duration = 0; foreach (var f in type.GetFields().Where(f => f.IsPublic)) { if (f.Name == "baseDamage") { var temp = f.GetValue(classInfo).ToString(); damage = int.Parse(temp); } if (f.Name == "range") { var temp = f.GetValue(classInfo).ToString(); range = int.Parse(temp); } if (f.Name == "info") { var temp = f.GetValue(classInfo) as SummonInfo; summonInfo = temp; } if (f.Name == "name") { name = f.GetValue(classInfo).ToString(); } if (f.Name == "attackProjector") { var temp = f.GetValue(classInfo).ToString(); projector = Instantiate(Resources.Load <GameObject>("Projectors/" + temp)); projector.name = temp; } if (f.Name == "healProjector") { var temp = f.GetValue(classInfo) as GameObject; healProjector = temp; } if (f.Name == "duration") { var temp = f.GetValue(classInfo).ToString(); duration = int.Parse(temp); } } GameInformation.SummonsUp++; summonInfo.SummonName = name; summon = Instantiate(Resources.Load <GameObject>("Summons/" + name)); projector.transform.parent = summon.transform; summon.transform.position = new Vector3(circleProjector.transform.position.x, transform.position.y, circleProjector.transform.position.z); projector.transform.position = new Vector3(summon.transform.position.x, projector.transform.position.y + 20f, summon.transform.position.z); //projector.transform.rotation = new Vector3(summon.transform.rotation.x, projector.transform.rotation.y); var rotationVector = summon.transform.rotation.eulerAngles; rotationVector.x = 90f; rotationVector.z = 90f; projector.transform.rotation = Quaternion.Euler(rotationVector); if (projector != null) { summon.GetComponent <SummonsAi>().SetDamageProjector(projector); } if (healProjector != null) { summon.GetComponent <SummonsAi>().SetHealProjector(healProjector); } summon.GetComponent <SummonsAi>().baseDamage = summonInfo.BaseDamage; summon.GetComponent <SummonsAi>().attackRange = range; summon.GetComponent <SummonsAi>().duration = duration; summonInfo.CalculateEnergy(); summonInfo.CalculateHealth(); summonInfo.CalculateCrit(); summonInfo.CalculateDamage(damage); summon.GetComponent <SummonsAi>().SetSummonInfo(summonInfo); Debug.Log(summonInfo.HealAmount); }