コード例 #1
0
        /// <summary>
        ///     updates the AgentTiles to find the tile nearest to the Agent at a given time
        /// </summary>
        /// <param name="agentPosition"></param>
        private void UpdateAgentPosition(Transform agentPosition)
        {
            var newAgentTile = GetNearestTile(_agentTiles.ConvertAll(tile => (ITile)tile), agentPosition);

            if (newAgentTile.Coords != _currentSpyTile.Coords)
            {
                _currentSpyTile.OccupiedByAgent = false;
                _currentSpyTile = (ISpyTile)newAgentTile;
                _currentSpyTile.OccupiedByAgent = true;
                _currentSpyTile.VisitCount     += 1;
            }
            else
            {
                _currentSpyTile.VisitCount += 1;
            }
        }
コード例 #2
0
 public SpyAgentTileManager(IAgentTileConverter tileConverter)
 {
     _agentTiles     = tileConverter.GetAgentTiles();
     _currentSpyTile = _agentTiles.First(tile => tile.OccupiedByAgent);
 }