public LevelingController(int startingLevel, float startingXP) { this.level = startingLevel; this.xp = startingXP; this.levelUpCallback = new LevelUpEvent(); }
/// <summary> /// This is called every levelup, and even multiple times if gained experience more than level table. /// </summary> /// <param name="times"></param> /// <param name="previouslvl"></param> public void LevelUp(int times, int previouslvl) { LevelUpEvent parsEvent = new LevelUpEvent() { EventInfo = new LevelUpMeta() { Hero = _Self, PreviousLevel = previouslvl, NewLevel = previouslvl + times } }; OnLevelUp(parsEvent); CacheStr += PerLevelStr * times; CacheAgi += PerLevelAgi * times; CacheInt += PerLevelInt * times; int complete = R2I(CacheStr); CacheStr -= complete; AddBaseStr(complete); complete = R2I(CacheAgi); CacheAgi -= complete; AddBaseAgi(complete); complete = R2I(CacheInt); CacheInt -= complete; AddBaseInt(complete); }
public static LevelUpEvent CreateFromXml(System.Xml.XmlElement n) { LevelUpEvent e = new LevelUpEvent(); e.val = n.GetAttribute("value"); return(e); }
public void IncreaseExperience(int experience) { int reExp = Experience + experience; Experience = reExp < _MaxExperience ? reExp : _MaxExperience; while (Experience > GetLevelExperience(Level)) { Level++; LevelUpEvent?.Invoke(this, Level); } }
/// <summary> /// Play the matching sound to a given emoji type. /// </summary> /// <param name="type">The emoji type to play the sound to.</param> /// <exception cref="ArgumentOutOfRangeException"></exception> private void PlayEmojiSound(EmojiType type) { switch (type) { case EmojiType.SUCCESS: if (SuccessEvent != null) { SuccessEvent.Raise(); } break; case EmojiType.ANGRY: if (AngryEvent != null) { AngryEvent.Raise(); } break; case EmojiType.OK: if (OkEvent != null) { OkEvent.Raise(); } break; case EmojiType.NO: if (NoEvent != null) { NoEvent.Raise(); } break; case EmojiType.BUBBLE: break; case EmojiType.LEVELUP: if (LevelUpEvent != null) { LevelUpEvent.Raise(); } break; case EmojiType.TWITTER: break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
private string LevelUpInfo(Character character, LevelUpEvent levelUp) { if (levelUp) { System.Text.StringBuilder infoBuilder = new System.Text.StringBuilder(); infoBuilder.AppendFormat("{0} reached level {1}!\n", character.characterName, levelUp.levelRank); // TODO show stat increases // TODO show powers learned return(infoBuilder.ToString()); } else { return("Error: LevelUp failed"); } }
// float skillDamageIncrease = 1; // Use this for initialization void Awake() { levelUpEvent = new LevelUpEvent(); damageMultipliers = new List <DamageMultiplierStruct>(); //Initializing all base stats baseStats.level = 1; baseStats.currentExperience = 0; baseStats.damage = 3; baseStats.maxHealth = 500; baseStats.armor = 0; baseStats.criticalChance = 0; baseStats.criticalDamageBonus = 1; baseStats.manaPerTap = 1; baseStats.lifeSteal = 0; baseStats.poisonDamage = 0; baseStats.doubleAttackChance = 0; baseStats.specialMonsterMultiplier = 1f; baseStats.experienceMultiplier = 1f; baseStats.materialMultiplier = 1; baseStats.oreRateMultiplier = 1; baseStats.towerStartBonus = 0; //Initialize all bonus stats bonusStats.level = 0; bonusStats.currentExperience = 0; bonusStats.damage = 0; bonusStats.maxHealth = 0; bonusStats.armor = 0; bonusStats.criticalChance = 0; bonusStats.criticalDamageBonus = 0; bonusStats.manaPerTap = 0; bonusStats.lifeSteal = 0; bonusStats.poisonDamage = 0; bonusStats.doubleAttackChance = 0; bonusStats.experienceMultiplier = 0f; bonusStats.specialMonsterMultiplier = 0; bonusStats.materialMultiplier = 0; bonusStats.oreRateMultiplier = 0f; bonusStats.towerStartBonus = 0; }
internal void Publish(LevelUpEvent levelUpEvent) { throw new NotImplementedException(); }
private void OnDisable() { OnExperienceIncreaseOverTime -= AddExperienceOverTime; OnExperienceIncreaseInstant -= AddExperienceInstant; OnLevelUp -= LevelUp; }
private void Awake() { OnExperienceIncreaseOverTime += AddExperienceOverTime; OnExperienceIncreaseInstant += AddExperienceInstant; OnLevelUp += LevelUp; }
public static LevelUpEvent CreateFromXml( System.Xml.XmlElement n) { LevelUpEvent e = new LevelUpEvent(); e.val = n.GetAttribute("value"); return e; }
private void OnLevelUpEvent(LevelUpEvent data) { this.Open(); }
private void OnPlayerLevelUp(LevelUpEvent data) { this.CollectReward(false); }