Esempio n. 1
0
 public DefaultCreatureActorState([NotNull] IEntityDataFieldContainer entityData,
                                  [NotNull] NetworkEntityGuid entityGuid,
                                  [NotNull] CreatureInstanceModel instanceModel,
                                  [NotNull] CreatureTemplateModel templateModel,
                                  [NotNull] InterestCollection interest)
     : base(entityData, entityGuid, interest)
 {
     InstanceModel = instanceModel ?? throw new ArgumentNullException(nameof(instanceModel));
     TemplateModel = templateModel ?? throw new ArgumentNullException(nameof(templateModel));
 }
Esempio n. 2
0
        protected override void OnEventFired(object source, EntityCreationStartingEventArgs args)
        {
            //Only do creatures.
            if (args.EntityGuid.EntityType != EntityType.Creature)
            {
                return;
            }

            IEntityDataFieldContainer dataContainer = EntityDataMappable.RetrieveEntity(args.EntityGuid);
            CreatureTemplateModel     template      = CreatureTemplateMappable.RetrieveEntity(args.EntityGuid);

            //Initialize the creature display model ID.
            dataContainer.SetFieldValue(BaseObjectField.UNIT_FIELD_DISPLAYID, template.ModelId);
        }
Esempio n. 3
0
        private void CreateActor(WorldActorState state, CreateCreatureEntityActorMessage message)
        {
            //Create the actor and tell it to initialize.
            IActorRef actorRef = state.WorldActorFactory.ActorOf(Resolver.Create <DefaultCreatureEntityActor>(), message.EntityGuid.RawGuidValue.ToString());

            //TODO: Move to factory.
            CreatureInstanceModel instanceModel = CreatureInstanceMappable.RetrieveEntity(message.EntityGuid);
            CreatureTemplateModel templateModel = CreatureTemplateMappable.RetrieveEntity(message.EntityGuid);

            DefaultCreatureEntityActor.InitializeActor(actorRef, new DefaultCreatureActorState(EntityDataMappable.RetrieveEntity(message.EntityGuid), message.EntityGuid, instanceModel, templateModel, InterestMappable.RetrieveEntity(message.EntityGuid)));

            ActorRefMappable.AddObject(message.EntityGuid, actorRef);

            if (Logger.IsInfoEnabled)
            {
                Logger.Info($"Created Creature Actor: {typeof(DefaultCreatureEntityActor)} for Entity: {message.EntityGuid}");
            }
        }