private bool GetNewDirection() { Rotation[] rotations = TrainNetworkRegistry.GetDirections(this); if (rotations.Length == 0) { RotateTrain(); TMConsole.Log("Train turned due to not being able to move further.", this); return(false); } else { Direction = rotations[tempRandom.Next(rotations.Length)]; return(true); } }
private void RenderNetworkOutline(Graphics g, GridObject go, Point p) { Rail rail = go as Rail; if (rail == null) { return; } TrainNetwork network = TrainNetworkRegistry.GetNetworkForRail(rail); if (network == null) { return; } using (Pen pen = new Pen(debugColors[network.ID % debugColors.Length])) { pen.Width = 3; g.DrawRectangle(pen, p.X, p.Y, GlobalVars.GRIDSIZE, GlobalVars.GRIDSIZE); } }