Exemple #1
0
        public void Init()
        {
            World         = new World();
            EntityManager = World.EntityManager;

            World.CurrentLevel = Level = new Level(new Size(5, 5),
                                                   World,
                                                   "Floor",
                                                   new List <Terrain>
            {
                new Terrain("Floor", "Floor", true, true, 1.0),
                new Terrain("Wall", "Wall", false, false, 0.0)
            });

            World.Player = Entity = EntityManager.Create(new List <Component>
            {
                new Sprite("player", Sprite.ActorLayer),
                BodyComponent.CreateHuman(50),
                new VisibleComponent(10),
                new SightComponent(),
                new MeleeComponent(new MeleeComponent.Template
                {
                    ActionDescription       = "punch",
                    ActionDescriptionPlural = "punches",
                    Skill       = "skill_unarmed",
                    HitBonus    = 0,
                    Damage      = Rand.Constant(-5),
                    DamageType  = Combat.DamageTypes["crush"],
                    Penetration = 1,
                    AttackSpeed = World.OneSecondInSpeed,
                    APToReady   = 1,
                    Reach       = 0,
                    Strength    = 1,
                    Parry       = 0
                }),
                new GameObject(2, 2, Level),
                new ItemContainerComponent(),
                new ControllerComponent(new Player(), new AP(World.OneSecondInSpeed)),
                new Creature(),
                new Identifier("Player"),
                new EquipmentComponent(new List <string>
                {
                    "slot1",
                    "slot2",
                    "slot3",
                    "slot4",
                })
            });
        }
Exemple #2
0
        public static void Init(EntityFactory ef)
        {
            ef.Add("person",
                   new Sprite("npc", Sprite.ActorLayer),
                   new Identifier("npc"),
                   new ControllerComponent(new DoNothing(), new AP(World.OneSecondInSpeed / 2)),
                   new Creature(),
                   BodyComponent.CreateHuman(50),
                   new VisibleComponent(10),
                   new ItemContainerComponent(),
                   new ConditionHolder(new HumanNeedsEffect(), new CreatureEncumbranceEffect()),
                   new EquipmentComponent(new List <string>
            {
                "Head",
                "Torso",
                "Arms",
                "Main Hand",
                "Off Hand",
                "Hands",
                "Legs",
                "Feet"
            }),
                   new SightComponent(),
                   new MeleeComponent(new MeleeComponent.Template
            {
                ActionDescription       = "punch",
                ActionDescriptionPlural = "punches",
                Skill       = "skill_unarmed",
                HitBonus    = 0,
                Damage      = Rand.Constant(-5),
                DamageType  = Combat.DamageTypes["crush"],
                Penetration = 1,
                AttackSpeed = World.OneSecondInSpeed,
                APToReady   = 1,
                Reach       = 0,
                Strength    = 1,
                Parry       = 0,
            }));

            ef.Inherits("npc", "person",
                        new ControllerComponent(new NPC(), new AP(World.OneSecondInSpeed / 2)));

            ef.Inherits("player", "person",
                        new Sprite("player", Sprite.PlayerLayer),
                        new Identifier("Player"),
                        new ControllerComponent(new Player(), new AP(World.OneSecondInSpeed / 2)));
        }