public void OnFixtureCreated(Fixture fixt) { GameObject fixtGo = new GameObject(); FixtureGameObjectMap.Add(fixt, fixtGo); fixtGo.name = fixt.FixtureType + "_" + fixt.Tile.X + "," + fixt.Tile.Y; fixtGo.transform.position = new Vector3(fixt.Tile.X + ((fixt.Width - 1) / 2f), fixt.Tile.Y + ((fixt.Height - 1) / 2f), 0); fixtGo.transform.SetParent(this.transform, true); fixtGo.AddComponent <SpriteRenderer>().sprite = GetSpriteForFixture(fixt); if (fixt.FixtureType == Words.Current.Bench) { fixtGo.GetComponent <SpriteRenderer>().sortingLayerName = Words.Current.TileLayer; } else { fixtGo.GetComponent <SpriteRenderer>().sortingLayerName = Words.Current.FixtureLayer; } fixt.AddAFixtureChangedCallback(OnFixtureChanged); fixt.AddCustomerOpinionCallback(OnCustomerOpinionChanged); if (fixt.MaxShelfSpace > 0) { GameObject ui_go = Instantiate(InventoryStackSizePrefab); ui_go.transform.SetParent(fixtGo.transform); ui_go.name = "StockLevel"; if (fixt.EmployeeDirection == Direction.Up) { ui_go.transform.localPosition = new Vector3(0.5F, 0.35F, 0); } else if (fixt.EmployeeDirection == Direction.Down) { ui_go.transform.localPosition = new Vector3(0.5F, -0.35F, 0); } else if (fixt.EmployeeDirection == Direction.Left) { ui_go.transform.localPosition = new Vector3(0.75F, 0, 0); } else { ui_go.transform.localPosition = new Vector3(0.2F, 0, 0); } if (fixt.GetItemsOnShelf().Count == 0) { ui_go.GetComponentInChildren <Text>().text = "!"; } else { ui_go.GetComponentInChildren <Text>().text = fixt.GetItemsOnShelf().Count.ToString(); } CheckTextColour(ui_go.GetComponentInChildren <Text>(), fixt.GetPercentageFull()); } if (fixt.GetItemsOnShelf().Count > 0 && (fixt.FixtureType == Words.Current.ShelfDown || fixt.FixtureType == Words.Current.FridgeDown || fixt.FixtureType == Words.Current.ShelfWall)) { float x = -0.36f; float y = -0.375f; foreach (Item i in fixt.GetItemsOnShelf()) { if (ItemGameObjectMap.ContainsKey(i.Name)) { GameObject item_go = Instantiate(ItemGameObjectMap[i.Name]); item_go.GetComponent <SpriteRenderer>().sortingLayerName = "Item"; item_go.transform.SetParent(fixtGo.transform); item_go.transform.localPosition = new Vector3(x, y, 0); x += 0.135f; if (x >= 0.4f) { x = -0.36f; y += 0.175f; } if (y > 0.15f) { y = -0.375f; } } } } else if (fixt.FixtureType == Words.Current.Checkout) { GameObject ui_go = Instantiate(InventoryStackSizePrefab); ui_go.transform.SetParent(fixtGo.transform); ui_go.transform.localPosition = new Vector3(0.8F, -0.5F, 0); ui_go.GetComponentInChildren <Text>().text = World.Current.PeopleInQueue.ToString(); ui_go.GetComponentInChildren <Text>().color = new Color(0f, 0f, 0f, 1f); } }