Exemplo n.º 1
0
        /// <summary>
        /// Finds exact static entity that links points to
        /// Supports container-in-container extraction
        /// </summary>
        /// <param name="landscapeManager"></param>
        /// <returns></returns>
        public IStaticEntity ResolveStatic(ILandscapeManager landscapeManager)
        {
            if (IsDynamic)
            {
                throw new InvalidOperationException();
            }

            var chunk = landscapeManager.GetChunk(ChunkPosition);

            if (chunk == null)
            {
                return(null);
            }

            var           collection = (IStaticContainer)chunk.Entities;
            IStaticEntity sEntity    = null;

            for (int i = 0; i < Tail.Length; i++)
            {
                if (!collection.ContainsId(Tail[i], out sEntity))
                {
                    return(null);
                }

                if (sEntity is IStaticContainer)
                {
                    collection = sEntity as IStaticContainer;
                }
            }

            return(sEntity);
        }
Exemplo n.º 2
0
        public CubeEmitter(string cubeTexturePath,
                           string fileNamePatern,
                           string biomeColorFilePath,
                           float maximumAge,
                           float size,
                           VisualWorldParameters visualWorldParameters,
                           IWorldChunks worldChunk,
                           ILandscapeManager landscapeManager,
                           double maxRenderingDistance,
                           IWeather weather)
        {
            if (landscapeManager == null)
            {
                throw new ArgumentNullException("landscapeManager");
            }

            _cubeColorSampled      = new Dictionary <int, Color[]>();
            _fileNamePatern        = fileNamePatern;
            _cubeTexturePath       = cubeTexturePath;
            _visualWorldParameters = visualWorldParameters;
            _biomeColorFilePath    = biomeColorFilePath;
            _weather             = weather;
            MaxRenderingDistance = maxRenderingDistance;
            _worldChunk          = worldChunk;
            _landscapeManager    = landscapeManager;
            _isStopped           = false;
            _maximumAge          = maximumAge;
            _particules          = new List <ColoredParticule>();

            _rnd = new FastRandom();

            _cubeBB = new BoundingBox(new Vector3(-size / 2.0f, -size / 2.0f, -size / 2.0f), new Vector3(size / 2.0f, size / 2.0f, size / 2.0f));
        }
Exemplo n.º 3
0
 public BeeBehaviorResolver(IBeeCommon beeCommon, IFlowerManager flowerManager, ILandscapeManager landscapeManager, IInteractionManager interactionManager, IMovementBehaviorCommandInvoker movementBehaviorCommandInvoker, IMovementSelector movementSelector)
 {
     _beeCommon                      = beeCommon;
     _flowerManager                  = flowerManager;
     _landscapeManager               = landscapeManager;
     _interactionManager             = interactionManager;
     _movementBehaviorCommandInvoker = movementBehaviorCommandInvoker;
     _movementSelector               = movementSelector;
 }
Exemplo n.º 4
0
 public WorldMediator(
     IBeeCommon beeCommon,
     IBeeManager beeManager,
     IFlowerManager flowerManager,
     ILandscapeManager landscapeManager,
     IInteractionManager interactionManager)
 {
     _beeCommon          = beeCommon;
     _beeManager         = beeManager;
     _flowerManager      = flowerManager;
     _landscapeManager   = landscapeManager;
     _interactionManager = interactionManager;
 }
Exemplo n.º 5
0
        public PlayerEntityManager(CameraManager <ICameraFocused> cameraManager,
                                   InputsManager inputsManager,
                                   SingleArrayChunkContainer cubesHolder,
                                   ServerComponent server,
                                   VoxelModelManager voxelModelManager,
                                   VisualWorldParameters visualWorldParameters,
                                   EntityFactory factory,
                                   LandscapeBufferManager bufferManager,
                                   ILandscapeManager landscapeManager,
                                   ChatComponent chatComponent,
                                   PostEffectComponent postEffectComponent,
                                   GuiManager guiManager,
                                   ISoundEngine soundEngine,
                                   TimerManager timerManager
                                   )
        {
            _cameraManager         = cameraManager;
            _inputsManager         = inputsManager;
            _soundEngine           = soundEngine;
            _cubesHolder           = cubesHolder;
            _visualWorldParameters = visualWorldParameters;
            _factory             = factory;
            _bufferManager       = bufferManager;
            _landscapeManager    = landscapeManager;
            _chatComponent       = chatComponent;
            _postEffectComponent = postEffectComponent;
            OnLanding           += PlayerEntityManager_OnLanding;
            _guiManager          = guiManager;

            PlayerCharacter = (PlayerCharacter)server.Player;

            ShowDebugInfo = true;

            // Create a visualVoxelEntity (== Assign a voxel body to the PlayerCharacter)
            VisualVoxelEntity = new VisualVoxelEntity(PlayerCharacter, voxelModelManager);

            //Add a new Timer trigger
            _energyUpdateTimer = timerManager.AddTimer(1000); //A timer that will be raised every second
            _energyUpdateTimer.OnTimerRaised += energyUpdateTimer_OnTimerRaised;

            HasMouseFocus = Updatable;
            UpdateOrder   = 0;

            // create "real" random
            var entropySource = RNGCryptoServiceProvider.Create();
            var bytes         = new byte[4];

            entropySource.GetBytes(bytes);
            random = new Random(BitConverter.ToInt32(bytes, 0));
        }
Exemplo n.º 6
0
 public FlowerManager(
     IImageDrawing imageDrawing,
     ILifeFactory lifeFactory,
     ILandscapeManager landscape,
     IFlowerLifeCycle flowerLifeCycle,
     IShapeDrawing shapeDrawing,
     ICommonUtilities utilitiesResolver)
 {
     _imageDrawing      = imageDrawing;
     _flowerLifeCycle   = flowerLifeCycle;
     _lifeFactory       = lifeFactory;
     _landscape         = landscape;
     _shapeDrawing      = shapeDrawing;
     _utilitiesResolver = utilitiesResolver;
 }
Exemplo n.º 7
0
        public UtopiaParticuleEngine(D3DEngine d3dEngine,
                                     SharedFrameCB sharedFrameCB,
                                     CameraManager <ICameraFocused> cameraManager,
                                     InputsManager inputsManager,
                                     VisualWorldParameters worldParameters,
                                     IChunkEntityImpactManager chunkEntityImpactManager,
                                     IWorldChunks worldChunks,
                                     ILandscapeManager landscapeManager,
                                     IWeather weather)
            : base(d3dEngine, sharedFrameCB.CBPerFrame)
        {
            _sharedFrameCB            = sharedFrameCB;
            _cameraManager            = cameraManager;
            _inputsManager            = inputsManager;
            _worldParameters          = worldParameters;
            _chunkEntityImpactManager = chunkEntityImpactManager;
            _worldChunks      = worldChunks;
            _landscapeManager = landscapeManager;
            _weather          = weather;

            _chunkEntityImpactManager.BlockReplaced += _chunkEntityImpactManager_BlockReplaced;

            this.IsDefferedLoadContent = true;
        }
Exemplo n.º 8
0
 /// <summary>
 /// Creates new instance of landscape cursor
 /// </summary>
 /// <param name="manager"></param>
 /// <param name="position"></param>
 /// <param name="wp"> </param>
 public LandscapeCursor(ILandscapeManager manager, Vector3I position, WorldParameters wp)
     : this(manager, wp)
 {
     GlobalPosition = position;
 }
Exemplo n.º 9
0
 protected LandscapeCursor(ILandscapeManager manager, WorldParameters wp)
 {
     _manager = manager;
     _wp      = wp;
 }