public void ShowHorsemanDock(Horseman context, GamePlayer player) { if (_currentDock != null) _currentDock.Hide(); _horsemanDock.UpdateContext(context, player); _currentDock = _horsemanDock; _currentDock.Show(); }
public GamePlayer(GameWorld gameWorldRef) { _gameWorldRef = gameWorldRef; People = new List<CreatureBase>(); Buildings = new List<BuildingBase>(); BuildingBase building3 = new ResidentialHouse(gameWorldRef, this, new Point(15, 20)); BuildingBase building6 = new ResidentialHouse(gameWorldRef, this, new Point(6, 20)); BuildingBase building4 = new TrainingCamp(gameWorldRef, this, new Point(10, 16)); BuildingBase building1 = new TrainingCamp(gameWorldRef, this, new Point(30, 30)); BuildingBase building5 = new Stable(gameWorldRef, this, new Point(14, 35)); Buildings.Add(building6); Buildings.Add(building4); Buildings.Add(building5); Buildings.Add(building1); Buildings.Add(building3); Farms = new List<Farm>(); Farms.Add(new Farm("farm1", gameWorldRef, this, new Point(4, 28))); Farms.Add(new Farm("farm1", gameWorldRef, this, new Point(6, 32))); Farms.Add(new Farm("farm1", gameWorldRef, this, new Point(10, 32))); Farms.Add(new Farm("farm1", gameWorldRef, this, new Point(12, 28))); //TODO: create player presets instead of following CreatureBase human1 = new Swordsman(gameWorldRef, this, new Vector2(300, 400)); CreatureBase human2 = new Horseman(gameWorldRef, this, new Vector2(350, 400)); CreatureBase human3 = new Farmer(gameWorldRef, this, new Vector2(300, 460)); CreatureBase human4 = new Knight(gameWorldRef, this, new Vector2(350, 460)); People.Add(human1); People.Add(human4); People.Add(human3); People.Add(human2); }
void createHorsemanBtn_Click(object sender, System.EventArgs e) { Vector2 loc = Context.NextBuiltUnitLocation; Vector2 modifiedLoc = new Vector2(loc.X, loc.Y + 20); Horseman hm = new Horseman(Context.GameWorldRef, Context.PlayerRef, modifiedLoc ); hm.CurrentAnimation = Context.NextIdleAnimation; Context.PlayerRef.People.Add(hm); }
/// <summary> /// updates the data source and command operator /// </summary> /// <param name="context"></param> /// <param name="player"></param> public virtual void UpdateContext(Horseman context, GamePlayer player) { Context = context; Player = player; UpdateDisplayText(); }