public override bool canMove() { if (location is WaterQuay) { if (isLoaded) { return(true); } return(false); } else { WaterLink nextWaterLink = (WaterLink)location.Next; if (nextWaterLink == null) { location.Occupant = null; this.location = null; return(false); } if (nextWaterLink.Occupant == null) { return(true); } return(false); } }
public override void Move() { if (canMove()) { location.Occupant = null; this.location = (WaterLink)location.Next; location.Occupant = this; } }
public Board(int score, Track TrackEnd, List <Hangar> hangars, Dictionary <char, Turnout> turnouts, WaterQuay quay, HasNext[][] GameBoard, WaterLink first) { Score = score; this.quay = quay; this.TrackEnd = TrackEnd; Hangars = hangars; Turnouts = turnouts; random = new Random(); Carts = new List <Cart>(); Ships = new List <Ship>(); FirstRiver = first; FirstRiver.Occupant = new Ship(FirstRiver); Ships.Add(FirstRiver.Occupant); _GameBoard = GameBoard; foreach (var t in turnouts) { for (int i = random.Next(1, 3); i >= 0; i--) { t.Value.ChangeDirection(); } } }
// private bool isDocked; public Ship(WaterLink locate) { location = locate; load = 0; }