Beispiel #1
0
    public override void OnInspectorGUI()
    {
        MergeRewardTable mrt = target as MergeRewardTable;

        firstRewardValue = EditorGUILayout.DelayedIntField("Start reward: ", firstRewardValue);
        if (firstRewardValue < 10)
        {
            firstRewardValue = 10;
        }
        tableSize = EditorGUILayout.DelayedIntField("Target table size:", tableSize);
        if (tableSize < 1)
        {
            tableSize = 1;
        }

        // GUILayout.Label("Current price progression:\n");
        if (GUILayout.Button("Calculate rewards"))
        {
            mrt.ResizeRewardTable(tableSize);
            for (int i = 1; i < tableSize; i++)
            {
                int prevReward = mrt.Rewards[i - 1];
                mrt.Rewards[i] = prevReward % 3 == 0 ? 4 * prevReward / 3 : 3 * prevReward / 2;
            }
        }

        DrawDefaultInspector();
    }
Beispiel #2
0
    public void OnEnable()
    {
        MergeRewardTable mrt = target as MergeRewardTable;

        firstRewardValue = mrt.Rewards[0];
        tableSize        = mrt.Rewards.Length;
    }
Beispiel #3
0
 public void IncreaseScore(int rewardRank)
 {
     if (rewardTable == null)
     {
         rewardTable = Resources.Load("Reward Table") as MergeRewardTable;
     }
     rewardRank = Mathf.Clamp(rewardRank - 1, 0, rewardTable.Rewards.Length - 1);
     ChangeScore(rewardTable.Rewards[rewardRank]);
 }