// Start is called before the first frame update void Start() { CardDatabase.LoadAllCards(); GearDatabase.LoadAllGear(); allTemplates = new List <EncounterTemplate>(Resources.LoadAll <EncounterTemplate>("EncounterTemplates")); GameplayContext.InDebugMode = false; heightOfLevels = MaxNodesPerLevel * paddingWithinLevel; ClearLevel(); if (GameplayContext.OverworldMap == null || GameplayContext.RequestReset) { GenerateMap(); SetPlayerAt(allLevels[0][0]); GameplayContext.OverworldMap = MapToAbstract(); GameplayContext.CurrentDifficulty = 2; //only set the first time GameplayContext.RequestReset = false; } else { AbstractToMap(GameplayContext.OverworldMap); } }
static void Postfix(GearDatabase __instance, IndexPath index, GearInfo[][][] ___gearListSource, ref GearInfo __result) { if (index.depth < 3) { return; } // return out if it's not one of the tabs XLMenuMod is aware of. if (index[1] < 0 || index[1] > (___gearListSource[index[0]].Length * 2) - 1) { return; } List <ICustomInfo> sourceList = null; if (CustomGearManager.Instance.CurrentFolder.HasChildren()) { sourceList = CustomGearManager.Instance.CurrentFolder.Children; } else { if (index[1] < Enum.GetValues(typeof(GearCategory)).Length&& !CategoryHelper.IsTypeOf(index, GearCategory.SkinTone)) { sourceList = CustomGearManager.Instance.NestedOfficialItems; } else if (index[1] >= Enum.GetValues(typeof(GearCategory)).Length) { sourceList = CustomGearManager.Instance.NestedItems; } } if (sourceList == null) { return; } if (index.LastIndex < 0 || index.LastIndex >= sourceList.Count) { return; } var customInfo = sourceList.ElementAt(index.LastIndex); if (customInfo.GetParentObject() is CustomBoardGearInfo customBoardGearInfo) { __result = customBoardGearInfo; } else if (customInfo.GetParentObject() is CustomCharacterGearInfo customCharacterGearInfo) { __result = customCharacterGearInfo; } else if (customInfo.GetParentObject() is CustomCharacterBodyInfo customCharacterBodyInfo) { __result = customCharacterBodyInfo; } else if (customInfo.GetParentObject() is CustomGearFolderInfo customGearFolderInfo) { __result = customGearFolderInfo; } }
public Owner(EFContext db, CommandService commands, ILogger <Owner> logger, Configuration configuration, MiscDatabaseMethodsService misc, DatabaseTimeEvents events, GearDatabase gearDatabase) { this._db = db; this._commands = commands; _misc = misc; _logger = logger; _configuration = configuration; _events = events; _gearDatabase = gearDatabase; }
/// <summary> /// Get a list of each kind of unique gear piece in the inventory. /// Duplicate pieces aren't shown /// </summary> /// <returns></returns> public List <GearData> GetAllGearTypes() { List <GearData> output = new List <GearData>(); foreach (KeyValuePair <int, int> pair in contents) { output.Add(GearDatabase.GetGearDataByID(pair.Key)); } return(output); }
/// <summary> /// Get a list of each kind of unique gear piece in the inventory that fits in a given slot /// </summary> /// <param name="slotFilter">The requiredSlot to filter for</param> /// <returns></returns> public List <GearData> GetAllGearTypesOfSlot(GearSlotTypes slotFilter) { List <GearData> output = new List <GearData>(); foreach (KeyValuePair <int, int> pair in contents) { GearData gear = GearDatabase.GetGearDataByID(pair.Key); if (gear.requiredSlot == slotFilter) { output.Add(gear); } } return(output); }
static void Postfix(GearDatabase __instance, IndexPath index, GearInfo[][][] ___gearListSource, GearInfo[][][] ___customGearListSource, ref GearInfo[] __result) { // return out if it's not one of the tabs XLMenuMod is aware of. if (index[1] < 0 || index[1] > (___gearListSource[index[0]].Length * 2) - 1) { return; } List <ICustomInfo> sourceList = null; if (index[1] < ___gearListSource[index[0]].Length) { var gearToLoad = ___gearListSource[index[0]][index[1]]; if (CategoryHelper.IsTypeOf(index, GearCategory.Hair)) { CustomGearManager.Instance.LoadNestedHairItems(gearToLoad); } else if (!CategoryHelper.IsTypeOf(index, GearCategory.SkinTone)) { CustomGearManager.Instance.LoadNestedOfficialItems(gearToLoad); } if (!CategoryHelper.IsTypeOf(index, GearCategory.SkinTone)) { sourceList = CustomGearManager.Instance.CurrentFolder.HasChildren() ? CustomGearManager.Instance.CurrentFolder.Children : CustomGearManager.Instance.NestedOfficialItems; } } else { if (index[1] >= ___gearListSource[index[0]].Length) { var tempIndex = index[1] - ___customGearListSource[index[0]].Length; if (tempIndex < ___customGearListSource[index[0]].Length) { CustomGearManager.Instance.LoadNestedItems(___customGearListSource[index[0]][tempIndex]); } } sourceList = CustomGearManager.Instance.CurrentFolder.HasChildren() ? CustomGearManager.Instance.CurrentFolder.Children : CustomGearManager.Instance.NestedItems; } if (sourceList == null) { return; } __result = sourceList.Select(x => x.GetParentObject() as GearInfo).ToArray(); }
void Start() { CardDatabase.LoadAllCards(); GearDatabase.LoadAllGear(); if (GameplayContext.CurrentInventory is null || GameplayContext.RequestReset) { playerInventory = new InventoryCollection(); //two legs playerInventory.AddItem(GearDatabase.GetGearDataByID(0)); playerInventory.AddItem(GearDatabase.GetGearDataByID(0)); //two melee arm playerInventory.AddItem(GearDatabase.GetGearDataByID(1), 2); //two rifle arm playerInventory.AddItem(GearDatabase.GetGearDataByID(3), 2); GameplayContext.CurrentInventory = playerInventory; Debug.Log("made new inventory"); }
void Start() { ammotext = GameObject.Find("UI").transform.Find("Ammo").GetComponent <Text>(); Transform weaponSpot = GetComponentInChildren <WeaponSpot>().transform; audioSource = weaponSpot.gameObject.GetComponent <AudioSource>(); cursor = GameObject.FindObjectOfType <CursorTag>().gameObject; gearDatabase = GameObject.FindObjectOfType <GearDatabase>(); RectTransform guiWeaponSpot = GameObject.Find("UI").transform.Find("ActiveWeapon").GetComponent <RectTransform>(); // get from database and instantiate all weapons that shall be available if (availableWeapons.Count != 0) { selectedWeapon = (int)Mathf.Clamp(selectedWeapon, 0, availableWeapons.Count); for (int i = 0; i < availableWeapons.Count; i++) { GameObject weap = Instantiate(gearDatabase.weapons.Find(x => x.gamePref.name == availableWeapons[i].name).gamePref, weaponSpot) as GameObject; availableWeapons[i].weaponGO = weap; weap.transform.localPosition = Vector3.zero; weap.transform.localRotation = Quaternion.identity; weap.transform.localScale = Vector3.one; weap.SetActive(false); //do the same for UI gameobjects GameObject weapUI = Instantiate(gearDatabase.weapons.Find(x => x.guiPref.name == "UI" + availableWeapons[i].name).guiPref, guiWeaponSpot) as GameObject; weapUI.GetComponent <RectTransform>().localPosition = Vector3.zero; availableWeapons[i].weaponUIGO = weapUI; weapUI.SetActive(false); //ui weapon slots adjust GameObject weaponSlot = GameObject.Find("UI").transform.Find("Weapons").Find(i.ToString()).gameObject; if (weaponSlot != null) { weaponSlot.transform.Find(availableWeapons[i].name).gameObject.SetActive(true); } } availableWeapons[selectedWeapon].weaponGO.SetActive(true); availableWeapons[selectedWeapon].weaponUIGO.SetActive(true); } }
new void Start() { base.Start(); movement = GetComponent <MovementController>(); anim = GetComponent <Animator>(); movement.moveSpeed += Random.Range(-(movement.moveSpeed * 0.2f), movement.moveSpeed * 0.2f); chasing = false; Transform weaponSpot = GetComponentInChildren <WeaponSpot>().transform; GearDatabase gearDatabase = GameObject.FindObjectOfType <GearDatabase>(); GameObject weap = Instantiate(gearDatabase.weapons.Find(x => x.gamePref.name == startWeapon).gamePref, weaponSpot) as GameObject; weap.transform.localPosition = Vector3.zero; weap.transform.localRotation = Quaternion.identity; weap.transform.localScale = Vector3.one; if (Random.Range(0, 10) > 5) { direction = 1; } else { direction = -1; } changeDirectionCooldown = Random.Range(2, 10); }
// Start is called before the first frame update void Start() { FXHelper.Initialize(); ColorUtility.TryParseHtmlString("#793434", out Color col); enemyHealthBar.Colour = col; stateStack = new Stack <GameState>(); stateStack.Push(GameState.PlayerIdle); if (worldGrid == null) { worldGrid = GameObject.FindObjectOfType <HexGrid>(); } worldGrid.GenerateMap(mapRadius); entFactory = EntityFactory.GetFactory; allEntities = new List <Entity>(); allEnemies = new List <Entity>(); enemiesWhoNeedTurns = new List <Entity>(); entitiesToClean = new List <Entity>(); if (GameplayContext.ChosenTemplate != null) { GenerateEncounter(GameplayContext.ChosenTemplate); } else { GenerateEncounter(defaultEncounterTemplate); } GameplayContext.InitializeForEncounter(this, player, worldGrid, interfaceManager); if (GameplayContext.CurrentLoadout != null) { basicDeck = GameplayContext.CurrentLoadout.ToDeckTemplate(); } else { //fudge a deck together so we can start on the combat scene without crashing CardDatabase.LoadAllCards(); basicDeck = new DeckTemplate(); basicDeck.AddCardID(CardDatabase.GetCardDataByName("Shoot").cardID, 6); basicDeck.AddCardID(CardDatabase.GetCardDataByName("Step").cardID, 4); } if (!GearDatabase.IsLoaded) { GearDatabase.LoadAllGear(); } drawPile = basicDeck.ConvertToDeck(); drawPile.PrintContents("drawpile"); allExistingCards = new List <Card>(); foreach (Card c in drawPile) { allExistingCards.Add(c); } discardPile = new Deck(); playerHand = new List <Card>(); drawPile.Shuffle(); energy = 5; if (!GameplayContext.InDebugMode) { GameObject endbutton = GameObject.Find("EndGameButton"); endbutton.SetActive(false); } Invoke("StartNewTurn", 0.2f); }
public Gear(EFContext database, MiscDatabaseMethodsService misc, GearDatabase gearDatabase) { _database = database; _misc = misc; _gearDatabase = gearDatabase; }