Пример #1
0
    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);
    }
Пример #2
0
 public override void Initialize()
 {
     uiManager = new UIManager(game);
     shieldActive = false;
     powerList.Clear();
     InitializeLocations();
     lastLocation = Location.Nolocation;
 }
Пример #3
0
    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;
        }
    }
Пример #4
0
        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;
        }
Пример #5
0
    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);
    }
Пример #6
0
    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);
        }
    }
Пример #7
0
    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);
    }
Пример #8
0
        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());
                }
            }
        }
Пример #9
0
 public void AddLocation(Location l)
 {
     int x = l.X;
     int y = l.Y;
     location[x, y] = l;
 }
Пример #10
0
        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;
            }
        }
Пример #11
0
        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;
            }
        }
Пример #12
0
 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;
 }