public ImmutableDataSkill GetSkillUnlockAtNextLevel() { int nextLevel = LevelLogic.Instance.NextLevel; ImmutableDataSkill selectedSkill = null; foreach (ImmutableDataSkill skill in allSkills) { if (skill.UnlockLevel == nextLevel) { selectedSkill = skill; } } return(selectedSkill); }
protected override void XMLNodeHandler(string id, IXMLNode xmlNode, Hashtable hashData, string errorMessage) { ImmutableDataSkill data = new ImmutableDataSkill(id, xmlNode, errorMessage); // store the data if (hashData.ContainsKey(id)) { Debug.LogError(errorMessage + "Duplicate keys!"); } else { hashData.Add(id, data); } }
/// <summary> /// Finishes the fire blow. Blow out animation /// </summary> public void FinishFireBlow() { animator.SetTrigger("FireBlowOut"); animator.SetBool("IsFireBlowIn", false); // spawn the particle effect ImmutableDataSkill curSkill = DataLoaderSkills.GetFlameAtLevel((int)LevelLogic.Instance.CurrentLevel); string flameResourceString = curSkill.FlameResource; GameObject flamePrefab = Resources.Load(flameResourceString) as GameObject; GameObject flameObject = Instantiate(flamePrefab, new Vector3(0, 0, 0), flamePrefab.transform.rotation) as GameObject; // parent it to the right position flameObject.transform.parent = fireBlowPosition.transform; flameObject.transform.localPosition = new Vector3(0, 0, 0); // actually kick off the effect fireScript = flameObject.GetComponent <FireBlowParticleController>(); fireScript.Play(); }
/// <summary> /// Listen to pet level up and Checks the flame level up. /// </summary> private void CheckFlameLevelUp(object sender, EventArgs args) { if (allSkills == null) { allSkills = SortList(DataLoaderSkills.GetDataList()); } int currentLevel = (int)LevelLogic.Instance.CurrentLevel; ImmutableDataSkill skillData = DataLoaderSkills.NewFlameOnLevelUp(currentLevel); if (skillData != null) { if (OnFlameLevelUp != null) { FlameLevelEventArgs flameArgs = new FlameLevelEventArgs(skillData); OnFlameLevelUp(this, flameArgs); } } }
public static ImmutableDataSkill GetFlameAtLevel(int level) { ImmutableDataSkill highestSkillUnlockedSoFar = null; foreach (ImmutableDataSkill skillData in GetDataList()) { if (skillData.UnlockLevel <= level) { if (highestSkillUnlockedSoFar != null) { if (highestSkillUnlockedSoFar.UnlockLevel <= skillData.UnlockLevel) { highestSkillUnlockedSoFar = skillData; // Overwrite highest so far } } else { highestSkillUnlockedSoFar = skillData; // Assign initial case } } } return(highestSkillUnlockedSoFar); }
//---------------------------------------------- // RefreshUnlockPredictions() // Update the items/badge/flame that will be unlocked for next level //---------------------------------------------- private void RefreshUnlockPredictions(object sender, EventArgs args) { foreach (Transform child in gridUnlockPredictions.transform) { child.gameObject.SetActive(false); Destroy(child.gameObject); } ImmutableDataBadge badge = BadgeManager.Instance.GetBadgeUnlockAtNextLevel(); if (badge != null) { GameObject go = GameObjectUtils.AddChildWithPositionAndScale(gridUnlockPredictions, unlockPredictionEntryPrefab); Image sprite = go.GetComponent <Image>(); sprite.sprite = SpriteCacheManager.GetBadgeSprite(badge.TextureName); } ImmutableDataSkill skill = FlameLevelLogic.Instance.GetSkillUnlockAtNextLevel(); if (skill != null) { GameObject go = GameObjectUtils.AddChildWithPositionAndScale(gridUnlockPredictions, unlockPredictionEntryPrefab); Image sprite = go.GetComponent <Image>(); //Place Holder sprite.sprite = SpriteCacheManager.GetSprite(skill.TextureName); } List <Item> items = ItemManager.Instance.GetItemsUnlockAtNextLevel(); foreach (Item item in items) { GameObject go = GameObjectUtils.AddChildWithPositionAndScale(gridUnlockPredictions, unlockPredictionEntryPrefab); Image sprite = go.GetComponent <Image>(); sprite.sprite = SpriteCacheManager.GetSprite(item.TextureName); } }
public FlameLevelEventArgs(ImmutableDataSkill skill) { unlockedSkill = skill; }