/// <summary> /// Returns random non-unique activities. /// </summary> /// <param name="numOfActivitiesArg"></param> /// <returns></returns> private List <HavenActivityData> GetRandomNonUniqueActivities(int numOfActivitiesArg) { // load all non-unique activity templates HavenActivityDataTemplate[] loadedActivityTemplates = AssetRefMethods. LoadAllBundleAssetHavenActivityTemplates(); // if NOT enough loaded activites to return if (numOfActivitiesArg > loadedActivityTemplates.Length) { // print warning to console Debug.LogWarning("Not enough loaded activites to return! " + $"Only found {loadedActivityTemplates.Length} potential activites."); // return some default value return(null); } // get shuffled template list List <HavenActivityDataTemplate> shuffledTemplateList = GeneralMethods. Shuffle <HavenActivityDataTemplate>(loadedActivityTemplates.ToList()); // initialize return list as empty list List <HavenActivityData> returnList = new List <HavenActivityData>(); // loop for as many activites as should return for (int i = 0; i < numOfActivitiesArg; i++) { // add iterating activity to return list returnList.Add(new HavenActivityData(shuffledTemplateList[i])); } // return populated list return(returnList); }
/// <summary> /// Turn on/off the warning icon objects associated with H-content. /// </summary> private void RefreshHcontentIconObjectActivations() { // get whether the H-content files are installed bool isHcontentInstalled = AssetRefMethods.IsHcontentInstalled(); // if H-content is NOT installed then turn this warning icon ON isHcontentNotInstalledIconWarningObject.SetActive(!isHcontentInstalled); // if the H-content is NOT installed if (!isHcontentInstalled) { /// turn OFF the access warning object as it's not relevant if the H-content /// files aren't even installed. isHcontentNotInstalledIconWarningObject.SetActive(false); // DONT continue code return; } // if net manager reference has NOT been setup yet if (_networkManagerCustom == null) { // setup reference vars to their respective singletons InitializeSingetonReferences(); } // if access to H-Content is DISabled then turn this warning icon ON isHcontentDisabledIconWarningObject.SetActive(!_networkManagerCustom.IsHcontentAccessEnabled()); }
/// <summary> /// Sets up the pictures of the party slot buttons. /// Use when party characters or party order has been changed. /// </summary> private void RefreshPartySlotImageContent() { // initialize vars for upcoming loop CharacterData charData; string charId; // loop through all party slot images for (int i = 0; i < partySlotButtonImages.Count; i++) { // get character in iterating party slot charData = GameManager.Instance.GetPartyCharacterInPartySlot(i + 1); // if got a character data if (charData != null) { // get ID of character charId = charData.characterInfo.characterId; } // else NO valid character data was returned else { // print warning to console Debug.LogWarning("Returned char data was null!"); // set ID to some default string charId = string.Empty; } // set iterating slot image's picture to char's icon partySlotButtonImages[i].sprite = AssetRefMethods.LoadBundleAssetCharacterIcon(charId); } }
/// <summary> /// Sets up the ammo type image based on ammo being used. /// </summary> private void RefreshAmmoTypeImage() { // get currently equipped ammo pouch AmmoPouch equippedAmmoPouch = _uiManager.UiPlayerCharacter.GetEquippedAmmoPouch(); // if pouch found if (equippedAmmoPouch != null) { // load sprite icon associated with type of ammo being used Sprite ammoTypeIcon = AssetRefMethods.LoadBundleAssetWeaponTypeSetIcon( equippedAmmoPouch.ammoType.setId); // if sprite successfully loaded if (ammoTypeIcon != null) { // set ammo type image to loaded sprite imageAmmoType.sprite = ammoTypeIcon; // turn ON ammo type image object imageAmmoType.gameObject.SetActive(true); // DONT continue code return; } } // getting here means that ammo type image should NOT be used, so turn OFF the image object imageAmmoType.gameObject.SetActive(false); }
/// <summary> /// Sets up the ability icon image. /// </summary> private void RefreshAbilityIcon() { // if reference to char's ability action is setup if (_charActionAbility != null) { // get equipped active ability ActiveAbility currentAbility = _charActionAbility.GetCurrentActiveAbility(); // if current ability retrieved if (currentAbility != null) { // load appropriate ability icon sprite Sprite abilityIcon = AssetRefMethods.LoadBundleAssetActiveAbilityIcon( currentAbility.abilityId); // if ability icon successfully loaded if (abilityIcon != null) { // set ability icon image to loaded sprite imageAbilityIcon.sprite = abilityIcon; // turn ON ability icon image imageAbilityIcon.gameObject.SetActive(true); // DONT continue code return; } } } // getting here means that ability icon image should NOT be used, so turn OFF the image object imageAbilityIcon.gameObject.SetActive(false); }
/// <summary> /// Returns the character data based on the given character ID. /// </summary> /// <param name="charIdArg"></param> /// <returns></returns> private CharacterData GetCharacterDataFromId(string charIdArg) { // get character from party characters CharacterData partyCharData = _gameManager.GetPartyCharacterFromID(charIdArg); // if char data was found in the party if (partyCharData != null) { // return party char data return(partyCharData); } // load character data template CharacterDataTemplate charDataTemp = AssetRefMethods. LoadBundleAssetCharacterDataTemplate(charIdArg); // if loaded data WAS found if (charDataTemp != null) { // return data based on loaded template return(new CharacterData(charDataTemp)); } // else NO data found else { // return NULL data return(null); } }
/// <summary> /// Returns the tutorial arena prefab associated with curren arena number in set. /// </summary> /// <returns></returns> private LevelArenaController GetAppropriateTutorialArenaPrefab() { // get tutorial arena prefab object GameObject arenaPrefab = AssetRefMethods. LoadBundleAssetTutorialLevelArenaPrefab(arenaNumInSet); // return prefab's arena component return(arenaPrefab.GetComponent <LevelArenaController>()); }
/// <summary> /// Resets the arena set values that are related to starting a new run. /// </summary> private void ResetArenaSetPropertiesNewRun() { // set arena set data to first arena set SetupArenaSetData(1); // set total num of arena sets to how many set templates exist totalNumberOfArenaSets = AssetRefMethods. LoadAllBundleAssetLevelArenaSetDataTemplate().Length; }
/// <summary> /// Performs Level-up process for all party members on their haven stats. /// </summary> /// <returns></returns> private List <(string, CharacterProgressionInfoSet)> LevelUpHavenStatProperties() { // inittialize return list List <(string, CharacterProgressionInfoSet)> charIdToLevelInfo = new List <(string, CharacterProgressionInfoSet)>();; // initialize how many haven stats there are int NUM_OF_HAVEN_STATS = 4; // initialize vars for upcoming loop string charId; List <int> levelsReached; CharacterProgressionInfoSet levelUpInfo; // loop through all party members foreach (CharacterData iterChar in partyCharacters) { // get the iterating char's ID charId = iterChar.characterInfo.characterId; // if the iterating char is the MC if (charId == GeneralMethods.GetCharacterIdMainCharacter()) { // skip this loop iteration continue; } // loop through all haven stats for (int i = 0; i < NUM_OF_HAVEN_STATS; i++) { // get all the levels reached by the iterating char's iterating haven stat levelsReached = havenData.havenProgression.ApplyExternalExpToCharProgress(charId, i + 1); // loop through all levels reached in iterating char's iterating haven stat foreach (int iterLevel in levelsReached) { // get level-up info for the iterating level levelUpInfo = AssetRefMethods.LoadBundleAssetProgressionInfoLeveling(i + 1, charId, iterLevel); // if no such info found for that level if (levelUpInfo == null) { // get default level-up info levelUpInfo = AssetRefMethods.LoadBundleAssetProgressionInfoLeveling(i + 1, charId, 0); } // add the level-up info and associated char to return list charIdToLevelInfo.Add((charId, levelUpInfo)); } } } // return the populated list return(charIdToLevelInfo); }
/// <summary> /// Sets up the aiming reticle image. /// </summary> private void RefreshAimReticle() { // get player char the UI is associated with PlayerCharacterMasterController playerChar = _uiManager.UiPlayerCharacter; // if player char found if (playerChar != null) { // get weapon slot currently being used WeaponSlotData equippedWepSlot = playerChar.GetEquippedWeaponSlot(); // if weapon slot found if (equippedWepSlot != null) { // get currently equipped weapon WeaponData equippedWep = playerChar.GetEquippedWeapon(); // if a weapon IS equipped if (equippedWep != null) { // load the aiming reticle associated with equipped weapon Sprite loadedAimReticle = AssetRefMethods. LoadBundleAssetWeaponTypeReticle(equippedWep.weaponType); // if a reticle was found if (loadedAimReticle != null) { // set reticle image to loaded sprite reticle.sprite = loadedAimReticle; // activate aim reticle reticle.gameObject.SetActive(true); // DONT continue code return; } // else NO reticle was loaded else { // print warning to console Debug.LogWarning("No aiming reticle assoicated with weapon " + $"type: {equippedWep.weaponType.ToString()}"); } } } } // deactivate aim reticle reticle.gameObject.SetActive(false); }
/// <summary> /// Returns the dialogue background from the given properties. /// </summary> /// <param name="bgIdArg"></param> /// <param name="isHContentArg"></param> /// <returns></returns> private Sprite GetDialogueBackground(string bgIdArg, bool isHContentArg) { // if bg is H-content if (isHContentArg) { // load ERO background sprite based on given ID return(AssetRefMethods.LoadHcontentBackground(bgIdArg)); } // else bg is all-ages content else { // load NORMAL background sprite based on given ID return(AssetRefMethods.LoadBundleAssetDialogueBackground(bgIdArg)); } }
/// <summary> /// Sets up character's portrait image. /// </summary> private void RefreshCharacterPortrait() { // get player char the UI is associated with PlayerCharacterMasterController playerChar = _uiManager.UiPlayerCharacter; // if player char found if (playerChar != null) { // get character data that is responsible for the player's apperance CharacterData visualCharData = playerChar.CharDataSecondary; // if char data found if (visualCharData != null) { // load character icon Sprite charIcon = AssetRefMethods.LoadBundleAssetCharacterIcon( visualCharData.characterInfo.characterId); // if char icon successfully loaded if (charIcon != null) { // turn ON char portrait image charPortrait.gameObject.SetActive(true); // set portrait image to loaded sprite charPortrait.sprite = charIcon; } // else NO char icon found else { // turn OFF char portrait image charPortrait.gameObject.SetActive(false); } } // else NO char data retrieved else { // turn OFF char portrait image charPortrait.gameObject.SetActive(false); } } // else NO player char retrieved else { // turn OFF char portrait image charPortrait.gameObject.SetActive(false); } }
/// <summary> /// Sets up the ammo type. /// Call in Awake(). /// </summary> private void InitializeAmmoType() { // if should randomize the ammo type if (randomizeAmmoType) { // get all weapon type set templates WeaponTypeSetTemplate[] wepTypes = AssetRefMethods.LoadAllBundleAssetWeaponTypeSetTemplate(); // get all weapoon types that need ammo to be used List<WeaponTypeSetTemplate> ammoBasedWepTypes = wepTypes.Where (iterSet => iterSet.template.doesNeedAmmo).ToList(); // get random index of ammo wep type list int randomIndex = Random.Range(0, ammoBasedWepTypes.Count); // set ammo type to random list entry ammoType = ammoBasedWepTypes[randomIndex]; } // MAYBE TODO: change pickup model based on ammo type }
/// <summary> /// Sets the arena set data based on the given set number. /// </summary> /// <param name="arenaSetNumArg"></param> private void SetupArenaSetData(int arenaSetNumArg) { // else if all arena sets have been completed if (arenaSetNumArg > totalNumberOfArenaSets) { // set arena set to an invalid arena set to denote that no next arena arenaSetData = GetEndArenaSetData(); } // else still some arena sets left else { // get set template related to given set number LevelArenaSetDataTemplate startingSetTemp = AssetRefMethods. LoadBundleAssetLevelArenaSetDataTemplate(arenaSetNumArg); // set the set data from the template arenaSetData = new LevelArenaSetData(startingSetTemp); } }
/// <summary> /// Sets up weapon model animator based on the equipped weapon. /// </summary> private void RefreshWeaponModel() { // get player char the UI is associated with PlayerCharacterMasterController playerChar = _uiManager.UiPlayerCharacter; // if player char found if (playerChar != null) { // get currently equipped weapon WeaponData equippedWep = playerChar.GetEquippedWeapon(); // if a weapon is equipped if (equippedWep != null) { // get equipped weapon's ID string wepId = equippedWep.itemInfo.itemId; // get equipped weapon's associated 1st person model animator AnimatorOverrideController newWepAnim = AssetRefMethods. LoadBundleAssetFirstPersonWeaponModelAnimator(equippedWep.weaponType, wepId); // if animator found if (newWepAnim != null) { // turn ON 1st person weapon object wepHeadAnim.gameObject.SetActive(true); // set weapon model animator to retreived weapon animator wepModelAnim.runtimeAnimatorController = newWepAnim; // DONT continue code return; } } } // if got here then, turn OFF 1st person weapon object wepHeadAnim.gameObject.SetActive(false); }
public void SetupCharacterData(CharacterData charDataArg) { currentCharacter = charDataArg; // if given a valid character AND that character is actually wearing an outfit if (charDataArg != null && charDataArg.outfitLoadout.GetEquippedOutfit() != null) { // load current portrait set based on character and their outfit currentOutfitPortraits = AssetRefMethods.LoadBundleAssetCharacterPortraitSet( charDataArg.characterInfo.characterId, charDataArg.outfitLoadout.GetEquippedOutfit().outfitId); } // else don't have valid data to work with else { // set outfit portrait set to a NULL set currentOutfitPortraits = null; } // sets the portrait image based on the current character's outfit portrait set RefreshPortraitImage(); }
/// <summary> /// Returns the name of the character asscoaited with the given ID. /// </summary> /// <param name="charIdArg"></param> /// <returns></returns> private string GetCharacterName(string charIdArg) { // load character template from given ID CharacterDataTemplate charTemp = AssetRefMethods. LoadBundleAssetCharacterDataTemplate(charIdArg); // if a character was found if (charTemp != null) { // return loaded char's name return(charTemp.template.characterInfo.characterName); } // else NO character template could be found else { // print warning to log Debug.LogWarning("Problem in GetCharacterName(). No character " + $"associated with ID: {charIdArg}"); // return some default value return(string.Empty); } }
/// <summary> /// Returns a random arena prefab that has NOT been used in this set yet. /// </summary> /// <returns></returns> private LevelArenaController GetAppropriateRandomArenaPrefab() { // load all arena prefab object for current arena set GameObject[] loadedArenaPrefabObjs = AssetRefMethods. LoadAllBundleAssetLevelArenaPrefab(arenaSetData.setNum); // if already used all of the arenas that were loaded if (usedArenaIdsInSet.Count > loadedArenaPrefabObjs.Length) { // print warning to console Debug.LogWarning("No arenas that haven't already been used!"); // return some default value return(null); } // initialize list of arena prefabs that have not been used yet as empty list List <LevelArenaController> potentialArenaPrefab = new List <LevelArenaController>(); // loop through all loaded arena objects foreach (GameObject iterObj in loadedArenaPrefabObjs) { // if iterating arena object has NOT been used in this set yet if (!usedArenaIdsInSet.Contains(GetArenaIdFromObject(iterObj))) { // add the iterating object's arena component to list of potentials potentialArenaPrefab.Add(iterObj.GetComponent <LevelArenaController>()); } } // get a random index in potentials list int randomPrefabListIndex = Random.Range(0, potentialArenaPrefab.Count); // return a random arena prefab by using the random index return(potentialArenaPrefab[randomPrefabListIndex]); }
/// <summary> /// Sets associated animator's controller to the anim apporpriate for this char object. /// </summary> private void RefreshCharacterAnimator() { _animator.runtimeAnimatorController = AssetRefMethods. LoadBundleAssetCharacterAnimator(GetAppropriateCharId()); }
public void ChangeBackgroundL2FromHcontentActivityBackground(string charIdArg, int bgSetArg, int bgIdArg) { ChangeBackground(AssetRefMethods.LoadHcontentActivityBackground(charIdArg, bgSetArg, bgIdArg), 2); }
public void ChangeBackgroundL1FromHavenLocationEvent(string locationEventIdArg, TimeSlotType timeSlotArg) { ChangeBackground(AssetRefMethods.LoadBundleAssetHavenLocationEventDialogueBackground( locationEventIdArg, timeSlotArg), 1); }
public void ChangeBackgroundL1FromHavenActivity(string havenActivityIdArg, TimeSlotType timeSlotArg) { ChangeBackground(AssetRefMethods.LoadBundleAssetHavenActivityDialogueBackground( havenActivityIdArg, timeSlotArg), 1); }
/// <summary> /// Returns whether H-content is both installed and allowed to be viewed. /// </summary> /// <returns></returns> public bool CanHcontentBeViewed() { return(AssetRefMethods.IsHcontentInstalled() && IsHcontentAccessEnabled()); }
/// <summary> /// Plans the days events. Call when entering a new day. /// </summary> /// <param name="gameFlagsArg"></param> /// <param name="todaysDayArg"></param> /// <param name="canHcontentBeViewedArg"></param> /// <param name="maxNumEventsToPlanArg"></param> public void PlanTodaysEvents(GameFlags gameFlagsArg, DayOfWeek todaysDayArg, bool canHcontentBeViewedArg, int maxNumEventsToPlanArg) { // set no events as currently active todaysEvents = new List <HavenLocationEvent>(); // load all haven location event templates HavenLocationEventTemplate[] allLoadedLocEventTemplates = AssetRefMethods.LoadAllBundleAssetHavenLocationEventTemplates(); // get all haven locatione events from loaded templates List <HavenLocationEvent> allLoadedLocEvents = new List <HavenLocationEvent>(); foreach (HavenLocationEventTemplate iterTemp in allLoadedLocEventTemplates) { allLoadedLocEvents.Add(new HavenLocationEvent(iterTemp)); } // get all location events that can potentially be used today List <HavenLocationEvent> allPotentialLocEvents = GetAllPotentialEventsForToday( allLoadedLocEvents, gameFlagsArg, todaysDayArg, canHcontentBeViewedArg); // get a random number of events that should be placed int randNumOfEvents = UnityEngine.Random.Range(0, maxNumEventsToPlanArg); // initialize vars for upcoming loop List <HavenLocationEvent> currentPotentialLocEvents; int randomIndex; HavenLocationEvent selectedEvent; // loop for as many events as should be retrieved for (int i = 0; i < randNumOfEvents; i++) { // reset the list of currently potential events currentPotentialLocEvents = new List <HavenLocationEvent>(); /// loop through all potential events. NOTE: Need to re-screen potential events to /// ensure that they do not colfict with the previously set events foreach (HavenLocationEvent iterEvent in allPotentialLocEvents) { // if iterating event is already active if (IsEventActive(iterEvent)) { // skip to next loop iteration continue; } // if char associated with iterating event is already used in an active event if (ActiveEventsUsingCharacter(iterEvent.GetAppropriateAssociatedCharacterId())) { // skip to next loop iteration continue; } // if location of iterating event is already being used by an active event if (ActiveEventsUsingLocation(iterEvent.locatedSpot)) { // skip to next loop iteration continue; } // add iterating event to currently potential events currentPotentialLocEvents.Add(iterEvent); } // if there is no available events that could be used if (currentPotentialLocEvents.Count == 0) { // print warning to console Debug.LogWarning("Problem in PlanTodaysEvents(). Not any more potential events to use!"); // DONT continue code return; } // get random index from event list randomIndex = UnityEngine.Random.Range(0, currentPotentialLocEvents.Count); // get the randomly chosen event selectedEvent = new HavenLocationEvent(currentPotentialLocEvents[randomIndex]); // add selected event to today's active events todaysEvents.Add(selectedEvent); // denote that selected event has been used for the week eventsUsedInCurrentWeek.Add(selectedEvent); } }
private bool CanShowHcontent() { Debug.LogWarning("NEED IMPL: implement second half of CanShowHcontent()"); // NEED IMPL // if H-content is installed AND is enabled to be shown return((AssetRefMethods.IsHcontentInstalled()) && (false)); }
public void ChangeBackgroundL1FromHavenLocationActivityHub(HavenLocation locationArg, TimeSlotType timeSlotArg) { ChangeBackground(AssetRefMethods.LoadBundleAssetHavenLocationActivityHubDialogueBackground( locationArg, timeSlotArg), 1); }