public static BlobStatsData CreateBlob(BlobType blobType) { BlobStatsData blobStatsData = new BlobStatsData(); blobStatsData.blobType = blobType; blobStatsData.stats.Add(StatName.Speed, new Stat(1.0F, 1.0F, 2.0F, 0, 4)); blobStatsData.stats.Add(StatName.Health, new Stat(1.0F, 1.0F, 2.0F, 0, 4)); blobStatsData.stats.Add(StatName.MaxEnergy, new Stat(20.0F, 20.0F, 40.0F, 0, 4)); blobStatsData.stats.Add(StatName.Sight, new Stat(5.0F, 5.0F, 10.0F, 0, 4)); blobStatsData.stats.Add(StatName.ReactionTime, new Stat(5.0F, 5.0F, 2.0F, 0, 4)); blobStatsData.possibleActions.Add(ActionEnum.None); blobStatsData.possibleActions.Add(ActionEnum.Eat); blobStatsData.edibleTagCombinations.Add(new List <ObjectTag>() { ObjectTag.Edible, ObjectTag.Small, ObjectTag.Plant }); switch (blobType) { case BlobType.Survivor: blobStatsData.possibleActions.Add(ActionEnum.RunAway); break; case BlobType.Fighter: blobStatsData.possibleActions.Add(ActionEnum.MeleeFight); blobStatsData.stats.Add(StatName.Strength, new Stat(1.0F, 1.0F, 2.0F, 0, 4)); break; } return(blobStatsData); }
private void Spawn(BlobStatsData blobStatsData, TeamTag teamTag, Vector3 blobPosition) { //CheckIfEnoughSpawnPoints(blobStatsData.Count, availableSpawnPoints.Count); GameObject blob = BlobInstantiator.GetBlobGameObject(blobStatsData, teamTag); blob.transform.localPosition = blobPosition; ObjectManager.GetInstance().AddObject(blob); }
public void RenderStatSelectionUI(BlobStatsData blobStatsData) { selectedBlobStatsData = blobStatsData; SelectDefaultStatIfNothingIsSelected(); SetSelectedStat((StatName)selectedStat); DeleteOldButtons(); for (int i = 0; i < blobStatsDataKeys.Count; i++) { CreateObjectAt(i); } }
private GameObject CreateBlobSelectButton(int blobStatsDataKey, BlobStatsData blobStatsData) { // Create button GameObject blobBar = GameObjectUtility.InstantiateChild(blobBarAsset, blobContent, true); blobBar.GetComponent <BlobSelectButton>().RenderButton(blobStatsData); // Add events to buttons int associatedBlobId = blobStatsDataKey; blobBar.GetComponent <Button>().onClick.AddListener(() => BlobClicked(associatedBlobId)); // Add button to the dictionary buttons.Add(blobStatsDataKey, blobBar); return(blobBar); }
private static void MakeFirstSave() { _saveData = new SaveData(); _saveData.inventory.AddToInventory(InventoryEnum.Money, 0); _saveData.lastSelectedBlobInUpgradeShop = 0; // TODO must match first blob id BlobStatsData blobStatsData = BlobInstantiator.CreateBlob(BlobType.Survivor); _saveData.blobData.Add(0, blobStatsData); // TODO dict key BlobStatsData blobStatsData2 = BlobInstantiator.CreateBlob(BlobType.Fighter); _saveData.blobData.Add(1, blobStatsData2); // TODO dict key LevelManager.UnlockLevel(LevelEnum.IntroLevel1); // Adds first level data to _saveData Save(); }
public static GameObject GetBlobGameObject(BlobStatsData blobStats, TeamTag teamTag) { GameObject blob = null; switch (blobStats.blobType) { case BlobType.Survivor: blob = GameObject.Instantiate(Resources.Load("Blob") as GameObject); break; case BlobType.Fighter: blob = GameObject.Instantiate(Resources.Load("Fighter") as GameObject); break; } blob.GetComponent <BlobStats>().stats = blobStats; AssignTeam(blob, teamTag); return(blob); }
public void RenderButton(BlobStatsData blobStats) { // Set blob type icon Sprite blobIconSprite = UiData.blobTypeDescription[blobStats.blobType].Icon; blobIcon.sprite = blobIconSprite; // Set blob name blobName.text = blobStats.blobName; // Add stat info foreach (var stat in blobStats.stats) { GameObject statBlockObject = GameObjectUtility.InstantiateChild(statBlock, sliderContent, true); Image statIcon = statBlockObject.transform.Find("StatIcon").GetComponent <Image>(); statIcon.sprite = UiData.statDescriptions[stat.Key].Icon; TextMeshProUGUI statValueText = statBlockObject.transform.Find("StatValueText").GetComponent <TextMeshProUGUI>(); statValueText.text = stat.Value.value.ToString(); } }