private void createNewPizza(int pizzaIndex) { PizzaGroup pizzaGroup = pizzaData.PizzaGroup[pizzaIndex]; Position2D pizzaPosition = pizzaData.Position[pizzaIndex]; PostUpdateCommands.CreateEntity(); PostUpdateCommands.AddSharedComponent(new PizzaSpawnData { PizzaGroup = pizzaGroup, Position = pizzaPosition }); }
private void handlePizzaComplete(int pizzaIndex) { Entity pizzaEntity = pizzaData.Entities[pizzaIndex]; PizzaGroup pizzaGroup = pizzaData.PizzaGroup[pizzaIndex]; Position2D pizzaPosition = pizzaData.Position[pizzaIndex]; PizzaCost pizzaCost = pizzaData.PizzaCost[pizzaIndex]; // Pizza is done. Debug.Log("PIZZA DONE - " + pizzaGroup.PizzaId + ": " + pizzaCost.OrderCost + " | " + pizzaCost.ActualCost); // Update global score. PostUpdateCommands.CreateEntity(); PostUpdateCommands.AddComponent(new DeductScore { Value = pizzaCost.ActualCost }); PostUpdateCommands.AddSharedComponent(new ScoringGroup { GroupId = 0 }); // Delete this Pizza. MoveSpeed toWindow = new MoveSpeed { speed = BootStrap.GameSettings.ArrowSpeed }; TimedLife timedLife = new TimedLife { TimeToLive = 10.0f }; PostUpdateCommands.AddComponent(pizzaEntity, toWindow); PostUpdateCommands.AddComponent(pizzaEntity, timedLife); PostUpdateCommands.RemoveComponent <PizzaGroup>(pizzaEntity); // TODO: While ingredients are flying off with the pizza, arrows could hit them. for (int i = 0; i < IngredientData.CalculateLength(); i++) { Entity ingredientEntity = IngredientData.GetEntityArray()[i]; //PostUpdateCommands.AddComponent(ingredientEntity, toWindow); //PostUpdateCommands.AddComponent(ingredientEntity, timedLife); //PostUpdateCommands.RemoveComponent<PizzaGroup>(ingredientEntity); PostUpdateCommands.DestroyEntity(ingredientEntity); } // Create new Pizza. createNewPizza(pizzaIndex); }