Esempio n. 1
0
 public MenuOption(string a_Name, Vector2 a_Pos, Color a_TextColour)
 {
     name = a_Name;
     pos = a_Pos;
     colour = a_TextColour;
     textShown = new OnScreenText(name, a_Pos, a_TextColour, Color.White, Utility.Instance.LabelsFont);
 }
Esempio n. 2
0
        public Enemy(Vector2 a_Position, Vector2 a_Dimensions, Color a_Colour)
        {
            m_CurrentMaxHealth = 3;
            m_CurrentHealth = m_CurrentMaxHealth;

            int textureChosen = (int)(Utility.Instance.cRand.NextDouble() * 8) + 1;
            string textureName = "enemy" + textureChosen.ToString();
            m_Texture = Utility.Instance.LoadTexture(textureName);

            m_Dimensions = a_Dimensions;
            m_Colour = Color.White;
            m_Position = a_Position;
            m_StartPos = m_Position;
            m_Velocity = Vector2.Zero;

            m_DrawnRect = new Rectangle((int)m_Position.X, (int)m_Position.Y, (int)m_Dimensions.X, (int)m_Dimensions.Y);

            int minMovementSpeed = 30;
            int maxMovementSpeed = 60;
            m_MovementSpeed = (float)(minMovementSpeed + Utility.Instance.cRand.NextDouble() * (maxMovementSpeed - minMovementSpeed));

            float minVeloDecay = 0.7f;
            float maxVeloDecay = 0.9f;
            m_VelocityDecayRate = (float)(minVeloDecay + Utility.Instance.cRand.NextDouble() * (maxVeloDecay - minVeloDecay));

            float minVelo = 35;
            float maxVelo = 50;
            m_MaxVelocity = (float)(minVelo + Utility.Instance.cRand.NextDouble() * (maxVelo - minVelo));

            #if DEBUG
            velocityText = new OnScreenText("EMPTY TEXT", m_Position, Color.Black, Color.White, Utility.Instance.LabelsFont);
            rotationText = new OnScreenText("EMPTY TEXT", m_Position, Color.Black, Color.White, Utility.Instance.LabelsFont);
            #endif
        }
Esempio n. 3
0
        public TextBox(string a_Text)
        {
            rightMost = Utility.Instance.ScreenWidth - 100;

            Displayed = true;

            text = a_Text;

            m_TextDimensions = Utility.Instance.NormalTextFont.MeasureString(text);

            int totalLines = 0;

            string formattedSentence = FormatText(text, rightMost, ref totalLines);

            //takes into account the entire height of text box
            int finalHeightTextBox = (int)(m_TextDimensions.Y * (totalLines == 1 ? 1 : totalLines - 1));

            int positionPadding = 10;

            //position from bottom of screen using text box height, plus extra padding
            m_Position.Y = Utility.Instance.ScreenHeight - finalHeightTextBox - positionPadding;

            textToDisplay = new OnScreenText(formattedSentence, m_Position, Color.White, Color.RoyalBlue, Utility.Instance.NormalTextFont);
            textToDisplay.CompleteFade = completeFade;

            //also changes textToDisplay's variables
            StartFade = false;

            //hack to make text splitting work, add extra to rightMost boundary
            int rightBoundaryPadding = 60;

            m_TextBox = new Rectangle((int)m_Position.X, (int)m_Position.Y, rightMost + rightBoundaryPadding, finalHeightTextBox);
        }
Esempio n. 4
0
        //dungeon width * dungeon height = total number of rooms
        //room width and height are the same
        public Dungeon(int dungeonWidth, int dungeonHeight, int roomSize)
        {
            m_StartPos = Vector2.Zero;

            m_DungeonWidth = dungeonWidth;
            m_DungeonHeight = dungeonHeight;

            m_RoomWidth = m_RoomHeight = roomSize;

            //player starts in the middle of the screen
            player = new Player(new Vector2(Utility.Instance.ScreenWidth / 2, Utility.Instance.ScreenHeight / 2), new Vector2(32));

            //reset the dungeon completely - including player stats and items
            ResetDungeon(true);

            playerMarker = new OnScreenText("H", Vector2.Zero, Color.Black, Color.White, Utility.Instance.SF);
        }
Esempio n. 5
0
        public PreRoom(int a_X, int a_Y)
        {
            x = a_X;
            y = a_Y;

            ChangeRoomType(PreRoomType.NO_ROOM);
            connections = new int[4];
            for (int i = 0; i < 4; ++i)
                connections[i] = -1;

            //north door
            doors.Add(new Door(Utility.Instance.ScreenWidth / 2, 0));

            //south door
            doors.Add(new Door(Utility.Instance.ScreenWidth / 2, Utility.Instance.ScreenHeight - 50));

            //east door
            doors.Add(new Door(Utility.Instance.ScreenWidth - 50, Utility.Instance.ScreenHeight / 2));

            //west door
            doors.Add(new Door(0, Utility.Instance.ScreenHeight / 2));

            wallChunks.Add(new WallChunk(new Vector2(0), Direction.EAST, 40));
            wallChunks.Add(new WallChunk(new Vector2(0), Direction.SOUTH, 40));
            wallChunks.Add(new WallChunk(new Vector2(0, Utility.Instance.ScreenHeight - 32), Direction.EAST, 40));
            wallChunks.Add(new WallChunk(new Vector2(Utility.Instance.ScreenWidth - 32, 0), Direction.SOUTH, 40));

            #if DEBUG
            roomNameText = new OnScreenText("EMPTY NAME", Vector2.Zero, Color.DodgerBlue, Color.White, Utility.Instance.HeadingsFont);
            #endif
        }
Esempio n. 6
0
        public TrapRoom(int a_X, int a_Y, int[] a_Connections)
            : base(a_X, a_Y)
        {
            defeated = false;
            roomType = PreRoomType.TRAP;
            int count = 0;
            foreach (int n in a_Connections)
            {
                connections[count] = n;
                count++;
            }

            name = "Trap";
            colour = Color.Blue;

            #if DEBUG
            buffText = new OnScreenText("EMPTY TEXT", Vector2.Zero, Color.Black, Color.White, Utility.Instance.LabelsFont);
            #endif
            textToDisplay.ChangeDisplayedText("It's a trap!");
        }
Esempio n. 7
0
        public MonsterRoom(int a_X, int a_Y, int[] a_Connections)
            : base(a_X, a_Y)
        {
            enemiesLeft = new OnScreenText("Enemies left: ", Vector2.Zero, Color.Black, Color.White, Utility.Instance.LabelsFont);
            defeated = false;
            roomType = PreRoomType.MONSTER;
            int counter = 0;
            foreach (int n in a_Connections)
            {
                connections[counter] = n;
                counter++;
            }

            name = "Monster";
            colour = Color.Red;

            int numEnemies = 1 + (int)(Utility.Instance.cRand.NextDouble() * (maxEnemies - 1));
            for (int i = 0; i < numEnemies; ++i)
            {
                Vector2 randPos = new Vector2((float)(Utility.Instance.ScreenWidth * 0.25f + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenWidth * 0.75f - Utility.Instance.ScreenWidth * 0.25f)),
                                              (float)(Utility.Instance.ScreenHeight * 0.25f + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenHeight * 0.75f - Utility.Instance.ScreenHeight * 0.25f)));
                float dimensions = 20;
                Enemy t = null;

                double typeChance = Utility.Instance.cRand.NextDouble();

                if (typeChance >= 0 && typeChance < 0.2)
                {
                    t = new Pursuer(randPos, new Vector2(dimensions), Color.DarkGreen);
                }
                else if (typeChance >= 0.2 && typeChance < 0.4)
                {
                    t = new PursuingShooter(randPos, new Vector2(dimensions), Color.DeepSkyBlue);
                }
                else if (typeChance >= 0.4 && typeChance < 0.6)
                {
                    t = new Avoider(randPos, new Vector2(dimensions), Color.HotPink);
                }
                else if (typeChance >= 0.6 && typeChance < 0.8)
                {
                    t = new EvadingShooter(randPos, new Vector2(dimensions), Color.LightYellow);
                }
                else
                {
                    t = new Shooter(randPos, new Vector2(dimensions), Color.SpringGreen);
                }

                if (t != null)
                {
                    Console.WriteLine(t.GetType().ToString());
                    enemies.Add(t);
                }
            }

            textToDisplay.ChangeDisplayedText("Kill everything first, then you can leave.");
        }