void Start() { buttons = new List<GameObject>(); panelImageScript = panel.GetComponent<Image>(); biographyImageScript = GameObject.Find("Biography").GetComponent<Image>(); triggerSquareBoundary = 5; changeInventoryIcons = false; inventoryDisplayStates = InventoryDisplayStates.NoInventory; buttonStates = ButtonStates.Create; torsoItems = new string[] { "Blouse", "Jacket", "Shirt", "Tank" }; legsItems = new string[] { "Miniskirt", "Shorts", "Pants", "Dress" }; }
void OnTriggerEnter(Collider other) { modelCollider = other; if (other.tag == "models") { panelImageScript.color = Color.white; if (inventoryDisplayStates == InventoryDisplayStates.NoInventory) { SpawnButtons(); inventoryDisplayStates = InventoryDisplayStates.InventoryTorsoSpawning; } if (inventoryDisplayStates == InventoryDisplayStates.InventoryTorsoSpawning) { for (int i = 0; i < buttons.Count; i++) { buttons[i].GetComponent<Image>().sprite = Resources.Load<Sprite>("Sprites/TorsoItems/" + torsoItems[i]); } inventoryDisplayStates = InventoryDisplayStates.InventoryTorsoSpawningDone; } } if(other.name == "Jenni") { biographyImageScript.sprite= Resources.Load<Sprite>("Biography/biographs/bio1"); biographyImageScript.color = Color.white; } else if(other.name == "Andrew") { biographyImageScript.sprite = Resources.Load<Sprite>("Biography/biographs/bio2"); biographyImageScript.color = Color.white; } else if (other.name == "Melissa") { biographyImageScript.sprite = Resources.Load<Sprite>("Biography/biographs/bio3"); biographyImageScript.color = Color.white; } else if (other.name == "Julian") { biographyImageScript.sprite = Resources.Load<Sprite>("Biography/biographs/bio4"); biographyImageScript.color = Color.white; } }
void Update() { if (changeInventoryIcons && inventoryDisplayStates == InventoryDisplayStates.InventoryLegsSpawning) { for (int i = 0; i < buttons.Count; i++) { buttons[i].GetComponent<Image>().sprite = Resources.Load<Sprite>("Sprites/LegsItems/" + legsItems[i]); } inventoryDisplayStates = InventoryDisplayStates.InventoryLegsSpawningDone; changeInventoryIcons = false; } if (buttonStates == ButtonStates.Delete) { biographyImageScript.color = Color.clear; panelImageScript.color = Color.clear; changeInventoryIcons = false; inventoryDisplayStates = InventoryDisplayStates.NoInventory; buttonStates = ButtonStates.Create; DestroyButtons(); } }
//void OnTriggerExit(Collider other) //{ // if (other.tag == "models") // { // biographyImageScript.color = Color.clear; // panelImageScript.color = Color.clear; // changeInventoryIcons = false; // inventoryDisplayStates = InventoryDisplayStates.NoInventory; // buttonStates = ButtonStates.Create; // DestroyButtons(); // } //} public void clearDisplay() { biographyImageScript.color = Color.clear; panelImageScript.color = Color.clear; changeInventoryIcons = false; inventoryDisplayStates = InventoryDisplayStates.NoInventory; buttonStates = ButtonStates.Create; DestroyButtons(); }