public Engine(IRenderer renderer, IUserKeyboardInput userInput, IAim aim, GameInitializator gameInitializator) { this.Renderer = renderer; this.UserInput = userInput; this.Aim = aim; this.GameInitializator = gameInitializator; random = new Random(); this.gameObjects = new HashSet<GameObject>(); this.farm = new Farm(); this.farmManager = new FarmManager(); this.market = new Market(); this.presentFactory = new PresentFactory(); }
public void AddGameObject(GameObject gameObject, Farm farm, HashSet<GameObject> gameObjects) { if (gameObject == null) { return; } var farmFood = gameObject as FarmFood; if (farmFood != null) { this.farm.FarmFoods.Add(farmFood); } var livestock = gameObject as Livestock; if (livestock != null) { this.farm.Livestocks.Add(livestock); } var villain = gameObject as Villain; if (villain != null) { this.farm.Villains.Add(villain); } var byproduct = gameObject as Byproduct; if (byproduct != null) { this.farm.Byproducts.Add(byproduct); } gameObjects.Add(gameObject); }