Beispiel #1
0
        public Landblock(LandblockId id)
        {
            this.id = id;

            // initialize adjacency array
            this.adjacencies.Add(Adjacency.North, null);
            this.adjacencies.Add(Adjacency.NorthEast, null);
            this.adjacencies.Add(Adjacency.East, null);
            this.adjacencies.Add(Adjacency.SouthEast, null);
            this.adjacencies.Add(Adjacency.South, null);
            this.adjacencies.Add(Adjacency.SouthWest, null);
            this.adjacencies.Add(Adjacency.West, null);
            this.adjacencies.Add(Adjacency.NorthWest, null);

            // TODO: Load cell.dat contents
            //   1. landblock cell structure
            //   2. terrain data
            // TODO: Load portal.dat contents (as/if needed)
            // TODO: Load spawn data

            // TODO: load objects from world database such as lifestones, doors, player corpses, NPCs, Vendors
            var objects        = DatabaseManager.World.GetObjectsByLandblock(this.id.Landblock);
            var factoryObjects = GenericObjectFactory.CreateWorldObjects(objects);

            factoryObjects.ForEach(fo => worldObjects.Add(fo.Guid, fo));

            var creatures = DatabaseManager.World.GetCreaturesByLandblock(this.id.Landblock);

            foreach (var c in creatures)
            {
                Creature cwo = new Creature(c);
                worldObjects.Add(cwo.Guid, cwo);
            }
        }
Beispiel #2
0
        void ISerializationCallbackReceiver.OnAfterDeserialize()
        {
            if (string.IsNullOrEmpty(instanceTypeName))
            {
                return;
            }

            instance = GenericObjectFactory.CreateObject(instanceTypeName,
                                                         GlobalInjector.Injector,
                                                         instanceData);
        }
Beispiel #3
0
        public Landblock(LandblockId id)
        {
            this.id = id;

            UpdateStatus(LandBlockStatusFlag.IdleUnloaded);

            // initialize adjacency array
            adjacencies.Add(Adjacency.North, null);
            adjacencies.Add(Adjacency.NorthEast, null);
            adjacencies.Add(Adjacency.East, null);
            adjacencies.Add(Adjacency.SouthEast, null);
            adjacencies.Add(Adjacency.South, null);
            adjacencies.Add(Adjacency.SouthWest, null);
            adjacencies.Add(Adjacency.West, null);
            adjacencies.Add(Adjacency.NorthWest, null);

            UpdateStatus(LandBlockStatusFlag.IdleLoading);

            // TODO: Load cell.dat contents
            //   1. landblock cell structure
            //   2. terrain data
            // TODO: Load portal.dat contents (as/if needed)
            // TODO: Load spawn data

            // TODO: load objects from world database such as lifestones, doors, player corpses, NPCs, Vendors
            var objects        = DatabaseManager.World.GetObjectsByLandblock(this.id.Landblock);
            var factoryObjects = GenericObjectFactory.CreateWorldObjects(objects);

            factoryObjects.ForEach(fo => worldObjects.Add(fo.Guid, fo));

            // Load static creature spawns from DB
            var creatures = DatabaseManager.World.GetCreaturesByLandblock(this.id.Landblock);

            foreach (var c in creatures)
            {
                Creature cwo = new Creature(c);
                worldObjects.Add(cwo.Guid, cwo);
            }

            // Load generator creature spawns from DB
            var creatureGenerators = DatabaseManager.World.GetCreatureGeneratorsByLandblock(this.id.Landblock);

            foreach (var cg in creatureGenerators)
            {
                List <Creature> creatureList = MonsterFactory.SpawnCreaturesFromGenerator(cg);
                foreach (var c in creatureList)
                {
                    worldObjects.Add(c.Guid, c);
                }
            }

            UpdateStatus(LandBlockStatusFlag.IdleLoaded);
        }
Beispiel #4
0
        protected internal Cv_EntityFactory()
        {
            m_Mutex             = new object();
            m_GameComponentInfo = new Dictionary <Cv_ComponentID, XmlElement>();
            ComponentFactory    = new GenericObjectFactory <Cv_EntityComponent, Cv_ComponentID>();

            ComponentFactory.Register <Cv_TransformComponent>(Cv_EntityComponent.GetID <Cv_TransformComponent>());
            ComponentFactory.Register <Cv_SpriteComponent>(Cv_EntityComponent.GetID <Cv_SpriteComponent>());
            ComponentFactory.Register <Cv_CameraComponent>(Cv_EntityComponent.GetID <Cv_CameraComponent>());
            ComponentFactory.Register <Cv_RigidBodyComponent>(Cv_EntityComponent.GetID <Cv_RigidBodyComponent>());
            ComponentFactory.Register <Cv_SoundEmitterComponent>(Cv_EntityComponent.GetID <Cv_SoundEmitterComponent>());
            ComponentFactory.Register <Cv_SoundListenerComponent>(Cv_EntityComponent.GetID <Cv_SoundListenerComponent>());
            ComponentFactory.Register <Cv_ScriptComponent>(Cv_EntityComponent.GetID <Cv_ScriptComponent>());
            ComponentFactory.Register <Cv_ClickableComponent>(Cv_EntityComponent.GetID <Cv_ClickableComponent>());
            ComponentFactory.Register <Cv_TextComponent>(Cv_EntityComponent.GetID <Cv_TextComponent>());
            ComponentFactory.Register <Cv_TransformAnimationComponent>(Cv_EntityComponent.GetID <Cv_TransformAnimationComponent>());
            ComponentFactory.Register <Cv_ParticleEmitterComponent>(Cv_EntityComponent.GetID <Cv_ParticleEmitterComponent>());

            if (!CaravelApp.Instance.EditorRunning)
            {
                RegisterGameComponents();
            }
        }