Exemplo 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);
        }
Exemplo 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);
                }
            }
        }
Exemplo 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();
                }
            }
        }
Exemplo 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);
        }
Exemplo n.º 6
0
 public Func <bool> HasReachedItemMax()
 {
     return(() => !playerData.GetOwnedShipsIDs().Contains(this.shipId));
 }
Exemplo 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);
        }