コード例 #1
0
        private IEntityActorStateInitializeMessage <DefaultGameObjectActorState> CreateDefaultInitializationState(NetworkEntityGuid entityGuid)
        {
            GameObjectTemplateModel templateModel = GameObjectDataContainer.GameObjectTemplateMappable.RetrieveEntity(entityGuid);
            GameObjectInstanceModel instanceModel = GameObjectDataContainer.GameObjectInstanceMappable.RetrieveEntity(entityGuid);

            return(new EntityActorStateInitializeMessage <DefaultGameObjectActorState>(new DefaultGameObjectActorState(EntityDataMappable.RetrieveEntity(entityGuid), entityGuid, instanceModel, templateModel, InterestMappable.RetrieveEntity(entityGuid))));
        }
コード例 #2
0
        private EntityActorStateInitializeMessage <BehaviourGameObjectState <TBehaviourType> > CreateState <TBehaviourType>(NetworkEntityGuid entityGuid)
            where TBehaviourType : class, IGameObjectLinkable
        {
            GameObjectTemplateModel templateModel = GameObjectDataContainer.GameObjectTemplateMappable.RetrieveEntity(entityGuid);
            GameObjectInstanceModel instanceModel = GameObjectDataContainer.GameObjectInstanceMappable.RetrieveEntity(entityGuid);

            return(new EntityActorStateInitializeMessage <BehaviourGameObjectState <TBehaviourType> >(new BehaviourGameObjectState <TBehaviourType>(EntityDataMappable.RetrieveEntity(entityGuid), entityGuid, instanceModel, templateModel, GameObjectDataContainer.GetBehaviourInstanceData <TBehaviourType>(entityGuid), InterestMappable.RetrieveEntity(entityGuid))));
        }
コード例 #3
0
        protected override void OnEntityCreationFinished(EntityCreationFinishedEventArgs args)
        {
            IEntityDataFieldContainer entityData          = EntityDataMappable.RetrieveEntity(args.EntityGuid);
            GameObjectTemplateModel   objectTemplateModel = GameObjectTemplateMappable.RetrieveEntity(args.EntityGuid);

            //We should generally consider this field static. I cannot even IMAGINE how we'd handle a change to this field on either
            //client or server.
            entityData.SetFieldValue(GameObjectField.GAMEOBJECT_TYPE_ID, (int)objectTemplateModel.ObjectType);
        }
コード例 #4
0
 public DefaultGameObjectActorState([NotNull] IEntityDataFieldContainer entityData,
                                    [NotNull] NetworkEntityGuid entityGuid,
                                    [NotNull] GameObjectInstanceModel instanceModel,
                                    [NotNull] GameObjectTemplateModel templateModel,
                                    [NotNull] InterestCollection interest)
     : base(entityData, entityGuid, interest)
 {
     InstanceModel = instanceModel ?? throw new ArgumentNullException(nameof(instanceModel));
     TemplateModel = templateModel ?? throw new ArgumentNullException(nameof(templateModel));
 }
コード例 #5
0
        public EntityActorCreationResult Create([NotNull] NetworkEntityGuid context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            GameObjectTemplateModel templateModel = GameObjectDataContainer.GameObjectTemplateMappable.RetrieveEntity(context);

            Type behaviourType = ComputeExpectedActorType(templateModel.ObjectType);

            return(new EntityActorCreationResult(behaviourType, CreateInitialState(context, templateModel.ObjectType)));
        }
コード例 #6
0
        protected override void OnEventFired(object source, EntityCreationStartingEventArgs args)
        {
            //Only do creatures.
            if (args.EntityGuid.EntityType != EntityType.GameObject)
            {
                return;
            }

            IEntityDataFieldContainer dataContainer = EntityDataMappable.RetrieveEntity(args.EntityGuid);
            GameObjectTemplateModel   template      = GameObjectTemplateMappable.RetrieveEntity(args.EntityGuid);

            //Initialize the creature display model ID.
            dataContainer.SetFieldValue(BaseObjectField.UNIT_FIELD_DISPLAYID, template.ModelId);
        }
コード例 #7
0
 public BehaviourGameObjectState(IEntityDataFieldContainer entityData, NetworkEntityGuid entityGuid, GameObjectInstanceModel instanceModel, GameObjectTemplateModel templateModel,
                                 [NotNull] TBehaviourType behaviourData, [NotNull] InterestCollection interest)
     : base(entityData, entityGuid, instanceModel, templateModel, interest)
 {
     BehaviourData = behaviourData ?? throw new ArgumentNullException(nameof(behaviourData));
 }