Beispiel #1
0
        public void OnEntityInViewRange(ServerDynamicEntity iDynamicEntity)
        {
            var handler = EntityInViewRange;

            if (handler != null)
            {
                handler(this, new ServerDynamicEntityEventArgs {
                    Entity = iDynamicEntity
                });
            }
        }
Beispiel #2
0
        public void AddEntity(ServerDynamicEntity entity)
        {
            if (_entities.TryAdd(entity.GetHashCode(), entity))
            {
                // add events to retranslate
                entity.PositionChanged           += EntityPositionChanged;
                entity.DynamicEntity.ViewChanged += EntityViewChanged;

                OnEntityAdded(new ServerDynamicEntityEventArgs {
                    Entity = entity
                });
            }
            else
            {
                logger.Error("Failed to add entity to the area {0} {1}", entity.DynamicEntity.DynamicId, Position);
            }
        }