当前位置: 首页>>代码示例>>C#>>正文


C# Floor.get_fl_size方法代码示例

本文整理汇总了C#中Floor.get_fl_size方法的典型用法代码示例。如果您正苦于以下问题:C# Floor.get_fl_size方法的具体用法?C# Floor.get_fl_size怎么用?C# Floor.get_fl_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Floor的用法示例。


在下文中一共展示了Floor.get_fl_size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: target_bonespear

        public void target_bonespear(Floor fl, gridCoordinate target_loc, bool spear1)
        {
            c_bspear_target_endp = null;
            c_bspear_target_endp_2 = null;

            int pl_x_dir = 0;
            int pl_y_dir = 0;

            gridCoordinate top_left = my_grid_coords[0];
            gridCoordinate bottom_right = my_grid_coords[3];

            int pl_x_c = target_loc.x;
            int pl_y_c = target_loc.y;

            //Determine X direction
            if (pl_x_c > top_left.x && pl_x_c > bottom_right.x)
                pl_x_dir = 1;
            else if (pl_x_c < top_left.x && pl_x_c < bottom_right.x)
                pl_x_dir = -1;

            //Determine Y direction
            if (pl_y_c > top_left.y && pl_y_c > bottom_right.y)
                pl_y_dir = 1;
            else if (pl_y_c < top_left.y && pl_y_c < bottom_right.y)
                pl_y_dir = -1;

            //Okay so these are the easy ways to do it.
            //If these don't work we get messy.
            //Easy way 1.
            if (pl_x_dir == 0)
            {
                int spear_start_xCoord = 0;
                if (pl_x_c == my_grid_coords[0].x)
                    spear_start_xCoord = my_grid_coords[0].x;
                else
                    spear_start_xCoord = my_grid_coords[1].x;

                if (pl_y_dir == 1)
                {
                    if (spear1)
                    {
                        c_bspear_target_startp = new gridCoordinate(spear_start_xCoord, my_grid_coords[3].y + 1);
                        c_bspear_target_endp = new gridCoordinate(spear_start_xCoord, Math.Min(my_grid_coords[3].y + 6, fl.get_fl_size() - 1));
                    }
                    else
                    {
                        c_bspear_target_startp_2 = new gridCoordinate(spear_start_xCoord, my_grid_coords[3].y + 1);
                        c_bspear_target_endp_2 = new gridCoordinate(spear_start_xCoord, Math.Min(my_grid_coords[3].y + 6, fl.get_fl_size() - 1));
                    }
                }
                else
                {
                    if (spear1)
                    {
                        c_bspear_target_startp = new gridCoordinate(spear_start_xCoord, my_grid_coords[0].y - 1);
                        c_bspear_target_endp = new gridCoordinate(spear_start_xCoord, Math.Max(my_grid_coords[0].y - 6, 0));
                    }
                    else
                    {
                        c_bspear_target_startp_2 = new gridCoordinate(spear_start_xCoord, my_grid_coords[0].y - 1);
                        c_bspear_target_endp_2 = new gridCoordinate(spear_start_xCoord, Math.Max(my_grid_coords[0].y - 6, 0));
                    }
                }
            }
            //Easy way 2.
            if (pl_y_dir == 0)
            {
                int spear_start_yCoord = 0;
                if (pl_y_c == my_grid_coords[0].y)
                    spear_start_yCoord = my_grid_coords[0].y;
                else
                    spear_start_yCoord = my_grid_coords[2].y;

                if (pl_x_dir == 1)
                {
                    if (spear1)
                    {
                        c_bspear_target_startp = new gridCoordinate(my_grid_coords[1].x + 1, spear_start_yCoord);
                        c_bspear_target_endp = new gridCoordinate(Math.Min(my_grid_coords[1].x + 6, fl.get_fl_size() - 1), spear_start_yCoord);
                    }
                    else
                    {
                        c_bspear_target_startp_2 = new gridCoordinate(my_grid_coords[1].x + 1, spear_start_yCoord);
                        c_bspear_target_endp_2 = new gridCoordinate(Math.Min(my_grid_coords[1].x + 6, fl.get_fl_size() - 1), spear_start_yCoord);
                    }
                }
                else
                {
                    if (spear1)
                    {
                        c_bspear_target_startp = new gridCoordinate(my_grid_coords[0].x - 1, spear_start_yCoord);
                        c_bspear_target_endp = new gridCoordinate(Math.Max(my_grid_coords[0].x - 6, 0), spear_start_yCoord);
                    }
                    else
                    {
                        c_bspear_target_startp_2 = new gridCoordinate(my_grid_coords[0].x - 1, spear_start_yCoord);
                        c_bspear_target_endp_2 = new gridCoordinate(Math.Max(my_grid_coords[0].x - 6, 0), spear_start_yCoord);
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:101,代码来源:Boneyard.cs

示例2: bite_alert

 public void bite_alert(Floor fl)
 {
     for (int x = my_grid_coords[0].x - 2; x <= my_grid_coords[1].x + 2; x++)
         for (int y = my_grid_coords[0].y - 2; y <= my_grid_coords[2].y + 2; y++)
         {
             gridCoordinate target_coord = new gridCoordinate(x, y);
             if (x > 0 && x < fl.get_fl_size() &&
                y > 0 && y < fl.get_fl_size() &&
                fl.is_tile_passable(target_coord) &&
                !occupies_tile(target_coord))
                 fl.add_specific_effect(Floor.specific_effect.Alert, new gridCoordinate(x, y));
         }
 }
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:13,代码来源:Boneyard.cs


注:本文中的Floor.get_fl_size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。