コード例 #1
0
        public static Entity BuildNakedMech(string label, bool player, Guidebook book)
        {
            var mech = new Entity(label: label, typeLabel: MechTypeLabel)
                       .AddComponent(new Component_Buffable())
                       .AddComponent(new Component_ActionExecutor(Config.DefaultEntityAP))
                       .AddComponent(new Component_Inventory())
                       .AddComponent(new Component_Skeleton());

            if (player)
            {
                mech.AddComponent(new Component_Player());
            }
            else if (book != null)
            {
                mech.AddComponent(new Component_AI(book));
            }
            else
            {
                throw new InvalidOperationException("book can't be null!");
            }

            SlotAt(mech, BodyPartLocation.LEFT_ARM, BlueprintListing.BuildForLabel(Blueprints.HAND));
            SlotAt(mech, BodyPartLocation.RIGHT_ARM, BlueprintListing.BuildForLabel(Blueprints.HAND));

            // Slot in all the required components
            return(mech);
        }
コード例 #2
0
        public void TestLoadsFromResources()
        {
            // TODO: Put in loader
            // TODO: Test file in test project
            BlueprintListing.LoadAllBlueprints();

            var powerPlant = BlueprintListing.GetBlueprintByLabel(Blueprints.POWER_PLANT);

            Assert.AreEqual("Pwr.Plnt.", powerPlant.Label);

            var machinegun = BlueprintListing.GetBlueprintByLabel(Blueprints.MACHINEGUN);

            Assert.AreEqual("Mchngn.", machinegun.Label);
        }
コード例 #3
0
 public void Initialize()
 {
     this.ent = new Entity();
     this.cmp = new TestComponent();
     BlueprintListing.LoadAllBlueprints();
 }
コード例 #4
0
 public static Entity BuildArmorPart()
 {
     return(BlueprintListing.BuildForLabel(Blueprints.ARMOR));
 }