Esempio n. 1
0
        public void LoadOwnedShips(bool displayPriceTag)
        {
            PlayerStatusData playerData = PlayerStatusService.LoadPlayerStatus();

            GameObject[] ships        = GetAllShipsFromPrefabList();
            GameObject[] filteredList = ships.Where(x =>
                                                    playerData.GetOwnedShipsIDs().Contains(x.GetComponent <Ship>().shipId)).ToArray();
            PlotShipsIntoCarousel(filteredList, displayPriceTag);
        }
Esempio n. 2
0
        void DisableOwnedShips()
        {
            PlayerStatusData playerData = PlayerStatusService.LoadPlayerStatus();

            foreach (var shipInstance in shipsInstance)
            {
                //if player has already bought this ship, disable its button
                if (playerData.GetOwnedShipsIDs().Contains(shipInstance.GetComponent <Ship>().shipId))
                {
                    DisableShipButtonClick(shipInstance);
                }
            }
        }
Esempio n. 3
0
        public void HideNotOwnedShips()
        {
            PlayerStatusData playerData    = PlayerStatusService.LoadPlayerStatus();
            List <int>       ownedShipsIDs = playerData.GetOwnedShipsIDs();

            foreach (var shipInstance in shipsInstance)
            {
                //if player doesn't have a ship, remove it from the interface
                if (!ownedShipsIDs.Contains(shipInstance.GetComponent <Ship>().shipId))
                {
                    shipInstance.SetActive(false);
                }
            }
        }
        void DisableOwnedShips(Ship[] instantiatedShips)
        {
            //player data in ShipCarousel instance has not been loaded yet, so we'll have to do it manually
            PlayerStatusData playerData = PlayerStatusService.LoadPlayerStatus();

            foreach (var shipInstance in instantiatedShips)
            {
                //if player has already bought this ship, disable its button
                if (playerData.GetOwnedShipsIDs().Contains(shipInstance.GetId()))
                {
                    shipInstance.DisableCharacterButton();
                }
            }
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
 public Func <bool> HasReachedItemMax()
 {
     return(() => !playerData.GetOwnedShipsIDs().Contains(this.shipId));
 }
Esempio n. 7
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);
        }