wangguan
2020-11-23 e70a047e1d3a3b476212d49714264cf6871cd9fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using UnityEngine;
 
namespace TowerDefense.Economy
{
    /// <summary>
    /// A struct for holding currency change data
    /// </summary>
    public struct CurrencyChangeInfo
    {
        /// <summary>
        /// The previous value of the currency
        /// </summary>
        public readonly int previousCurrency;
 
        /// <summary>
        /// The new value of the currency
        /// </summary>
        public readonly int currentCurrency;
 
        /// <summary>
        /// The difference in amount
        /// </summary>
        public readonly int difference;
 
        /// <summary>
        /// Gets the absolute difference in amount
        /// </summary>
        public readonly int absoluteDifference;
 
        /// <summary>
        /// Initializes the CurrencyChangeInfo
        /// </summary>
        /// <param name="previous">
        /// The previous value of the currency
        /// </param>
        /// <param name="current">
        /// The current value of the currency
        /// </param>
        public CurrencyChangeInfo(int previous, int current)
        {
            previousCurrency = previous;
            currentCurrency = current;
            difference = currentCurrency - previousCurrency;
            absoluteDifference = Mathf.Abs(difference);
        }
    }
}