public double GetPacketsSentRate(InterfaceComponent interfaceComponent, State state) { if (state == State.ActiveConnectionNotEnabled) { switch (interfaceComponent) { case InterfaceComponent.CerebralCortexPatch: return(0.0); case InterfaceComponent.TemporalInterfacePatch: return(0.0); case InterfaceComponent.FrontalInterfacePatch: return(0.0); default: return(0); } } // ActiveConnectionEnabled Point else { switch (interfaceComponent) { case InterfaceComponent.CerebralCortexPatch: return(512.88); case InterfaceComponent.TemporalInterfacePatch: return(726.91); case InterfaceComponent.FrontalInterfacePatch: return(100.3); default: return(0); } } }
// In the constructor, set the TholianNeuralInterfacePatch property // (inherited from the TholianNeuralInterfaceClass). // We use the InterfaceComponent object that is passed in as a parameter // to the constructor to set the property. // // The InterfaceComponent types are: // CerebralCortexPatch, // TemporalInterfacePatch, // FrontalInterfacePatch public AdaptedDataNeuralInterface(InterfaceComponent neuralInterfacePatch) { TholianNeuralInterfacePatch = neuralInterfacePatch; existingDataNeuralInterfaceObject = new ExistingDataNeuralInterfaceClass(); }
public double GetPatchTransferRate(InterfaceComponent interfaceComponent) { switch (interfaceComponent) { case InterfaceComponent.CerebralCortexPatch: return(2458.33); case InterfaceComponent.TemporalInterfacePatch: return(999.878); case InterfaceComponent.FrontalInterfacePatch: return(698.336); } return(0d); }
public string GetPatchType(InterfaceComponent interfaceComponent) { switch (interfaceComponent) { case InterfaceComponent.CerebralCortexPatch: return("Cerebral Cortex Patch"); case InterfaceComponent.TemporalInterfacePatch: return("Temporal Interface Patch"); case InterfaceComponent.FrontalInterfacePatch: return("Frontal Interface Patch"); default: return("Either no patch was specified or the patch type is undefined"); } }
public string GetMessageHeader(InterfaceComponent interfaceComponent, State state) { if (state == State.ActiveConnectionEnabled) { switch (interfaceComponent) { case InterfaceComponent.CerebralCortexPatch: return(this.GetType().ToString() + "Cerebral Cortex Patch Header"); case InterfaceComponent.TemporalInterfacePatch: return("Temporal Interface Patch Header"); case InterfaceComponent.FrontalInterfacePatch: return("Frontal Interface Patch Header"); default: return("Either no header was specified or the header is undefined"); } } else { return("No active connection established"); } }
public void AddComponent(InterfaceComponent comp) { this.Components.Add(comp); this.Components.Sort(); }
public IEntityHandle Create( [NotNull] SerializablePlayerModel model, [NotNull] ISocketContext socket, [NotNull] IPacketParser packetParser, [NotNull] IPacketHandlerCatalogue packets) { if (model == null) { throw new ArgumentNullException(nameof(model)); } if (socket == null) { throw new ArgumentNullException(nameof(socket)); } if (packetParser == null) { throw new ArgumentNullException(nameof(packetParser)); } if (packets == null) { throw new ArgumentNullException(nameof(packets)); } var id = GetId(); if (id == InvalidPlayerId) { return(null); } Debug.Assert(InstanceLookup[id] == null); var entHandle = EntitySystem.Create($"Entity for player {model.Username}"); var ent = entHandle.Get(); ent.Components.Add(new MessageLogComponent(ent)); ent.Components.Add(new MessageNetworkSyncComponent(ent)); //#if DEBUG ent.Components.Add(new DebugStatNetworkSyncComponent(ent)); //#endif ent.Components.Add(new NetworkingComponent(ent, socket, packetParser)); ent.Components.Add(new PacketDispatcherComponent(ent, packets)); ent.Components.Add(new FlagAccumulatorComponent(ent)); ent.Components.Add(new MarkedForDeathBroadcasterComponent(ent)); var client = new ClientPositionComponent(ent); ent.Components.Add(client); ent.Components.Add <IClientPositionComponent>(client); ent.Components.Add(new RegionNetworkSyncComponent(ent)); var health = new HealthComponent(ent); ent.Components.Add(health); ent.Components.Add <IHealthComponent>(health); var cmb = new CombatStatComponent(ent); ent.Components.Add(cmb); ent.Components.Add <ICombatStatComponent>(cmb); ent.Components.Add(new CombatStatNetworkSyncComponent(ent)); var interf = new InterfaceComponent(ent); ent.Components.Add(interf); ent.Components.Add <IInterfaceComponent>(interf); ent.Components.Add(new InterfaceNetworkSyncComponent(ent)); var skills = new SkillComponent(ent); ent.Components.Add(skills); ent.Components.Add <ISkillComponent>(skills); ent.Components.Add(new SkillNetworkSyncComponent(ent)); var vision = new CappedVisionComponent(ent); ent.Components.Add(vision); ent.Components.Add <IVisionComponent>(vision); ent.Components.Add(new NearbyEntityWatcherComponent(ent)); ent.Components.Add(new NpcNetworkSyncComponent(ent)); ent.Components.Add(new PlayerNetworkSyncComponent(ent)); ent.Components.Add(new GroundItemNetworkSyncComponent(ent)); ent.Components.Add(new TileMovementComponent(ent)); ent.Components.Add(new MovementActionComponent(ent)); ent.Components.Add(new ItemActionDispatchComponent(ent)); var inv = new PlayerInventoryComponent(ent, new ListItemContainer(ent, model.Backpack), new PlayerEquipmentContainer(ent, model.Equipment), new ListItemContainer(ent, model.Bank)); ent.Components.Add(inv); ent.Components.Add <IInventoryComponent>(inv); var player = new PlayerComponent(ent, model.Username, model.Apperance, true, model.TitleId, id, DestroyCallback); ent.Components.Add(player); ent.Components.Add <IPlayerComponent>(player); var check = ent.AreComponentRequirementsSatisfied(out var msg); if (!check) { throw new InvalidOperationException(msg); } // setup skills foreach (var skill in model.Skils) { skills.All.Add(skill.Key, new NormalSkillModel(skill.Key, skill.Value.Boost, skill.Value.Experience)); } // setup health health.SetNewMaxHealth(skills.All[SkillDb.Hitpoints].Level); health.SetNewHealth(model.Health); InstanceLookup[id] = entHandle; _usernameLookup.Add(model.Username, entHandle); NumAlivePlayers++; // teleport player to pos ent.GetTransform().Teleport(model.PosX, model.PosY, model.PosZ); // init components ent.SendMessage(NotificationMessage.Initialize); return(entHandle); }