private static Entity SlotHolsterForWeapon(Entity mech, BodyPartLocation location, Entity weapon) { Entity holster; switch (weapon.GetComponentOfType <Component_Attachable>().SizeRequired) { case AttachmentSize.SMALL: holster = BlueprintListing.BuildForLabel(Blueprints.SMALL_HOLSTER); break; case AttachmentSize.MEDIUM: holster = BlueprintListing.BuildForLabel(Blueprints.MEDIUM_HOLSTER); break; case AttachmentSize.LARGE: holster = BlueprintListing.BuildForLabel(Blueprints.LARGE_HOLSTER); break; default: throw new ArgumentException("BuildHolsterForWeapon can't handle size: not SMALL, MEDIUM, LARGE"); } SlotAt(mech, location, holster); holster.HandleEvent(new GameEvent_Slot(mech, holster, weapon)); return(holster); }
private static Entity GetBodyPart(Entity mech, BodyPartLocation location) { return(mech.HandleQuery(new GameQuery_SubEntities(SubEntitiesSelector.BODY_PART)) .SubEntities .Where(e => e.GetComponentOfType <Component_BodyPartLocation>().Location == location) .First()); }
private static Entity BuildMountForWeapon(Entity mech, BodyPartLocation location, Entity weapon) { Entity mount; switch (weapon.GetComponentOfType <Component_Attachable>().SizeRequired) { case AttachmentSize.SMALL: mount = BlueprintListing.BuildForLabel(Blueprints.SMALL_MOUNT); break; case AttachmentSize.MEDIUM: mount = BlueprintListing.BuildForLabel(Blueprints.MEDIUM_MOUNT); break; case AttachmentSize.LARGE: mount = BlueprintListing.BuildForLabel(Blueprints.LARGE_MOUNT); break; default: throw new ArgumentException("BuildMountForWeapon can't handle size: not SMALL, MEDIUM, LARGE"); } SlotAt(mech, location, mount); mount.HandleEvent(new GameEvent_Slot(mech, mount, weapon)); return(mount); }
public GameEvent_ReceiveAttack(Entity target, BodyPartLocation subTarget, DamageType damageType, int damage) { this.Target = target; this.SubTarget = subTarget; this.DamageType = damageType; this.BaseIncomingDamage = damage; }
public EquipmentSlotDetails(EquipmentSlot slot, BodyPartType bodyPartType, BodyPartLocation location, int index) { EquipmentSlot = slot; BodyPartType = bodyPartType; BodyPartLocation = location; Index = index; }
public static Entity BuildBodyPart(BodyPartLocation location, int slotSpace, int internalStructure) { return(new Entity(label: location.ToString(), typeLabel: "BodyPart") .AddComponent(new Component_BodyPartLocation(location)) .AddComponent(new Component_SlottedContainer(slotSpace)) .AddComponent(new Component_SlottedStructure()) .AddComponent(new Component_InternalStructure(internalStructure))); }
public CommandStub_PrepareTargetedAttack(string attackerEID, string targetEID, string targetLabel, BodyPartLocation subTarget) : base(attackerEID) { this.AttackerEID = attackerEID; this.TargetLabel = targetLabel; this.TargetEID = targetEID; this.SubTarget = subTarget; }
public CommandStub_PrepareDirectionalAttack(string attackerEID, int x, int y, BodyPartLocation subTarget) : base(attackerEID) { this.AttackerEID = attackerEID; this.x = x; this.y = y; this.SubTarget = subTarget; }
public void Deserialize(string value) { var splits = value.Split('|'); EquipmentSlot = (EquipmentSlot)Enum.Parse(typeof(EquipmentSlot), splits[0]); BodyPartType = (BodyPartType)Enum.Parse(typeof(BodyPartType), splits[1]); BodyPartLocation = (BodyPartLocation)Enum.Parse(typeof(BodyPartLocation), splits[2]); Index = int.Parse(splits[3]); }
public static Entity MountOntoArm(Entity mech, BodyPartLocation location, Entity mountable) { var armActuator = GetBodyPart(mech, location) .TryGetSubEntities(SubEntitiesSelector.SWAPPABLE_ATTACH_POINTS) .Where(e => e.Label == Blueprints.HAND) .First(); armActuator.HandleEvent(new GameEvent_Slot(mech, armActuator, mountable)); return(mech); }
private static void FillLocationWith(Entity mech, BodyPartLocation location, Func <Entity> buildFn) { var container = GetBodyPart(mech, location).GetComponentOfType <Component_SlottedContainer>(); var toAdd = buildFn(); while (container.SlotsRemaining >= toAdd.GetComponentOfType <Component_Slottable>().SlotsRequired) { SlotAt(mech, location, toAdd); toAdd = buildFn(); } }
public Entity InspectBodyPart(BodyPartLocation location) { if (this.bodyParts.ContainsKey(location)) { return(this.bodyParts[location]); } else { return(null); } }
public GameEvent_PrepareAttack(int commandTick, int APCost, Entity attacker, Entity target, Entity weapon, IMap gameMap, BodyPartLocation subTarget) : base(commandTick, APCost, attacker, weapon) { if (!weapon.HasComponentOfType <Component_Weapon>()) { throw new ArgumentException("Can't build attack event - weapon has no Weapon component!"); } this.Target = target; this.SubTarget = subTarget; this.GameMap = gameMap; }
public Component_BodyPartLocation(BodyPartLocation location) { this.Location = location; }
public static void SlotAt(Entity mech, BodyPartLocation location, Entity slottable) { var bodyPart = GetBodyPart(mech, location); bodyPart.HandleEvent(new GameEvent_Slot(mech, bodyPart, slottable)); }