public static bool Tile_Blocked(short Map_Num, short X, short Y, Game.Location Direction, bool ContarPersonagens = true) { short Next_X = X, Next_Y = Y; // Next Tile NextTile(Direction, ref Next_X, ref Next_Y); // Verifica se o Tile está bloqueado if (Tile_Blocked(Map_Num, (byte)Next_X, (byte)Next_Y)) { return(true); } else if (Lists.Map[Map_Num].Tile[Next_X, Next_Y].Block[(byte)Game.InverseDirection(Direction)]) { return(true); } else if (Lists.Map[Map_Num].Tile[X, Y].Block[(byte)Direction]) { return(true); } else if (ContarPersonagens && (ThereIsPlayer(Map_Num, Next_X, Next_Y) > 0 || ThereIsNPC(Map_Num, Next_X, Next_Y) > 0)) { return(true); } return(false); }
public override void Initialize() { uiManager = new UIManager(game); shieldActive = false; powerList.Clear(); InitializeLocations(); lastLocation = Location.Nolocation; }
public static void NextTile(Game.Location Direction, ref short X, ref short Y) { // Next Tile switch (Direction) { case Game.Location.Above: Y -= 1; break; case Game.Location.Below: Y += 1; break; case Game.Location.Right: X += 1; break; case Game.Location.Left: X -= 1; break; } }
public void addPowerUps() { Location randomLocation = locationValues[random.Next(locationValues.Length )]; while (lastLocation == randomLocation) { randomLocation = locationValues[random.Next(locationValues.Length)]; } SelectLocation(randomLocation); PowerUpEnum randomPower = powerUpValues[random.Next(powerUpValues.Length)]; SelectPowerUp(randomPower); lastLocation = randomLocation; }
private static void Player_Direction(byte Index, NetIncomingMessage Data) { Game.Location Direction = (Game.Location)Data.ReadByte(); // Previni erros if (Direction < Game.Location.Above || Direction > Game.Location.Right) { return; } if (Lists.TempPlayer[Index].GettingMap) { return; } // Defini a direção do Player Player.Character(Index).Direction = Direction; Sending.Player_Direction(Index); }
public static void Appearance(byte Index, short Map, byte x, byte y, Game.Location Direction = 0) { Lists.Structures.NPCs Data = Lists.NPC[Lists.Map[Map].NPC[Index].Index]; short[] s = Data.Vital; // Define os Data Lists.Map[Map].Temp_NPC[Index].Index = Lists.Map[Map].NPC[Index].Index; Lists.Map[Map].Temp_NPC[Index].X = x; Lists.Map[Map].Temp_NPC[Index].Y = y; Lists.Map[Map].Temp_NPC[Index].Direction = Direction; Lists.Map[Map].Temp_NPC[Index].Vital = new short[(byte)Game.Vital.Amount]; for (byte i = 0; i <= (byte)Game.Vital.Amount - 1; i++) { Lists.Map[Map].Temp_NPC[Index].Vital[i] = Data.Vital[i]; } // Envia os Data aos jogadores if (Network.Device != null) { Sending.Map_NPC(Map, Index); } }
public static bool Move(short Map_Num, byte Index, Game.Location Direction, byte Movement = 1, bool ContarZona = false) { Lists.Structures.Map_NPCs Data = Lists.Map[Map_Num].Temp_NPC[Index]; byte x = Data.X, y = Data.Y; short Next_X = x, Next_Y = y; // Define a direção do NPC Lists.Map[Map_Num].Temp_NPC[Index].Direction = Direction; Sending.Map_NPC_Direction(Map_Num, Index); // Nextimo azulejo Map.NextTile(Direction, ref Next_X, ref Next_Y); // Nextimo azulejo bloqueado ou fora do limite if (Map.ForaDoLimite(Map_Num, Next_X, Next_Y)) { return(false); } if (Map.Tile_Blocked(Map_Num, x, y, Direction)) { return(false); } // Verifica se está dentro da zona if (ContarZona) { if (Lists.Map[Map_Num].Tile[Next_X, Next_Y].Zone != Lists.Map[Map_Num].NPC[Index].Zone) { return(false); } } // Movimenta o NPC Lists.Map[Map_Num].Temp_NPC[Index].X = (byte)Next_X; Lists.Map[Map_Num].Temp_NPC[Index].Y = (byte)Next_Y; Sending.Map_NPC_Movement(Map_Num, Index, Movement); return(true); }
public void CreateMapField(int x, int y) { Heigth = y; Width = x; location = new Location[x,y]; for (int i = 0; i<x; i++) { for (int j = 0; j<y; j++) { location[i,j] = new Location(i, j, new BasicObject()); } } }
public void AddLocation(Location l) { int x = l.X; int y = l.Y; location[x, y] = l; }
private void SelectMiddleLocation(Location location) { switch (location) { case Location.Left: InitializePowerUps(leftMiddleLocation); break; case Location.Middle: InitializePowerUps(middleLocation); break; case Location.Right: InitializePowerUps(rightMiddleLocation); break; } }
private void SelectLocation(Location location) { Location randomLocation = locationValues[random.Next(locationValues.Length)]; switch (location) { case Location.Left: SelectLeftLocation(randomLocation); break; case Location.Middle: SelectMiddleLocation(randomLocation); break; case Location.Right: SelectRightLocation(randomLocation); break; } }
public static Location LoadLocationFromXml(XmlElement node) { int x = int.Parse(node.Attributes["x"].Value); int y = int.Parse(node.Attributes["y"].Value); bool visible = bool.Parse(node.Attributes["visible"].Value); string script; try { script = node.Attributes["script"].Value; } catch { script = null; } IPlace block = LoadBlockFromXml((XmlElement)node.GetElementsByTagName("block")[0]); Location l = new Location(x, y, block); l.Script = script; l.Visible = visible; return l; }