예제 #1
0
 public Upgrade(int coinCost, float moneyCost, bool isBoughtByCoin, bool isBoughtByMoney, bool isUnlocked, bool isActive, ObjectsDescription applicableOn,
                SkinCategory upgradeCategory, SkinColors particlesColor, string upgradeName, Dictionary <string, SkinColorStuff> colorStuff)
 {
     CoinCost        = coinCost;
     MoneyCost       = moneyCost;
     IsBoughtByCoin  = isBoughtByCoin;
     IsBoughtByMoney = isBoughtByMoney;
     IsUnlocked      = isUnlocked;
     IsActive        = isActive;
     ApplicableOn    = applicableOn;
     ParticlesColor  = particlesColor;
     UpgradeName     = upgradeName;
     UpgradeCategory = upgradeCategory;
     ColorStuff      = colorStuff;
 }
예제 #2
0
    // real time updation will be done by mainmenuhandler or levelcontroller
    // level needs to be completed for updating the task
    // after level complete levelTask will be completed fully or not at all
    // after level complete gameTask can be completed partially.
    public void UpdateLevelTaskState(ObjectsDescription objectType, TaskTypes taskType, TaskCategory taskCategory, List <string> metaData)
    {
        if (UpdateCameFromLevel() && !IsLevelEligibleToExecuteTask())
        {
            return;
        }

        bool objTypeMatchesFirstTask  = Array.Exists(firstTask.AssociatedWith, element => element == objectType);
        bool objTypeMatchesSecondTask = Array.Exists(secondTask.AssociatedWith, element => element == objectType);

        if (taskCategory == TaskCategory.CountingTask)
        {
            if (objTypeMatchesFirstTask && firstTask.CurrTaskType == taskType && firstTask.CurrTaskCategory == taskCategory)
            {
                if (firstTask.CurrentCount < firstTask.CountLimit)
                {
                    firstTask.CurrentCount += 1;
                }

                if (firstTask.CurrentCount == firstTask.CountLimit)
                {
                    firstTask.IsCompleted = true;
                }
            }

            if (objTypeMatchesSecondTask && secondTask.CurrTaskType == taskType && secondTask.CurrTaskCategory == taskCategory)
            {
                if (secondTask.CurrentCount < secondTask.CountLimit)
                {
                    secondTask.CurrentCount += 1;
                }

                if (secondTask.CurrentCount == secondTask.CountLimit)
                {
                    secondTask.IsCompleted = true;
                }
            }

            if (taskType == TaskTypes.NearMiss)
            {
                Debug.Log("Near miss registered...");
                PlayerStatistics.Level levelData = playerStats.chaptersList[currentChapterIndex].LevelsInChapter[currentLevelIndex];
                levelData.numTimesNearMiss += 1;
                playerStats.chaptersList[currentChapterIndex].LevelsInChapter[currentLevelIndex] = levelData;
            }
        }
        else if (taskCategory == TaskCategory.ImmediateActionTask)
        {
            if (taskType == TaskTypes.CollectAllCoinsInLevel)
            {
                if (objTypeMatchesFirstTask && firstTask.CurrTaskType == taskType && firstTask.CurrTaskCategory == taskCategory)
                {
                    if (int.Parse(metaData[0]) == int.Parse(metaData[1]))
                    {
                        firstTask.IsCompleted = true;
                    }
                }

                if (objTypeMatchesSecondTask && secondTask.CurrTaskType == taskType && secondTask.CurrTaskCategory == taskCategory)
                {
                    if (int.Parse(metaData[0]) == int.Parse(metaData[1]))
                    {
                        secondTask.IsCompleted = true;
                    }
                }
            }
            else if (taskType == TaskTypes.Hover || taskType == TaskTypes.NoHit)
            {
                if (objTypeMatchesFirstTask && firstTask.CurrTaskType == taskType && firstTask.CurrTaskCategory == taskCategory)
                {
                    firstTask.IsCompleted = bool.Parse(metaData[0]);
                }

                if (objTypeMatchesSecondTask && secondTask.CurrTaskType == taskType && secondTask.CurrTaskCategory == taskCategory)
                {
                    secondTask.IsCompleted = bool.Parse(metaData[0]);
                }
            }
            else if (taskType == TaskTypes.NoNearMiss)
            {
                if (objTypeMatchesFirstTask && firstTask.CurrTaskType == taskType && firstTask.CurrTaskCategory == taskCategory)
                {
                    firstTask.IsCompleted = (playerStats.chaptersList[currentChapterIndex].LevelsInChapter[currentLevelIndex].numTimesNearMiss == 0);
                }

                if (objTypeMatchesSecondTask && secondTask.CurrTaskType == taskType && secondTask.CurrTaskCategory == taskCategory)
                {
                    secondTask.IsCompleted = (playerStats.chaptersList[currentChapterIndex].LevelsInChapter[currentLevelIndex].numTimesNearMiss == 0);
                }
            }
            else if (taskType == TaskTypes.UpdateSkin)
            {
                if (objTypeMatchesFirstTask && firstTask.CurrTaskType == taskType && firstTask.CurrTaskCategory == taskCategory)
                {
                    firstTask.IsCompleted = (firstTask.CountLimit <= int.Parse(metaData[0]));
                }

                if (objTypeMatchesSecondTask && secondTask.CurrTaskType == taskType && secondTask.CurrTaskCategory == taskCategory)
                {
                    secondTask.IsCompleted = (secondTask.CountLimit <= int.Parse(metaData[0]));
                }
                FinalizeTasks();
            }
        }
    }