public override void DoInit() { var sPoint = ScreenCell2D.GetMaxPoint(); playerPoint.XPos = sPoint.XPos / 2; playerPoint.YPos = sPoint.YPos / 2; }
virtual public void OnMove() { if (this.playerName == Characters.CHAR_PLAYER) { User.MoveRequest req = User.GetMoveRequest(); switch (req) { case User.MoveRequest.Left: playerPoint.XPos -= 1; break; case User.MoveRequest.Right: playerPoint.XPos += 1; break; case User.MoveRequest.Up: playerPoint.YPos -= 1; break; case User.MoveRequest.Down: playerPoint.YPos += 1; break; } if (ScreenCell2D.IsOnScreen(this.playerPoint) == false) { state = ObjectStatus.ActiveState.Dead; } } }
public bool Next(ObjectStatus.RelativeSpeed speed, out ScreenCell2D next) { next = this.here; if (next.Equals(there)) { return(true); } course.XPos = this.there.XPos - this.here.XPos; course.YPos = this.there.YPos - this.here.YPos; switch (rnd.Next(1, 3)) { case 1: next.XPos = Inc(speed, course.XPos, next.XPos); break; case 2: next.YPos = Inc(speed, course.YPos, next.YPos); break; case 3: next.XPos = Inc(speed, course.XPos, next.XPos); next.YPos = Inc(speed, course.YPos, next.YPos); break; } return(false); }
virtual public void OnDraw() { if (ScreenCell2D.IsOnScreen(this.playerPoint) == true) { Console.SetCursorPosition(playerPoint.XPos, playerPoint.YPos); Console.Write(playerName); } }
public bool PlotCourse(ScreenCell2D here, ScreenCell2D there) { this.calc.Plot(here, there); return(true); }
public bool GoTo(ScreenCell2D loc) { this.playerPoint.XPos = loc.XPos; this.playerPoint.YPos = loc.YPos; return(true); }
public void Plot(ScreenCell2D here, ScreenCell2D there) { this.here = new ScreenCell2D(here); this.there = new ScreenCell2D(there); }