void Start() { movement = gameObject.GetComponentInChildren <CharacterMovement>(); GatheringSkill = gameObject.GetComponentInChildren <GatheringSkillDatabase>(); ItemID = gameObject.GetComponentInChildren <WeaponSwitch>(); ToolID = gameObject.GetComponentInChildren <ToolDatabase>(); MiscItems = gameObject.GetComponentInChildren <MiscellaneousItemsDatabase>(); terrain = GameObject.FindGameObjectWithTag("MainEnvironment").GetComponent <TerrainScript>(); Stats = gameObject.GetComponentInChildren <CharacterStats>(); ItemPickup = gameObject.GetComponentInChildren <PickupObjects>(); characterInventory = terrain.canvas.GetComponentInChildren <CharacterInventoryGUI>(); monsterFunctions = terrain.GetComponent <MonsterFunctions>(); mainGUI = terrain.canvas.GetComponentInChildren <MainGUI>(); }
void Start() { PickUpItemCoolDown = Time.time; RockDB = gameObject.GetComponentInChildren <MineRocks>(); TreeDB = gameObject.GetComponentInChildren <ChopTrees>(); MiscDB = gameObject.GetComponentInChildren <MiscellaneousItemsDatabase>(); WeaponDB = gameObject.GetComponentInChildren <WeaponsDatabase>(); ToolsDB = gameObject.GetComponentInChildren <ToolDatabase>(); HerbPatchDB = gameObject.GetComponentInChildren <Herbloring>(); PotionDB = gameObject.GetComponentInChildren <PotionDatabase>(); terrain = GameObject.FindWithTag("MainEnvironment").GetComponentInChildren <TerrainScript>(); inventory = terrain.canvas.GetComponentInChildren <CharacterInventoryGUI>(); }
void Start() { terrain = GameObject.FindWithTag("MainEnvironment").GetComponentInChildren <TerrainScript>(); MiscItems = terrain.Player.GetComponentInChildren <MiscellaneousItemsDatabase>(); Potions = terrain.Player.GetComponentInChildren <PotionDatabase>(); Weapons = terrain.Player.GetComponentInChildren <WeaponsDatabase>(); Armors = terrain.Player.GetComponentInChildren <ArmorDatabase>(); GeneralDB = terrain.Player.GetComponentInChildren <GeneralSkillsDatabase>(); GatheringDB = terrain.Player.GetComponentInChildren <GatheringSkillDatabase>(); CraftingDB = terrain.Player.GetComponentInChildren <CraftingSkillDatabase>(); Stats = terrain.Player.GetComponentInChildren <CharacterStats>(); skills = GameObject.Find("Canvas").GetComponentInChildren <Canvas>(); characterSkills = skills.GetComponentInChildren <CharacterSkillsGUI>(); skillbarGUI = terrain.canvas.GetComponentInChildren <CharacterSkillBarGUI>(); }
void Start() { CurrentPointerButtonIndex = -1; CurrentUpgradeItemSlot = -1; UpgradeIndex = -1; terrain = GameObject.FindWithTag("MainEnvironment").GetComponentInChildren <TerrainScript>(); RectINIT = Instantiate(PickUpWindowRectPrefab, transform.position, transform.rotation) as Button; RectINIT.GetComponentInChildren <Image>().enabled = false; HoverRectINIT = Instantiate(HoverWindowRectPrefab, transform.position, transform.rotation) as GameObject; HoverRectINIT.transform.SetParent(transform); HoverRectINIT.transform.localScale = new Vector3(1, 1, 1); HoverRectINIT.GetComponentInChildren <Image>().enabled = false; HoverRectINIT.transform.Find("Image").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Level").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rarity").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate1").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate2").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate3").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate4").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate5").GetComponentInChildren <Text>().enabled = false; inventory = gameObject.transform.root.GetComponentInChildren <Canvas>(); characterInventory = gameObject.GetComponentInParent <CharacterInventoryGUI>(); skillbarGUI = terrain.canvas.GetComponentInChildren <CharacterSkillBarGUI>(); character = terrain.Player.GetComponentInChildren <CharacterMovement>(); MiscItems = terrain.Player.GetComponentInChildren <MiscellaneousItemsDatabase>(); Weapons = terrain.Player.GetComponentInChildren <WeaponsDatabase>(); WepSwitch = terrain.Player.GetComponentInChildren <WeaponSwitch>(); Tools = terrain.Player.GetComponentInChildren <ToolDatabase>(); Potions = terrain.Player.GetComponentInChildren <PotionDatabase>(); Armors = terrain.Player.GetComponentInChildren <ArmorDatabase>(); armorSwitch = terrain.Player.GetComponentInChildren <ArmorSwitch>(); Stats = terrain.Player.GetComponentInChildren <CharacterStats>(); UpgradeItems = terrain.canvas.GetComponentInChildren <CharacterUpgradeItems>(); }
void Start() { terrain = GameObject.FindWithTag("MainEnvironment").GetComponentInChildren <TerrainScript>(); SkillTablList = new List <Button>(); gatheringDatabase = terrain.Player.GetComponentInChildren <GatheringSkillDatabase>(); craftingDatabase = terrain.Player.GetComponentInChildren <CraftingSkillDatabase>(); MiscItems = terrain.Player.GetComponentInChildren <MiscellaneousItemsDatabase>(); Potions = terrain.Player.GetComponentInChildren <PotionDatabase>(); Weapons = terrain.Player.GetComponentInChildren <WeaponsDatabase>(); Armors = terrain.Player.GetComponentInChildren <ArmorDatabase>(); GeneralsDB = terrain.Player.GetComponentInChildren <GeneralSkillsDatabase>(); Stats = terrain.Player.GetComponentInChildren <CharacterStats>(); skillbarGUI = terrain.canvas.GetComponent <MainGUI>().characterSkillsBarGUI; charMovement = terrain.Player.GetComponentInChildren <CharacterMovement>(); for (int i = 0; i < gatheringDatabase.GatheringSkillList.Count; i++) { GameObject RankGroup = Instantiate(RankCraftGatherSkillsGroupReference, transform.position, transform.rotation) as GameObject; GatheringRankSkillsGroupList.Add(RankGroup); GatheringRankSkillsGroupList[i].transform.SetParent(GatheringRankSkillImage.transform); GatheringRankSkillsGroupList[i].transform.localScale = GatheringSkillImage.transform.localScale; GatheringRankSkillsGroupList[i].transform.Find("IconSkillPickupPrefab").Find("ImageScript").GetComponentInChildren <Image>().sprite = gatheringDatabase.GatheringSkillSprites[i]; GatheringRankSkillsGroupList[i].transform.Find("RankNames").GetComponentInChildren <Text>().text = gatheringDatabase.GatheringSkillList[i].GatheringName; GatheringRankSkillsGroupList[i].transform.Find("CurrentRanks").GetComponentInChildren <Text>().text = "Rank " + gatheringDatabase.GatheringSkillList[i].CurrentRank.ToString(); GatheringRankSkillsGroupList[i].transform.Find("RankExp").Find("Exp").GetComponentInChildren <Text>().text = "Exp: " + gatheringDatabase.GatheringSkillList[i].CurrentExp + "/" + gatheringDatabase.GatheringSkillList[i].MaxExp; GatheringRankSkillsGroupList[i].transform.Find("RankExp").Find("Exp").GetComponent <Image>().fillAmount = gatheringDatabase.GatheringSkillList[i].CurrentExp / gatheringDatabase.GatheringSkillList[i].MaxExp; } for (int i = 0; i < craftingDatabase.CraftingSkillList.Count; i++) { GameObject RankGroup = Instantiate(RankCraftGatherSkillsGroupReference, transform.position, transform.rotation) as GameObject; CraftingRankSkillsGroupList.Add(RankGroup); CraftingRankSkillsGroupList[i].transform.SetParent(CraftingRankSkillImage.transform); CraftingRankSkillsGroupList[i].transform.localScale = CraftingRankSkillImage.transform.localScale; CraftingRankSkillsGroupList[i].transform.Find("IconSkillPickupPrefab").Find("ImageScript").GetComponentInChildren <Image>().sprite = craftingDatabase.CraftingSkillSprites[i]; CraftingRankSkillsGroupList[i].transform.Find("RankNames").GetComponentInChildren <Text>().text = craftingDatabase.CraftingSkillList[i].CraftingName; CraftingRankSkillsGroupList[i].transform.Find("CurrentRanks").GetComponentInChildren <Text>().text = "Rank " + craftingDatabase.CraftingSkillList[i].CurrentRank; CraftingRankSkillsGroupList[i].transform.Find("RankExp").Find("Exp").GetComponentInChildren <Text>().text = "Exp: " + craftingDatabase.CraftingSkillList[i].CurrentExp + "/" + craftingDatabase.CraftingSkillList[i].MaxExp; CraftingRankSkillsGroupList[i].transform.Find("RankExp").Find("Exp").GetComponent <Image>().fillAmount = craftingDatabase.CraftingSkillList[i].CurrentExp / craftingDatabase.CraftingSkillList[i].MaxExp; } for (int i = 0; i < GeneralsDB.GeneralSkillList.Count; i++) { GameObject RankGroup = Instantiate(RankGeneralSkillsGroupReference, transform.position, transform.rotation) as GameObject; GeneralRankSkillsGroupList.Add(RankGroup); GeneralRankSkillsGroupList[i].transform.SetParent(GeneralRankSkillImage.transform); GeneralRankSkillsGroupList[i].transform.localScale = GeneralRankSkillImage.transform.localScale; GeneralRankSkillsGroupList[i].transform.Find("IconSkillPickupPrefab").Find("ImageScript").GetComponentInChildren <Image>().sprite = GeneralsDB.GeneralSkillsSprites[i]; GeneralRankSkillsGroupList[i].transform.Find("RankNames").GetComponentInChildren <Text>().text = GeneralsDB.GeneralSkillList[i].SkillName; GeneralRankSkillsGroupList[i].transform.Find("CurrentRanks").GetComponentInChildren <Text>().text = "Rank " + GeneralsDB.GeneralSkillList[i].LevelRank.ToString(); int x = i; GeneralRankSkillsGroupList[x].transform.Find("LevelUp").GetComponentInChildren <Button>().onClick.AddListener(() => LevelupGeneralSkills(x)); } for (int i = 0; i < GeneralsDB.FireSkillList.Count; i++) { GameObject RankGroup = Instantiate(RankGeneralSkillsGroupReference, transform.position, transform.rotation) as GameObject; FireRankSkillsGroupList.Add(RankGroup); FireRankSkillsGroupList[i].transform.SetParent(FireRankSkillImage.transform); FireRankSkillsGroupList[i].transform.localScale = FireRankSkillImage.transform.localScale; FireRankSkillsGroupList[i].transform.Find("IconSkillPickupPrefab").Find("ImageScript").GetComponentInChildren <Image>().sprite = GeneralsDB.FireSkillsSprites[i]; FireRankSkillsGroupList[i].transform.Find("RankNames").GetComponentInChildren <Text>().text = GeneralsDB.FireSkillList[i].SkillName; FireRankSkillsGroupList[i].transform.Find("CurrentRanks").GetComponentInChildren <Text>().text = "Rank " + GeneralsDB.GeneralSkillList[i].LevelRank.ToString(); int x = i; FireRankSkillsGroupList[x].transform.Find("LevelUp").GetComponentInChildren <Button>().onClick.AddListener(() => LevelupElementalSkills(1, x)); } for (int i = 0; i < GeneralsDB.IceSkillList.Count; i++) { GameObject RankGroup = Instantiate(RankGeneralSkillsGroupReference, transform.position, transform.rotation) as GameObject; IceRankSkillsGroupList.Add(RankGroup); IceRankSkillsGroupList[i].transform.SetParent(IceRankSkillImage.transform); IceRankSkillsGroupList[i].transform.localScale = IceRankSkillImage.transform.localScale; IceRankSkillsGroupList[i].transform.Find("IconSkillPickupPrefab").Find("ImageScript").GetComponentInChildren <Image>().sprite = GeneralsDB.IceSkillsSprites[i]; IceRankSkillsGroupList[i].transform.Find("RankNames").GetComponentInChildren <Text>().text = GeneralsDB.IceSkillList[i].SkillName; IceRankSkillsGroupList[i].transform.Find("CurrentRanks").GetComponentInChildren <Text>().text = "Rank " + GeneralsDB.IceSkillList[i].LevelRank.ToString(); int x = i; IceRankSkillsGroupList[x].transform.Find("LevelUp").GetComponentInChildren <Button>().onClick.AddListener(() => LevelupElementalSkills(2, x)); } for (int i = 0; i < GeneralsDB.LightningSkillList.Count; i++) { GameObject RankGroup = Instantiate(RankGeneralSkillsGroupReference, transform.position, transform.rotation) as GameObject; LightningRankSkillsGroupList.Add(RankGroup); LightningRankSkillsGroupList[i].transform.SetParent(LightningRankSkillImage.transform); LightningRankSkillsGroupList[i].transform.localScale = LightningRankSkillImage.transform.localScale; LightningRankSkillsGroupList[i].transform.Find("IconSkillPickupPrefab").Find("ImageScript").GetComponentInChildren <Image>().sprite = GeneralsDB.LightningSkillsSprites[i]; LightningRankSkillsGroupList[i].transform.Find("RankNames").GetComponentInChildren <Text>().text = GeneralsDB.LightningSkillList[i].SkillName; LightningRankSkillsGroupList[i].transform.Find("CurrentRanks").GetComponentInChildren <Text>().text = "Rank " + GeneralsDB.LightningSkillList[i].LevelRank.ToString(); int x = i; LightningRankSkillsGroupList[x].transform.Find("LevelUp").GetComponentInChildren <Button>().onClick.AddListener(() => LevelupElementalSkills(3, x)); } for (int i = 0; i < GeneralsDB.NatureSkillList.Count; i++) { GameObject RankGroup = Instantiate(RankGeneralSkillsGroupReference, transform.position, transform.rotation) as GameObject; NatureRankSkillsGroupList.Add(RankGroup); NatureRankSkillsGroupList[i].transform.SetParent(NatureRankSkillImage.transform); NatureRankSkillsGroupList[i].transform.localScale = NatureRankSkillImage.transform.localScale; NatureRankSkillsGroupList[i].transform.Find("IconSkillPickupPrefab").Find("ImageScript").GetComponentInChildren <Image>().sprite = GeneralsDB.NatureSkillsSprites[i]; NatureRankSkillsGroupList[i].transform.Find("RankNames").GetComponentInChildren <Text>().text = GeneralsDB.NatureSkillList[i].SkillName; NatureRankSkillsGroupList[i].transform.Find("CurrentRanks").GetComponentInChildren <Text>().text = "Rank " + GeneralsDB.NatureSkillList[i].LevelRank.ToString(); int x = i; NatureRankSkillsGroupList[x].transform.Find("LevelUp").GetComponentInChildren <Button>().onClick.AddListener(() => LevelupElementalSkills(4, x)); } TransformPosition = gameObject.GetComponent <RectTransform>(); ShowButtons(1); InvokeRepeating("LevelupCraftingAndGathering", 0, 1); // we want to show only the gathering tab first when game starts, thats why it is disabled in the gameobject }