Beispiel #1
0
 public virtual RoboAction OnRobotStay(ActionPhase actionPhase, RoboAction action, RoboPosition position)
 {
     return(null);
 }
Beispiel #2
0
 public virtual RoboAction OnRobotEnter(ActionPhase actionPhase, RoboMovement movement, RoboPosition position)
 {
     return(null);
 }
Beispiel #3
0
 /// <summary>
 /// Main function for handling robot action - splits behavior in enter (move in), rotation and stay to ease up programming...
 /// </summary>
 /// <param name="actionPhase">
 /// A <see cref="ActionPhase"/>
 /// </param>
 /// <param name="action">
 /// A <see cref="RoboAction"/>
 /// </param>
 /// <param name="position">
 /// A <see cref="RoboPosition"/>
 /// </param>
 /// <returns>
 /// A <see cref="RoboAction"/>
 /// </returns>
 public virtual RoboAction OnRobotAction(ActionPhase actionPhase, RoboAction action, RoboPosition position)
 {
     if (position.IsDead)
     {
         return(null);
     }
     if (action is RoboMovement)
     {
         return(OnRobotEnter(actionPhase, action as RoboMovement, position));
     }
     if (action is RoboRotation)
     {
         return(OnRobotRotate(actionPhase, action as RoboRotation, position));
     }
     return(OnRobotStay(actionPhase, action, position));
 }
Beispiel #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public RoboPlayer()
 {
     Cards    = new RoboCard[8];
     Position = new RoboPosition(0, 0, Direction.Up);
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="position">Position-template.</param>
 public RoboPosition(RoboPosition position) : this(position.X, position.Y, position.Direction, position.IsDead)
 {
 }
        public override bool Equals(object obj)
        {
            RoboPosition pos = obj as RoboPosition;

            return(pos != null && pos.X == this.X && pos.Y == this.Y && pos.Direction == this.Direction && pos.IsDead == this.IsDead);
        }
Beispiel #7
0
 public string ToString(RoboPosition position)
 {
     return(ToString(position, true));
 }