Example #1
0
 public override void OnPlayerMoved()
 {
     base.OnPlayerMoved();
     // I auto-move, I HAVE a dir to auto-move, AND I DIDN'T just move?...
     if (DoAutoMove && AutoMoveDir != Vector2Int.zero && PrevMoveDelta == Vector2Int.zero)
     {
         BoardSpace spaceTo = GetSpaceAutoMoveTo();
         bool       doMove  = !spaceTo.HasOccupant;
         doMove &= BoardUtils.MayMoveOccupant(BoardRef, ColRow, AutoMoveDir);
         // We CAN move. Do!
         if (doMove)
         {
             BoardUtils.MoveOccupant(BoardRef, ColRow, AutoMoveDir);
         }
         // We CANNOT move. Zero-out AutoMoveDir.
         else
         {
             AutoMoveDir = Vector2Int.zero;
         }
     }
 }