Example #1
0
        public void SetStat(STAT_TYPE statType, int amount)
        {
            RemoveStat(statType);
            StatPair newPair = new StatPair(statType, amount);

            AddStatPair(newPair);
        }
Example #2
0
    /// <summary>
    /// For each piece of data in the incoming list, this function will start a curve of visual elements for it.
    /// </summary>
    /// <returns>The curve stats.</returns>
    /// <param name="statsTypeList">Stats type list.</param>
    /// <param name="isFloaty">If set to <c>true</c> is floaty.</param>
    public IEnumerator StartCurveStats(List <StatPair> statsTypeList, bool isFloaty, float animDelay)
    {
        isAnimating = true;
        yield return(new WaitForSeconds(animDelay));

        // One loop for each TYPE of stat (Coin, Stars, etc)
        for (int i = 0; i < statsTypeList.Count; ++i)
        {
            StatPair pair     = statsTypeList[i];
            StatType statType = pair.statType;

            // If it is a floaty text, just increment values instantaneously
            if (isFloaty)
            {
                // this code will instead animate the bar
                StatTick(statType);
            }
            // If not floaty text, play tween sprite animation to HUD
            else
            {
                Vector3 vOrigin = new Vector3(pair.posOrigin.x, pair.posOrigin.y, 0);
                //Debug.Log(pair.value);
                StartCurve(statType, pair.value, vOrigin, pair.soundKey);

                float fModifier = GetSpawnCountModifier(statType);
                yield return(new WaitForSeconds(fModifier * pair.value));
            }

            // Soft check for detecting when anim is done, its so complicated we are just going to estimate here
            if (i == statsTypeList.Count - 1)
            {
                Invoke("CallFinishedAnimation", 0.8f);
            }
        }
    }
Example #3
0
        public int GetStat(STAT_TYPE statType)
        {
            StatPair pair = GetStatPair(statType);

            if (pair == null)
            {
                return(0);
            }
            else
            {
                return(pair.statAmount);
            }
        }
Example #4
0
        public StatList(Stats stats)
        {
            internalList = new List <StatPair>();
            StatPair baseHealthPair    = new StatPair(STAT_TYPE.BASE_HEALTH, stats.baseHealth);
            StatPair currentHealthPair = new StatPair(STAT_TYPE.CURRENT_HEALTH, stats.currentHealth);
            StatPair strengthPair      = new StatPair(STAT_TYPE.STRENGTH, stats.strength);
            StatPair wisdomPair        = new StatPair(STAT_TYPE.WISDOM, stats.wisdom);

            internalList.Add(baseHealthPair);
            internalList.Add(currentHealthPair);
            internalList.Add(strengthPair);
            internalList.Add(wisdomPair);
        }
Example #5
0
 private void AddStatPair(StatPair newPair)
 {
     internalList.Add(newPair);
 }