Exemplo n.º 1
0
        static PlayerStatusData CreateInitialPlayerStatus(ApplicationDataReader <PlayerStatusData> appDataReader)
        {
            PlayerStatusData playerData = new PlayerStatusData(0, 1, 1);

            //player always owns the first ship by default
            playerData.GetOwnedShipsIDs().Add(1);

            playerData.IncreaseDashUpgrade();

            appDataReader.SaveDataAsync(playerData, playerDataFilePath);
            SavePlayerStatus(playerData);

            return(playerData);
        }
Exemplo n.º 2
0
        bool GetPrizeObject(int prizeNum, bool bestPrize)
        {
            bool             hasPrize   = false;
            PlayerStatusData playerData = PlayerStatusService.LoadPlayerStatus();

            switch (prizeNum)
            {
            case 1:     //Life Buff
                GetLifePrize(bestPrize, playerData, prizeNum);
                hasPrize = true;
                break;

            case 2:     //Extra Credits XXX
                resultPanelPrizeImg.sprite = spritesForResult[prizeNum];
                if (bestPrize)
                {
                    resultMsgTxt.text = string.Format("+300 {0}", creditsItem);

                    playerData.IncreaseScore(300);
                }
                else
                {
                    resultMsgTxt.text = string.Format("+50 {0}", creditsItem);

                    playerData.IncreaseScore(50);
                }
                hasPrize = true;
                break;

            case 3:      //Dash Upgrade
                if (bestPrize && playerData.CanUpgradeDash())
                {
                    playerData.IncreaseDashUpgrade();
                    resultMsgTxt.text          = dashUpgradeItem;
                    resultPanelPrizeImg.sprite = spritesForResult[prizeNum];
                    hasPrize = true;
                }
                else
                {
                    resultMsgTxt.text = twoPointsDashWarningJackPot;
                }
                break;

            case 4:     //New Skin
                if (bestPrize)
                {
                    resultMsgTxt.text          = skinItem;
                    resultPanelPrizeImg.sprite = skinPrize;
                    playerData.GetOwnedShipsIDs().Add(skinPrizeId);
                    hasPrize = true;
                }
                else
                {
                    resultMsgTxt.text = twoPointsSkinsWarningJackPot;
                }
                break;
            }
            PlayerStatusService.SavePlayerStatus(playerData);

            return(hasPrize);
        }