Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
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_Skeleton());

            if (player)
            {
                mech.AddComponent(new Component_Player());
                mech.AddComponent(new Component_FocusUser());
            }
            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);
        }
Exemple #4
0
        public static void Main()
        {
            BlueprintListing.LoadAllBlueprints();

            _currentDisplay = new Menu_Main(_screenWidth, _screenHeight);

            // This must be the exact name of the bitmap font file we are using or it will error.
            string fontFileName = "terminal8x8.png";
            // The title will appear at the top of the console window
            string consoleTitle = "A Rougelike Where You Plan Your Moves";

            // Tell RLNet to use the bitmap font that we specified and that each tile is 8 x 8 pixels
            _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle);

            // Set up a handler for RLNET's Update event
            _rootConsole.Update += OnRootConsoleUpdate;
            // Set up a handler for RLNET's Render event
            _rootConsole.Render += OnRootConsoleRender;
            // Begin RLNET's game loop
            _rootConsole.Run();
        }
Exemple #5
0
 public static Entity BuildArmorPart()
 {
     return(BlueprintListing.BuildForLabel(Blueprints.ARMOR));
 }
Exemple #6
0
 public static IEnumerable <Blueprint> GetMatchingBlueprints(SubEntitiesSelector selector)
 {
     return(BlueprintListing.GetAllBlueprints().Where(b => b.MatchesSelector(selector)));
 }
Exemple #7
0
 public static Entity BuildForLabel(string label)
 {
     return(BlueprintListing.GetBlueprintByLabel(label).BuildEntity());
 }