Пример #1
0
    public LevelingController(int startingLevel, float startingXP)
    {
        this.level = startingLevel;
        this.xp    = startingXP;

        this.levelUpCallback = new LevelUpEvent();
    }
Пример #2
0
    /// <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);
    }
Пример #3
0
            public static LevelUpEvent CreateFromXml(System.Xml.XmlElement n)
            {
                LevelUpEvent e = new LevelUpEvent();

                e.val = n.GetAttribute("value");

                return(e);
            }
Пример #4
0
        public void IncreaseExperience(int experience)
        {
            int reExp = Experience + experience;

            Experience = reExp < _MaxExperience ? reExp : _MaxExperience;
            while (Experience > GetLevelExperience(Level))
            {
                Level++;
                LevelUpEvent?.Invoke(this, Level);
            }
        }
Пример #5
0
    /// <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);
        }
    }
Пример #6
0
 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");
     }
 }
Пример #7
0
    // 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;
    }
Пример #8
0
 internal void Publish(LevelUpEvent levelUpEvent)
 {
     throw new NotImplementedException();
 }
Пример #9
0
 private void OnDisable()
 {
     OnExperienceIncreaseOverTime -= AddExperienceOverTime;
     OnExperienceIncreaseInstant  -= AddExperienceInstant;
     OnLevelUp -= LevelUp;
 }
Пример #10
0
 private void Awake()
 {
     OnExperienceIncreaseOverTime += AddExperienceOverTime;
     OnExperienceIncreaseInstant  += AddExperienceInstant;
     OnLevelUp += LevelUp;
 }
Пример #11
0
            public static LevelUpEvent CreateFromXml( System.Xml.XmlElement n)
            {
                LevelUpEvent e = new LevelUpEvent();

                e.val = n.GetAttribute("value");

                return e;
            }
Пример #12
0
 private void OnLevelUpEvent(LevelUpEvent data)
 {
     this.Open();
 }
Пример #13
0
 private void OnPlayerLevelUp(LevelUpEvent data)
 {
     this.CollectReward(false);
 }