void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player> (); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory> (); equipList = FindObjectOfType <EquipmentList>(); slotmanger = FindObjectOfType <SlotManger>(); }
//Start overrides the Start function of MovingObject protected override void Start() { _slotManger = FindObjectOfType <SlotManger>(); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>(); //Get a component reference to the Player's animator component animator = GetComponent <Animator> (); attackOrDefend = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerAttackOrDefend> (); //Get the current health point total stored in GameManager.instance between levels. health = GameManager.instance.playerHealthPoints; //Set the healthText to reflect the current player health total. healthText.text = health + "%"; healthSlider.value = health; originalH = joystick.transform.position.x; originalV = joystick.transform.position.y; //disable joystick at the start joystick.GetComponent <Image>().enabled = false; //not attached in my scene //joystickBounds.GetComponent<Image>().enabled = false; //joystick.enabled = false; //Call the Start function of the MovingObject base class. base.Start(); }
// Use this for initialization void Start() { inventoryManger = GameObject.FindGameObjectWithTag("SlotManger").GetComponent <SlotManger>(); GrowthValue = Mathf.Abs(this.GetComponent <RectTransform>().offsetMax.x); b_grow = false; //GrowTime =1; InventoryRect.offsetMin = new Vector2(GrowthValue, 0); InventoryRect.offsetMax = new Vector2(GrowthValue, 0); }
// Use this for initialization void Start() { inventoryManger = GameObject.FindGameObjectWithTag("SlotManger").GetComponent<SlotManger>(); GrowthValue = Mathf.Abs(this.GetComponent<RectTransform>().offsetMax.x); b_grow = false; //GrowTime =1; InventoryRect.offsetMin = new Vector2(GrowthValue ,0); InventoryRect.offsetMax = new Vector2(GrowthValue ,0); }
//static bool outsideInventory = false; // change later add to a main script // Use this for initialization void Start() { itemAmount = gameObject.transform.GetChild(1).GetComponent <Text> (); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory> (); user = GameObject.FindGameObjectWithTag("Item User").GetComponent <ItemUser> (); itemImage = gameObject.transform.GetChild(0).GetComponent <Image> (); _slotManger = FindObjectOfType <SlotManger>(); itemImage.enabled = false; itemAmount.text = ""; }
// Use this for initialization // growth value use the anchor of a rectTrasnform to get the distance to travle void Start() { if(InventoryRect) { inventoryManger = GameObject.FindGameObjectWithTag("SlotManger").GetComponent<SlotManger>(); GrowthValue = (this.GetComponent<RectTransform>().offsetMax.x); } else GrowthValue = this.GetComponent<RectTransform>().offsetMin.x; b_grow = false; //GrowTime =1; //SlideRect.offsetMin = new Vector2(GrowthValue ,0); //SlideRect.offsetMax = new Vector2(GrowthValue ,0); }
// Use this for initialization // growth value use the anchor of a rectTrasnform to get the distance to travle void Start() { if (InventoryRect) { inventoryManger = GameObject.FindGameObjectWithTag("SlotManger").GetComponent <SlotManger>(); GrowthValue = (this.GetComponent <RectTransform>().offsetMax.x); } else { GrowthValue = this.GetComponent <RectTransform>().offsetMin.x; } b_grow = false; //GrowTime =1; //SlideRect.offsetMin = new Vector2(GrowthValue ,0); //SlideRect.offsetMax = new Vector2(GrowthValue ,0); }
void Start() { slotmanger = FindObjectOfType <SlotManger>(); SlotNumberStart = 0; PageButton = new Button[PageCount]; PageObject = GameObject.FindGameObjectWithTag("PageContainer"); StorageSwap = GameObject.FindGameObjectWithTag("StorageSwap"); for (int p = 0; p < PageCount; p++) { GameObject page = Instantiate(Page) as GameObject; page.transform.parent = PageObject.gameObject.transform; PageButton[p] = page.GetComponent <Button>(); page.name = p.ToString(); page.GetComponentInChildren <Text>().text = p.ToString(); page.GetComponent <PageButton>().PageNumberStart = SlotNumberStart; page.transform.localScale = new Vector3(1, 1, 1); SlotNumberStart += ItemPerPage; //PageButton[p].onClick.AddListener( delegate{someFunction();}); // mod to have functions for page change //second mod make second script to attach to button } for (int c = 0; c < (PageCount * ItemPerPage) + StorageSlot; c++) { Items.Add(new Item()); } //x = -82;//-50; //y = 102;// 240; //slotX = 3; //slotY = 10; database = GameObject.FindGameObjectWithTag("Item Database").GetComponent <ItemDatabase> (); //user = GameObject.FindGameObjectWithTag ("Item User").GetComponent<ItemUser> (); //for (int i = 0; i < slotY; i++) { for (int i = 0; i < ItemPerPage; i++) { GameObject slot = (GameObject)Instantiate(slots); slot.GetComponent <SlotScript> ().slotNumber = i; Slots.Add(slot); //slot.transform.parent = this.gameObject.transform; slot.transform.SetParent(this.gameObject.transform); slot.name = "Slot " + (i); //slot.GetComponent<RectTransform> ().localPosition = new Vector3 (x + k * 80, y - i * 80, 0); } for (int s = 0; s < StorageSlot; s++) { GameObject slot = (GameObject)Instantiate(slots); slot.GetComponent <SlotScript> ().slotNumber = s + ((PageCount * ItemPerPage) - StorageSlot); slot.GetComponent <SlotScript> ().StorageSlot = true; Slots.Add(slot); //slot.transform.parent = this.gameObject.transform; slot.transform.SetParent(StorageSwap.gameObject.transform); slot.name = "Slot " + (s + ((PageCount * ItemPerPage) - StorageSlot)); } //} //if (GameManager.instance.level != 1) { // GameManager.instance.loadInventory (); //} Items [0] = database.items [1]; Items [30] = database.items [0]; //for (int t =0; t < 90; t++) //{ // database.items [1]; //} //AddItem(1); Items [60] = database.items [1]; AddItem(1); for (int i = 11; i < 19; i++) { AddItem(i); } }
// Use this for initialization void Start() { slotManger = GameObject.FindGameObjectWithTag("SlotManger").GetComponent<SlotManger>(); }
//static bool outsideInventory = false; // change later add to a main script // Use this for initialization void Start() { itemAmount = gameObject.transform.GetChild (1).GetComponent<Text> (); inventory = GameObject.FindGameObjectWithTag ("Inventory").GetComponent<Inventory> (); user = GameObject.FindGameObjectWithTag ("Item User").GetComponent<ItemUser> (); itemImage = gameObject.transform.GetChild (0).GetComponent<Image> (); _slotManger = FindObjectOfType<SlotManger>(); itemImage.enabled = false; itemAmount.text = ""; }
// Use this for initialization void Start() { slotManger = GameObject.FindGameObjectWithTag("SlotManger").GetComponent <SlotManger>(); }
void Start() { slotmanger = FindObjectOfType<SlotManger>(); SlotNumberStart = 0; PageButton = new Button[PageCount]; PageObject = GameObject.FindGameObjectWithTag("PageContainer"); StorageSwap = GameObject.FindGameObjectWithTag("StorageSwap"); for( int p=0; p < PageCount; p++) { GameObject page = Instantiate(Page) as GameObject; page.transform.parent = PageObject.gameObject.transform; PageButton[p] = page.GetComponent<Button>(); page.name = p.ToString(); page.GetComponentInChildren<Text>().text = p.ToString(); page.GetComponent<PageButton>().PageNumberStart = SlotNumberStart; page.transform.localScale = new Vector3(1,1,1); SlotNumberStart+=ItemPerPage; //PageButton[p].onClick.AddListener( delegate{someFunction();}); // mod to have functions for page change //second mod make second script to attach to button } for( int c = 0 ; c < (PageCount * ItemPerPage) +StorageSlot; c++) { Items.Add (new Item ()); } //x = -82;//-50; //y = 102;// 240; //slotX = 3; //slotY = 10; database = GameObject.FindGameObjectWithTag ("Item Database").GetComponent<ItemDatabase> (); //user = GameObject.FindGameObjectWithTag ("Item User").GetComponent<ItemUser> (); //for (int i = 0; i < slotY; i++) { for (int i = 0; i < ItemPerPage ; i++) { GameObject slot = (GameObject)Instantiate(slots); slot.GetComponent<SlotScript> ().slotNumber = i; Slots.Add (slot); //slot.transform.parent = this.gameObject.transform; slot.transform.SetParent(this.gameObject.transform); slot.transform.localScale = new Vector2(1,1); slot.name = "Slot " + (i); //slot.GetComponent<RectTransform> ().localPosition = new Vector3 (x + k * 80, y - i * 80, 0); } for (int s = 0; s< StorageSlot; s++) { GameObject slot = (GameObject)Instantiate(slots); slot.GetComponent<SlotScript> ().slotNumber = s+((PageCount * ItemPerPage) -StorageSlot); slot.GetComponent<SlotScript> ().StorageSlot =true; Slots.Add (slot); //slot.transform.parent = this.gameObject.transform; slot.transform.SetParent(StorageSwap.gameObject.transform); slot.transform.localScale = new Vector2(1,1); slot.name = "Slot " + (s+((PageCount * ItemPerPage) -StorageSlot)); } //} //if (GameManager.instance.level != 1) { // GameManager.instance.loadInventory (); //} Items [0] = database.items [1]; //Items [1] = new Fairy("test",12,"nope",5,10,true,Item.ItemType.Fairy,11,0,10,10,Fairy.FairyType.Heal,0); //Items [2] = new Fairy("test",12,"nope",0,10,true,Item.ItemType.Fairy,11,4,10,10,Fairy.FairyType.AttackBoost,3); Items [30] = database.items [0]; //for (int t =0; t < 90; t++) //{ // database.items [1]; //} //AddItem(1); Items [61] = database.items [0]; //AddItem(1); //for(int i = 11 ; i <19 ; i++) //{ // AddItem(i); //} //StartCoroutine(CountDown(20)); }
void Start() { player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); inventory = GameObject.FindGameObjectWithTag ("Inventory").GetComponent<Inventory> (); equipList = FindObjectOfType<EquipmentList>(); slotmanger = FindObjectOfType<SlotManger>(); }