Пример #1
0
        protected virtual bool CanIHearATile(Game.GameTile tile)
        {
            if (!tile.IsWithinDistance(this.Location, this.HearingPerceptionDistance))
            {
                return(false);
            }

            //TODO:Can something block sound?

            return(true);
        }
Пример #2
0
        protected virtual bool CanISeeATile(Game.GameTile tile)
        {
            //First check to make sure the tile is within the character's sight distance
            if (!tile.IsWithinDistance(this.Location, this.SightPerceptionDistance))
            {
                return(false);
            }

            //TODO:Check to see if anything is blocking line of sight.

            return(true);
        }
Пример #3
0
 private bool CanISeeHearOrSmellATile(Game.GameTile tile)
 {
     return(CanISeeATile(tile) || CanIHearATile(tile) || CanISmellATile(tile));
 }
Пример #4
0
        public void Move(Guid key, List <Core.GameStateInformation.Directions> movements)
        {
            if (!ConnectedClients.ContainsKey(key))
            {
                return;
            }

            GameplayCommunicationsStore connectedClient = ConnectedClients[key];
            Character playerCharacter = _players.Where(i => i.Id == connectedClient.PlayerCharacterId).First();

            //TODO:Implement movement restrictions here
            //TODO:This is allowing the player to move diagonally through two hexes that are unpassable.
            foreach (Core.GameStateInformation.Directions movementDirection in movements)
            {
                Point newLocation = playerCharacter.Location;
                switch (movementDirection)
                {
                case LegendsOfKesmaiSurvival.Core.GameStateInformation.Directions.North:
                    newLocation = new System.Drawing.Point(playerCharacter.Location.X, playerCharacter.Location.Y - 1);
                    break;

                case LegendsOfKesmaiSurvival.Core.GameStateInformation.Directions.South:
                    newLocation = new System.Drawing.Point(playerCharacter.Location.X, playerCharacter.Location.Y + 1);
                    break;

                case LegendsOfKesmaiSurvival.Core.GameStateInformation.Directions.East:
                    newLocation = new System.Drawing.Point(playerCharacter.Location.X + 1, playerCharacter.Location.Y);
                    break;

                case LegendsOfKesmaiSurvival.Core.GameStateInformation.Directions.West:
                    newLocation = new System.Drawing.Point(playerCharacter.Location.X - 1, playerCharacter.Location.Y);
                    break;

                case LegendsOfKesmaiSurvival.Core.GameStateInformation.Directions.NorthEast:
                    newLocation = new System.Drawing.Point(playerCharacter.Location.X + 1, playerCharacter.Location.Y - 1);
                    break;

                case LegendsOfKesmaiSurvival.Core.GameStateInformation.Directions.NorthWest:
                    newLocation = new System.Drawing.Point(playerCharacter.Location.X - 1, playerCharacter.Location.Y - 1);
                    break;

                case LegendsOfKesmaiSurvival.Core.GameStateInformation.Directions.SouthEast:
                    newLocation = new System.Drawing.Point(playerCharacter.Location.X + 1, playerCharacter.Location.Y + 1);
                    break;

                case LegendsOfKesmaiSurvival.Core.GameStateInformation.Directions.SouthWest:
                    newLocation = new System.Drawing.Point(playerCharacter.Location.X - 1, playerCharacter.Location.Y + 1);
                    break;
                }

                //Get the tile that the player is trying to move to
                Game.GameTile newTile = _game.GameMap.GetTileFromLocation(newLocation.X, newLocation.Y);

                //Do not let the player move to a tile that is not accessible
                if (newTile.IsPassable)
                {
                    playerCharacter.Location = newLocation;
                }
            }

            //TODO:Only need to update the game states of clients that would be affected by the player moving in or into the viewable area
            foreach (Guid clientKey in ConnectedClients.Keys)
            {
                UpdateGameState(clientKey);
            }
        }