本文整理汇总了C#中Floor.isWalkable方法的典型用法代码示例。如果您正苦于以下问题:C# Floor.isWalkable方法的具体用法?C# Floor.isWalkable怎么用?C# Floor.isWalkable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor.isWalkable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: charge_attack
public void charge_attack(Floor fl, Weapon lance, gridCoordinate charge_coordinate, int monsterID, int DoodadID)
{
bool attacked_Doodad = false;
bool rolled_max = false;
gridCoordinate my_original_position = new gridCoordinate(my_grid_coord);
Weapon c_lance = lance;
VisionRay attack_ray = null;
if(fl.badguy_by_monster_id(monsterID) == null)
{
attack_ray = new VisionRay(my_grid_coord, fl.Doodad_by_index(DoodadID).get_g_coord());
}
else
attack_ray = new VisionRay(my_grid_coord, charge_coordinate);
gridCoordinate monster_coord = new gridCoordinate(-1, -1);
gridCoordinate Doodad_coord = new gridCoordinate(-1, -1);
bool done = false;
while (!done)
{
int old_xPosition = (int)attack_ray.my_current_position.X / 32;
int old_yPosition = (int)attack_ray.my_current_position.Y / 32;
gridCoordinate previous_ray_position = new gridCoordinate(old_xPosition, old_yPosition);
attack_ray.update();
int new_xPosition = (int)attack_ray.my_current_position.X / 32;
int new_yPosition = (int)attack_ray.my_current_position.Y / 32;
gridCoordinate next_ray_position = new gridCoordinate(new_xPosition, new_yPosition);
int mon_ID;
int dood_ID;
fl.is_monster_here(next_ray_position, out mon_ID);
fl.is_destroyable_Doodad_here(next_ray_position, out dood_ID);
if (mon_ID == monsterID && monsterID > -1)
{
monster_coord = new gridCoordinate(charge_coordinate);
teleport(previous_ray_position);
attack_monster_in_grid(fl, lance, monsterID, charge_coordinate, 1.0, out rolled_max, true);
done = true;
}
if (dood_ID == DoodadID && DoodadID > -1)
{
attacked_Doodad = true;
Doodad_coord = new gridCoordinate(fl.Doodad_by_index(DoodadID).get_g_coord());
teleport(previous_ray_position);
attack_Doodad_in_grid(fl, lance, DoodadID, fl.Doodad_by_index(DoodadID).get_g_coord(), 1.0, out rolled_max, true);
done = true;
}
}
gridCoordinate opposition_coord = new gridCoordinate(-1, -1);
if (attacked_Doodad)
opposition_coord = Doodad_coord;
else
opposition_coord = monster_coord;
if (!is_spot_free(fl, my_grid_coord))
{
int xdif = my_original_position.x - opposition_coord.x;
int ydif = my_original_position.y - opposition_coord.y;
int whocares = -1;
if (fl.is_monster_here(my_grid_coord, out whocares) || fl.is_destroyable_Doodad_here(my_grid_coord, out whocares))
{
if (xdif == 0)
if (my_original_position.x < my_grid_coord.x)
my_grid_coord.x--;
else
my_grid_coord.x++;
if (ydif == 0)
if (my_original_position.y < my_grid_coord.y)
my_grid_coord.y--;
else
my_grid_coord.y++;
}
else if (!fl.is_monster_here(my_grid_coord, out whocares) && !fl.isWalkable(my_grid_coord))
{
int xshift = 0;
int yshift = 0;
if (xdif < 0)
xshift = -1;
else
xshift = 1;
if (ydif < 0)
yshift = -1;
else
yshift = 1;
gridCoordinate x_shifted = new gridCoordinate(my_grid_coord.x + xshift, my_grid_coord.y);
gridCoordinate y_shifted = new gridCoordinate(my_grid_coord.x, my_grid_coord.y + yshift);
bool x_ok = fl.isWalkable(x_shifted);
bool y_ok = fl.isWalkable(y_shifted);
//.........这里部分代码省略.........
示例2: whirlwind_attack
public void whirlwind_attack(Floor fl, Weapon target_weapon)
{
bool rolled_max = false;
List<gridCoordinate> target_coordinates = new List<gridCoordinate>();
for (int x = my_grid_coord.x - 1; x <= my_grid_coord.x + 1; x++)
for (int y = my_grid_coord.y - 1; y <= my_grid_coord.y + 1; y++)
if(!(x== my_grid_coord.x && y== my_grid_coord.y))
target_coordinates.Add(new gridCoordinate(x, y));
int monster_ID = -1;
int Doodad_ID = -1;
for (int i = 0; i < target_coordinates.Count; i++)
{
double multiplier = 1.3;
if (target_weapon.get_hand_count() == 2)
multiplier = 1.6;
if (fl.is_monster_here(target_coordinates[i], out monster_ID))
attack_monster_in_grid(fl, target_weapon, monster_ID, target_coordinates[i], multiplier, out rolled_max);
if (fl.is_destroyable_Doodad_here(target_coordinates[i], out Doodad_ID))
attack_Doodad_in_grid(fl, target_weapon, Doodad_ID, target_coordinates[i], multiplier, out rolled_max);
if (fl.isWalkable(target_coordinates[i]))
fl.add_effect(target_weapon.get_my_damage_type(), target_coordinates[i]);
}
target_weapon.set_cooldown(standard_wpn_cooldown);
if (my_class == Chara_Class.Warrior)
{
c_energy += 5 + rGen.Next(2);
if (rolled_max)
c_energy++;
}
}
示例3: return_axe_patterns
public List<gridCoordinate> return_axe_patterns(gridCoordinate pl_gc, gridCoordinate monster_gc, List<gridCoordinate> coord_list, Floor fl)
{
int x_difference = monster_gc.x - pl_gc.x;
int y_difference = monster_gc.y - pl_gc.y;
List<gridCoordinate> temporary_list = new List<gridCoordinate>();
if (x_difference == -1)
{
if (y_difference == -1)
{
temporary_list.Add(new gridCoordinate(monster_gc.x + 1, monster_gc.y));
temporary_list.Add(new gridCoordinate(monster_gc.x, monster_gc.y + 1));
}
else if (y_difference == 0)
{
temporary_list.Add(new gridCoordinate(monster_gc.x, monster_gc.y - 1));
temporary_list.Add(new gridCoordinate(monster_gc.x, monster_gc.y + 1));
}
else if (y_difference == 1)
{
temporary_list.Add(new gridCoordinate(monster_gc.x + 1, monster_gc.y));
temporary_list.Add(new gridCoordinate(monster_gc.x, monster_gc.y - 1));
}
}
else if (x_difference == 1)
{
if (y_difference == 1)
{
temporary_list.Add(new gridCoordinate(monster_gc.x - 1, monster_gc.y));
temporary_list.Add(new gridCoordinate(monster_gc.x, monster_gc.y - 1));
}
else if (y_difference == 0)
{
temporary_list.Add(new gridCoordinate(monster_gc.x, monster_gc.y - 1));
temporary_list.Add(new gridCoordinate(monster_gc.x, monster_gc.y + 1));
}
if (y_difference == -1)
{
temporary_list.Add(new gridCoordinate(monster_gc.x - 1, monster_gc.y));
temporary_list.Add(new gridCoordinate(monster_gc.x, monster_gc.y + 1));
}
}
else if (x_difference == 0)
{
temporary_list.Add(new gridCoordinate(monster_gc.x - 1, monster_gc.y));
temporary_list.Add(new gridCoordinate(monster_gc.x + 1, monster_gc.y));
}
for (int i = 0; i < temporary_list.Count; i++)
{
if(fl.isWalkable(temporary_list[i]))
coord_list.Add(new gridCoordinate(temporary_list[i]));
}
coord_list.Add(new gridCoordinate(monster_gc));
return coord_list;
}
示例4: set_charge_attack_aura
public void set_charge_attack_aura(Floor fl, int lanceID, gridCoordinate pl_gc)
{
Weapon c_lance = null;
for (int i = 0; i < inventory.Count; i++)
{
if (inventory[i].get_my_IDno() == lanceID)
c_lance = (Weapon)inventory[i];
}
int lance_range = c_lance.get_my_range();
List<gridCoordinate> endPoints = calculate_endpoints(pl_gc, lance_range);
List<VisionRay> charge_rays = new List<VisionRay>();
for (int i = 0; i < endPoints.Count; i++)
{
charge_rays.Add(new VisionRay(pl_gc, endPoints[i]));
}
int monsterID = -1;
while (charge_rays.Count > 0)
{
for (int i = 0; i < charge_rays.Count; i++)
{
bool remove = false;
int whoCares = -1;
charge_rays[i].update();
gridCoordinate current_ray_position = new gridCoordinate((int)charge_rays[i].my_current_position.X / 32, (int)charge_rays[i].my_current_position.Y / 32);
int x_difference = positive_difference(pl_gc.x, current_ray_position.x);
int y_difference = positive_difference(pl_gc.y, current_ray_position.y);
if (fl.isWalkable(current_ray_position) && (x_difference > 1 || y_difference > 1))
fl.set_tile_aura(current_ray_position, Tile.Aura.Attack);
if (!fl.isWalkable(current_ray_position) && (x_difference > 1 || y_difference > 1) &&
fl.is_destroyable_Doodad_here(current_ray_position, out whoCares))
fl.set_tile_aura(current_ray_position, Tile.Aura.Attack);
if (!fl.isWalkable(current_ray_position) || fl.is_monster_here(current_ray_position, out monsterID))
remove = true;
if (charge_rays[i].is_at_end() || remove)
charge_rays.RemoveAt(i);
}
}
}
示例5: is_spot_free
//Bool returns - gets whether there's a monster on your current grid coordinate.
//Or whether the spot is free, or if you're alive, OR if that spot is an exit.
//Green text. Function here.
public bool is_spot_free(Floor fl, gridCoordinate test_coord)
{
int whoCares;
return (fl.isWalkable(test_coord) && !fl.is_monster_here(test_coord, out whoCares));
}