public void SyncPizza(GameObject pizza) { List <string> names = new List <string> (); for (int i = 0; i < pizza.transform.childCount; i++) { names.Add(pizza.transform.GetChild(i).name); } foreach (ObjType type in wantedTypes) { if (type == ObjType.CHICKEN && !names.Contains("CHICKEN")) { return; } if (type == ObjType.HAM && !names.Contains("HAM")) { return; } if (type == ObjType.MUSHROOM && !names.Contains("MUSHROOM")) { return; } } MainSceneData.GetInstance().pizzaComponents[x].DeleteObservator(this); GameObject.Destroy(pizza); //SETTING NULL ON UserInputComponent GameObject.FindObjectOfType <UserInputComponent> ().SetPizza(x, null); command.GoOff(); }
public void Init(int x, ICommand _command) { client = new Client(_command, x); client.ChooseRandomPizza(pizzaTransform.position, this.gameObject); ((MainSceneData)MainSceneData.GetInstance()).pizzaComponents [x].AddObservator(client); }
void Start() { userInput = new UserInput(MainSceneData.GetInstance().userTableTransform.position + new Vector3(0f, 0f, -5f), MainSceneData.GetInstance().pizzaComponents ); }