Пример #1
0
 public static void LoadTextures()
 {
     Cart                 = Load("cart");
     LeverActive          = Load("lever_active");
     LeverDeactive        = Load("lever_deactive");
     RailStraight         = Load("track_straight");
     RailTurn             = Load("track_turn_02");
     RailBooster          = Load("track_boost");
     RailDetector         = Load("track_detector");
     RailPush             = Load("track_push");
     RailCounter          = Load("track_counter");
     ModuleInverter       = Load("power_module_inverter");
     Start                = Load("start");
     Destination          = Load("flag_finish");
     Bump                 = DebugTextures.GenerateRectangle(64, 64, Color.Gray);
     Portal               = DebugTextures.GenerateRectangle(64, 64, Color.DarkMagenta);
     Obstacle             = Load("obstacle_01");
     ModuleSignalModifier = Load("power_module_signalmod");
     Orb                   = Load("orb_01");
     CartSpawner           = Load("spawner_cart");
     ItemsMenu             = Load("ui\\ui_itemsmenu");
     ItemsMenuOrigin       = Globals.GetTextureOrigin(ItemsMenu);
     ItemsMenuOpen         = Load("ui\\ui_itemsmenu_open");
     ItemsMenuOpenOrigin   = Globals.GetTextureOrigin(ItemsMenuOpen);
     ItemsMenuTile         = Load("ui\\ui_itemsmenu_tile");
     ItemsMenuTileOrigin   = Globals.GetTextureOrigin(ItemsMenuTile);
     ItemsMenuExpand       = Load("ui\\ui_itemsmenu_expand");
     ItemsMenuExpandOrigin = Globals.GetTextureOrigin(ItemsMenuExpand);
 }
Пример #2
0
        public PowerConnection(Vector2 position, Connection connection, int signalDuration = 0, Connected onConnected = null, SignalUpdate onSignalUpdate = null) // a signal-duration of 0 means it will be toggled no and off
        {
            this.connection = connection;
            this.position   = position;

            toggler = signalDuration == 0;

            if (!toggler)
            {
                this.signalDuration = signalDuration;
            }

            wires = new List <Wire>();

            powerTexture       = DebugTextures.GenerateRectangle(4, 4, Color.DarkRed);
            powerTextureOrigin = Globals.GetTextureOrigin(powerTexture);

            this.onConnected = onConnected;

            switch (this.connection)
            {
            case Connection.Input:
                this.onSignalUpdate = onSignalUpdate;
                break;

            case Connection.Output:
                break;

            default:
                break;
            }

            powerConnections.Add(this);
        }
Пример #3
0
        public void Draw(SpriteBatch batch)
        {
            if (!Globals.displayPower)
            {
                return;
            }

            batch.Draw(powerTexture, position, null, Color.White, 0f, powerTextureOrigin, 1f, SpriteEffects.None, 1f);

            if (connectingWire && Input.mouseCell != cell) // Connecting of the wire
            {
                DebugTextures.DrawDebugLine(batch, position, Input.mousePositionGame, Color.Red, 4);
            }
        }
Пример #4
0
 public static void CreateGrid(Point startingPoint, int rows, int columns)
 {
     Cell.startingPoint = startingPoint;
     grid = new Cell[rows, columns];
     for (int y = 0; y < columns; y++)
     {
         for (int x = 0; x < rows; x++)
         {
             grid[x, y] = new Cell(x * cellWidth + startingPoint.X, y * cellHeight + startingPoint.Y);
         }
     }
     CellSprite     = DebugTextures.GenerateHollowRectangele(cellWidth, cellHeight, 1, Color.White);
     m_SpriteOrigin = new Vector2(cellWidth / 2f, cellHeight / 2f);
 }
Пример #5
0
        public static void LoadContent(GraphicsDevice graphics)
        {
            DebugTextures.LoadTextures(graphics);

            GUI.defaultFont = content.Load <SpriteFont>("ui\\fonts\\default_font");

            screenCenter = new Vector2(gameWidth / 2f, gameHeight / 2f);
            rand         = new Random();

            placedItems = new List <Cell>();

            //baseEffect = content.Load<Effect>("effects\\base_effect");
            //buttonEffect = content.Load<Effect>("effects\\button_effect");
            lightMask       = content.Load <Texture2D>("effects\\lightmask");
            lightMaskOrigin = GetTextureOrigin(lightMask);
        }
Пример #6
0
 public static Button Debug(string text, int width, int height, Color color, onPressed onPressed)
 {
     return(new Button(latestButtonPosition + new Vector2(width * 1.5f, 0), "debug", text, false, DebugTextures.GenerateRectangle(width, height, color), GUI.defaultFont, onPressed));
 }
Пример #7
0
 public void Draw(SpriteBatch batch)
 {
     DebugTextures.DrawDebugLine(batch, input.position, output.position, color, 3);
 }
Пример #8
0
        public static void LoadGUI()
        {
            buttonsGUI    = new List <Button>();
            buttonsFinish = new List <Button>();
            textsGUI      = new List <Text>();
            textsFinish   = new List <Text>();
            resources     = new List <ResourceElement>();
            ItemElements  = new List <ItemElement>();

            timeText = new Text(new Vector2(Globals.screenCenter.X, Cell.cellHeight), string.Empty, Cell.cellWidth, Cell.cellHeight, 1f, defaultFont, Color.Black);

            instructions = new Text(new Vector2(Cell.cellWidth * 3.5f, Cell.cellHeight), "Rotate: Q\nHold and drag to place multiple rails at once\nUse scroll-wheel to change rail-type", Cell.cellWidth * 8, Cell.cellHeight * 2, 1f, defaultFont, Color.Black);

            finishGameText = new Text(Globals.screenCenter, "THANKS FOR PLAYING!\n<MADE BY COBEAQUEN>", Cell.cellWidth * 8, Cell.cellHeight * 2, 1f, defaultFont, Color.White, true, GameState.LevelFinished);

            straightRailElement = new ResourceElement(Cell.GetCell(Globals.screenWidth, Globals.screenHeight).ToVector2() - new Vector2(Cell.cellWidth * 2, Cell.cellHeight * 2), string.Empty, Textures.RailStraight, Globals.level.straightRailCount.ToString(), 1f);
            turnRailElement     = new ResourceElement(Cell.GetCell(Globals.screenWidth, Globals.screenHeight).ToVector2() - new Vector2(Cell.cellWidth * 4, Cell.cellHeight * 2), string.Empty, Textures.RailTurn, Globals.level.turnRailCount.ToString(), 1f);
            boostRailElement    = new ResourceElement(Cell.GetCell(Globals.screenWidth, Globals.screenHeight).ToVector2() - new Vector2(Cell.cellWidth * 6, Cell.cellHeight * 2), string.Empty, Textures.RailBooster, Globals.level.boostRailCount.ToString(), 1f);

            sendCartButton           = new Button(new Vector2(Cell.cellWidth * 1, Cell.cellHeight * 2), "run", "RUN", false, DebugTextures.GenerateRectangle(64, 64, Color.DarkBlue), defaultFont, Globals.player.RunSimulation);
            destroyCartButton        = new Button(new Vector2(Cell.cellWidth * 3, Cell.cellHeight * 2), "reset", "RESET", false, DebugTextures.GenerateRectangle(64, 64, Color.DarkRed), defaultFont, Globals.player.Reset);
            togglePowerdisplayButton = new Button(new Vector2(Cell.cellWidth * 19, Cell.cellHeight * 1), "power_toggle", "Power: hidden", false, DebugTextures.GenerateRectangle(64, 64, Color.IndianRed), defaultFont, Globals.player.TogglePowerDisplay);

            itemsMenu = new ItemsMenu();
        }