public void Refresh(PlayerUpgrade upgrade) { GameObject icon = Instantiate(Resources.Load(upgrade.icon, typeof(GameObject)) as GameObject); this.Upgrade = upgrade; upgradeName.text = upgrade.itemName; upgradeDescription.text = upgrade.description; icon.transform.SetParent(spritePivot); icon.transform.ResetLocal(); Utils.ReplaceSpritesWithUiImages(gameObject, false); spritePivot.transform.localScale = Vector3.one * upgrade.wardrobeScale; spritePivot.transform.Translate(upgrade.wardrobePivotOffset); images = spritePivot.GetComponentsInChildren<Image>(); if (upgrade.Locked) { ShowAsLocked(); } else if (PersistentData.IsHavingUpgrade(upgrade.itemName)) { ShowAsBought(); } }
//업그레이드 파트, 정보 저장하기 public void SavePlayerUpgradeInfo(PlayerUpgrade playerUpgrade) { string key = playerUpgrade.upgradeName; PlayerPrefs.SetInt(key + "_clickLevel", playerUpgrade.clickLevel); PlayerPrefs.SetString(key + "_addDamageUpgrade", playerUpgrade.addDamageUpgrade.ToString()); PlayerPrefs.SetString(key + "_cost", playerUpgrade.currentCost.ToString()); }
public SavedData() { SavedInPath = new Dictionary(); upgrades = new PlayerUpgrade(); SavedInPath.Add(SavedAreaPath, GameManager.StartingLevelPath); SavedInPath.Add(SavedGameName, "New Game"); scans = new Godot.Collections.Array(); }
public void CreateSlot(PlayerUpgrade _upgrade) { if (_upgrade != null) { upgrade = _upgrade; image.enabled = true; image.overrideSprite = _upgrade.sprite; } }
public void OnPlayerUpgradeBought(PlayerUpgrade upgrade) { if (this.Upgrade.baseUpgrade != null && this.Upgrade.baseUpgrade.itemName == upgrade.itemName) { ShowAsUnlocked(); } else if (this.Upgrade.itemName == upgrade.itemName) { ShowAsBought(); } }
//업그레이드 파트, 저장된 업그레이드 정보 가져오기 public void LoadPlayerUpgradeInfo(PlayerUpgrade playerUpgrade) { //저장된 값을 가져오기 위해 key값을 받아온다. string key = playerUpgrade.upgradeName; //사용자 탭 레벨 저장 playerUpgrade.clickLevel = PlayerPrefs.GetInt(key + "_clickLevel", 1); //사용자 탭 최대 공격력 증가량 playerUpgrade.addDamageUpgrade = long.Parse(PlayerPrefs.GetString(key + "_addDamageUpgrade", playerUpgrade.startGoldDamageUpgrade.ToString())); //사용자 탭 최대 공격력 업그레이드 비용 저장 playerUpgrade.currentCost = long.Parse(PlayerPrefs.GetString(key + "_cost", playerUpgrade.startCurrentCost.ToString())); }
public UpgradeEntity(Texture2D texture, PlayerUpgrade upgrade) { addComponent(new Sprite(texture)); addComponent(new SnapToGroundComponent() { }); addComponent(new UpgradeComponent(upgrade)); addComponent(new BoxCollider() { collidesWithLayers = 1 << 1, isTrigger = true }); }
public override void _Ready() { string upgrade = PlayerUpgrade.EnumToStringUpgrades(upgradeName); if (WorldManager.instance.WorldInfoHas(upgrade)) { if (WorldManager.instance.GetWorldInfoData <bool>(upgrade)) { QueueFree(); return; } } GetChild <Area>(0).Connect("body_entered", this, nameof(UpgradeCollected)); GetChild <AnimationPlayer>(2).CurrentAnimation = "Hovering"; }
public void AddUpgrade(PlayerUpgrade playerUpgrade) { if (playerUpgrade == PlayerUpgrade.SpellslignersGloves) { this.Fireball.Cooldown /= 2f; } if (this.UpgradesCollection.ContainsKey(playerUpgrade)) { this.UpgradesCollection[playerUpgrade]++; } else { this.UpgradesCollection.Add(playerUpgrade, 1); } }
private void UpgradeCollected(Node body) { if (body.Name.Equals("Player")) { string upgrade = PlayerUpgrade.EnumToStringUpgrades(upgradeName); if (PlayerController.Instance.upgrades.GetUpgrade(upgrade)) { QueueFree(); return; } PlayerController.Instance.upgrades.SetUpgradeTo(upgrade, true); WorldManager.instance.AddToWorldInfo(upgrade, true); InGameMenu.Instance.GetUpgrade(name, description); QueueFree(); } }
public SavedData(Dictionary playerUpgrades, Dictionary additionalInfo, Godot.Collections.Array scans) { upgrades = new PlayerUpgrade(playerUpgrades); SavedInPath = additionalInfo; this.scans = scans; }
public void ClearSlot() { upgrade = null; image.overrideSprite = null; image.enabled = false; }
public void OnBuyButtonPressed() { bool bought = false; if (lastOutfitSkinSelected != null && BuyItem(lastOutfitSkinSelected)) { AnalyticsManager.OnOutfitSkinBought(lastOutfitSkinSelected.itemName); PersistentData.IsHavingBodySkin(lastOutfitSkinSelected.itemName, true); PostOffice.PostPlayerBodySkinBought(lastOutfitSkinSelected); unlockLabel.text = Strings.Wardrobe.skinUnlocked; bought = true; } else if (lastParachuteSkinSelected != null && BuyItem(lastParachuteSkinSelected)) { AnalyticsManager.OnParachuteSkinBought(lastParachuteSkinSelected.itemName); PersistentData.IsHavingParachuteSkin(lastParachuteSkinSelected.itemName, true); PostOffice.PostPlayerParachuteSkinBought(lastParachuteSkinSelected); unlockLabel.text = Strings.Wardrobe.skinUnlocked; bought = true; } else if (lastHatSkinSelected != null && BuyItem(lastHatSkinSelected)) { AnalyticsManager.OnHatSkinBought(lastHatSkinSelected.itemName); SocialManager.IncrementAchievement(SocialManager.Achievements.hatsUnlocked); PersistentData.IsHavingHatSkin(lastHatSkinSelected.itemName, true); PostOffice.PostPlayerHatSkinBought(lastHatSkinSelected); unlockLabel.text = Strings.Wardrobe.skinUnlocked; bought = true; } else if (lastUpgradeSelected != null && BuyItem(lastUpgradeSelected)) { AnalyticsManager.OnUpgradeBought(lastUpgradeSelected.itemName); PersistentData.IsHavingUpgrade(lastUpgradeSelected.itemName, true); lastUpgradeSelected.OnBought(); PostOffice.PostPlayerUpgradeBought(lastUpgradeSelected); lastUpgradeSelected = null; unlockLabel.text = Strings.Wardrobe.upgradeUnlocked; bought = true; } if (bought) { RefreshButton(true, false); OnEquipButtonPressed(); buyEffect.SetTrigger(buyAnimHash); } else { #if !UNITY_EDITOR && UNITY_ANDROID Android.ShowToast(Strings.Toasts.needMoreGems); #endif } }
void ResetSelection() { lastOutfitSkinSelected = null; lastParachuteSkinSelected = null; lastHatSkinSelected = null; lastUpgradeSelected = null; buyButton.SetActive(false); equipButton.SetActive(false); }
void OnUpgradeSelected(PlayerUpgrade upgrade) { lastOutfitSkinSelected = null; lastParachuteSkinSelected = null; lastHatSkinSelected = null; lastUpgradeSelected = upgrade; priceLabel.text = upgrade.price.ToString(); RefreshButton(PersistentData.IsHavingUpgrade(upgrade.itemName), false); }
void OnParachuteSelected(PlayerParachuteSkin skin) { lastOutfitSkinSelected = null; lastParachuteSkinSelected = skin; lastHatSkinSelected = null; lastUpgradeSelected = null; priceLabel.text = skin.price.ToString(); RefreshButton(PersistentData.IsHavingParachuteSkin(skin.itemName), PersistentData.PlayerParachuteSkin == skin.itemName); dogePreview.SetSkin(skin); }
public void EquipUpgrade(PlayerUpgrade newUpgrade, int slot) { upgrades.Remove(newUpgrade); equippedUpgrades[slot] = newUpgrade; UpgradesChanged?.Invoke(); }
public UpgradeComponent(PlayerUpgrade upgrade) { Upgrade = upgrade; }
public bool HasUpgrade(PlayerUpgrade playerUpgrade) { return(this.UpgradesCollection.ContainsKey(playerUpgrade)); }
public void EquipUpgrade(PlayerUpgrade upgrade, UIEquippedUpgradeSlot slot) { PlayerUpgrades.instance.EquipUpgrade(upgrade, Array.FindIndex(equippedUpgradeSlots, w => w == slot)); }
public static void PostPlayerUpgradeBought(PlayerUpgrade upgrade) { if (playerUpgradeBought != null) { playerUpgradeBought(upgrade); } }
public void AddUpgrade(PlayerUpgrade upgrade) { _upgrades.Add(upgrade); }
public void RemoveUpgrade(PlayerUpgrade upgrade) { _upgrades.Remove(upgrade); }