示例#1
0
        internal static long Agent(EcsRegistrar rgs, string agentBlueprintName, string armorBlueprintName, string weaponBlueprintName)
        {
            long agentId  = Blueprinter.GetEntityFromBlueprint(rgs, agentBlueprintName);
            long?armorId  = string.IsNullOrEmpty(armorBlueprintName) ? (long?)null : Blueprinter.GetEntityFromBlueprint(rgs, armorBlueprintName);
            long?weaponId = string.IsNullOrEmpty(weaponBlueprintName) ? (long?)null :  Blueprinter.GetEntityFromBlueprint(rgs, weaponBlueprintName);

            var anatomy = rgs.GetPartSingle <Parts.Anatomy>(agentId);

            if (!anatomy.SlotsEquipped.Any())
            {
                var bodySlotsAsEnum = Vals.BodyPlan.BodyPlanToSlots[anatomy.BodyPlan];
                anatomy.SlotsEquipped = bodySlotsAsEnum.GetUniqueFlags().ToDictionary(s => (Vals.BodySlots)s, s => 0L);
            }

            if (armorId.HasValue)
            {
                var armorResults = Sys.Anatomy.Equip(rgs, agentId, armorId.Value);
            }

            if (weaponId.HasValue)
            {
                var wieldResults = Sys.Anatomy.Equip(rgs, agentId, weaponId.Value);
            }

            return(agentId);
        }
示例#2
0
        public Game(Func <CombatChoicesAndTargets, ActionChosen> receivePlayerInputFunc)
        {
            this.ReceivePlayerInputFunc = receivePlayerInputFunc;
            this.Rgs = new EcsRegistrar();

            this.GlobalId = Blueprinter.GetEntityFromBlueprint(this.Rgs, "global");

            var natWeaponsSetsPart = new Parts.NaturalWeaponsMap {
                NaturalWeaponSets = Sys.Anatomy.InitializeNaturalWeapons(this.Rgs)
            };

            Rgs.AddPart(this.GlobalId, natWeaponsSetsPart);

            long heroId     = AgentCreator.Agent(this.Rgs, "agent.hero", "obj.armor.chainmail", "obj.weapon.claymore");
            long villian1Id = AgentCreator.Agent(this.Rgs, "agent.monster.orc.basic", "obj.armor.leather-armor", "obj.weapon.sword");
            long villian2Id = AgentCreator.Agent(this.Rgs, "agent.monster.orc.basic", "obj.armor.leather-armor", "obj.weapon.sword");
            long villian3Id = AgentCreator.Agent(this.Rgs, "agent.monster.orc.basic", "obj.armor.leather-armor", "obj.weapon.sword");
            long villian4Id = AgentCreator.Agent(this.Rgs, "agent.monster.wolf.basic", "obj.armor.leather-armor", null);

            Sys.EntityName.Overwrite(this.Rgs, villian1Id, new Parts.EntityName {
                ProperName = "Gruk"
            });
            Sys.EntityName.Overwrite(this.Rgs, villian2Id, new Parts.EntityName {
                ProperName = "Hork"
            });
            Sys.EntityName.Overwrite(this.Rgs, villian3Id, new Parts.EntityName {
                ProperName = "Lil Jon"
            });
            Sys.EntityName.Overwrite(this.Rgs, villian4Id, new Parts.EntityName {
                ProperName = "Garm the Wolf"
            });

            this.BattlefieldId = Sys.Container.CreateBattlefield(this.Rgs, new long[] { heroId, villian1Id, villian2Id, villian3Id, villian4Id });
        }