示例#1
0
        public override void DoInit()
        {
            var sPoint = ScreenCell2D.GetMaxPoint();

            playerPoint.XPos = sPoint.XPos / 2;
            playerPoint.YPos = sPoint.YPos / 2;
        }
示例#2
0
        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;
                }
            }
        }
示例#3
0
        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);
        }
示例#4
0
 virtual public void OnDraw()
 {
     if (ScreenCell2D.IsOnScreen(this.playerPoint) == true)
     {
         Console.SetCursorPosition(playerPoint.XPos, playerPoint.YPos);
         Console.Write(playerName);
     }
 }
示例#5
0
 public bool PlotCourse(ScreenCell2D here, ScreenCell2D there)
 {
     this.calc.Plot(here, there);
     return(true);
 }
示例#6
0
 public bool GoTo(ScreenCell2D loc)
 {
     this.playerPoint.XPos = loc.XPos;
     this.playerPoint.YPos = loc.YPos;
     return(true);
 }
示例#7
0
 public void Plot(ScreenCell2D here, ScreenCell2D there)
 {
     this.here  = new ScreenCell2D(here);
     this.there = new ScreenCell2D(there);
 }