示例#1
0
文件: Panel.cs 项目: baguio/SSC-AI
 private Panel (
     Position position,
     PanelDirectionX direction_x, PanelDirectionY direction_y,
     bool playable, int player_index,
     int index_x, int index_y, int index, int index_playable
 ) {
     this.position = position;
     this.direction_x = direction_x;
     this.direction_y = direction_y;
     this.playable = playable;
     this.player_index = player_index;
     this.index_x = index_x;
     this.index_y = index_y;
     this.index = index;
     this.index_playable = index_playable;
 }
示例#2
0
文件: Panel.cs 项目: baguio/SSC-AI
 private static void InitPanels () {
     int playable_count = 0;
     for (int x = 0; x < COUNT_X; ++x) {
         for (int y = 0; y < COUNT_Y; ++y) {
             Position position = new Position(
                 START_X + DELTA_X * x,
                 START_Y + DELTA_Y * y
             );
             PanelDirectionX direction_x = (PanelDirectionX)(x % 3);
             PanelDirectionY direction_y = (PanelDirectionY)y;
             bool playable = (
                 (direction_x == PanelDirectionX.Center) ==
                 (direction_y == PanelDirectionY.Center)
             );
             int player_index = (x < COUNT_X / 2) ? 0 : 1;
             int index = x + (y * COUNT_X);
             int index_playable = playable ?
                 (playable_count++) : -1;
             #region Hard Coded Hack
             if (index_playable == 3) {
                 index_playable = 4;
             } else if (index_playable == 4) {
                 index_playable = 3;
             } else if (index_playable == 8) {
                 index_playable = 9;
             } else if (index_playable == 9) {
                 index_playable = 8;
             }
             #endregion
             Panel panel = new Panel(
                 position,
                 direction_x,
                 direction_y,
                 playable,
                 player_index,
                 x, y,
                 index,
                 index_playable
             );
             Panels[x, y] = panel;
             Panels_1D[index] = panel;
             if (playable) {
                 Panels_1D_Playable[index_playable] = panel;
             }
         }
     }
 }
示例#3
0
文件: Position.cs 项目: baguio/SSC-AI
 public Vector vectorTo (Position other) {
     float dx = other.x - x;
     float dy = other.y - y;
     return new Vector(dx, dy);
 }
示例#4
0
文件: Position.cs 项目: baguio/SSC-AI
 public float distanceTo (Position other) {
     float dx = other.x - x;
     float dy = other.y - y;
     return (float)Math.Sqrt(dx * dx + dy * dy);
 }