Esempio n. 1
0
        public ToggleLimitsButton(Level Target, Surface.SurfaceType Type)
        {
            target = Target;
            type = Type;
            switch (type)
            {
                case Surface.SurfaceType.Absorbant:
                    basicId = "Absorbant Walls: ";
                    break;
                case Surface.SurfaceType.Refractive:
                    basicId = "Refractive Walls: ";
                    break;

                case Surface.SurfaceType.Reflective:
                    basicId = "Reflective Walls: ";
                    break;
                default:
                    basicId = "Whaats?";
                    break;

            }

            addOption(0); addOption(1); addOption(2); addOption(3); addOption(5); addOption(8);
            currentValue = 1;
            execute();
        }
Esempio n. 2
0
        public FullLevelMenu(LevelManager Parent, Level Target, InputController Input, ContentManager CM, Dictionary<String, Player> Players, int x, int y, int xprime, int yprime)
        {
            parent = Parent;
            font = parent.font;
            current_index = 0;
            x_position = x;
            y_position = y;
            y_spacing = yprime;
            x_spacing = xprime;
            image = CM.Load<Texture2D>("Main Menu");
            cursor_image = CM.Load<Texture2D>("laser");
            addMenuItem(new Level_Button(parent, Target));
            wallType = new ToggleWallsButton(Target);
            wallType.addOption("Full Reflective", Level.WallType.FullReflect);
            wallType.addOption("Full Absorb", Level.WallType.FullAbsorb);
            wallType.addOption("H", Level.WallType.SideReflect);
            wallType.addOption("I", Level.WallType.UpDownReflect);
            wallType.addOption("X", Level.WallType.DiagonalReflectingOctagon);
            wallType.execute();
            addMenuItem(wallType);
            reflectiveAllowance = new ToggleLimitsButton(Target, Surface.SurfaceType.Reflective);
            addMenuItem(reflectiveAllowance);

            absorbantAllowance = new ToggleLimitsButton(Target, Surface.SurfaceType.Absorbant);
            addMenuItem(absorbantAllowance);

            refractiveAllowance = new ToggleLimitsButton(Target, Surface.SurfaceType.Refractive);
            addMenuItem(refractiveAllowance);

            player1Start = new FlashText(font, "Player 1 Press Start", 500f, 100, 660, Color.Red);

            player2Start = new FlashText(font, "Player 2 Press Start", 500f, 750, 660, Color.Blue);

            players = Players;
        }
Esempio n. 3
0
 public SpawnPoint(Vector2 start, float time, Level Parent)
 {
     parent = Parent;
     current_time = 0;
     position = start;
     spawn_timer = time;
     orientation = 0f;
 }
Esempio n. 4
0
        public PlayerPrism(Level Parent, Vector2 Position, Player player)
        {
            parent = Parent;

            position = Position;
            bounds = new BoundingBox(new Vector3(position.X - 20, position.Y - 20, -1), new Vector3(position.X + 20, position.Y + 20, 1));
            player_color = player.Color;
        }
Esempio n. 5
0
 public ColorPrism(Level Parent, Vector2 Position, Color KeyColor)
 {
     parent = Parent;
     keyColor = KeyColor;
     position = Position;
     bounds = new BoundingBox(new Vector3(position.X - 20, position.Y - 20, -1), new Vector3(position.X + 20, position.Y + 20, 1));
        // color = Color.White;
 }
Esempio n. 6
0
 public Level create(Level lvl, int screenWidth, int screenHeight)
 {
     lvl.bkgHeight = 500;
     lvl.bkgWidth = 900;
     lvl.x = (screenWidth - lvl.bkgWidth) / 2;
     lvl.y = 10;
     lvl.rectangle = new Rectangle(x, y, 900, 500);
     return lvl;
 }
Esempio n. 7
0
 public Tower(string Id, Level Parent, Vector2 Position)
 {
     id = Id;
     parent = Parent;
     position = Position;
     color = Color.White;
     max_health = 1000000000;
     health = max_health;
     lit_up = false;
 }
Esempio n. 8
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     level = new Level();
     IsMouseVisible = true;
     //graphics.IsFullScreen = true;
     //graphics.PreferredBackBufferHeight=GraphicsDevice.Viewport.
     graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
     graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
     graphics.ApplyChanges();
     base.Initialize();
 }
Esempio n. 9
0
        public Surface(Tower a, Tower b, SurfaceType type, Level Parent)
        {
            tower_A = a; tower_A.AddSurface(this);
            tower_B = b; tower_B.AddSurface(this);
            m_type = type;

            surfaceLineSegment = new LineSegment(a.getPosition(), b.getPosition());

            parent = Parent;

            construct();
        }
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            level = new Level(Content);

            graphics.PreferredBackBufferWidth = Level.windowWidth;
            graphics.PreferredBackBufferHeight = Level.windowHeight;

            Content.RootDirectory = "Content";

            this.IsMouseVisible = true;
        }
Esempio n. 11
0
 public Spawnable(Level Region, Vector2 Position)
 {
     //parent = Parent;
     region = Region;
     randomizer = new Random();
     double temp = randomizer.Next(0, 1);
     target = region.getPlayer((int)Math.Floor(temp));
     position = Position;
     direction = target.getPosition() - position;
     direction.Normalize();
     health = 10;
     update_timer = 5000f;
 }
Esempio n. 12
0
        public Tower(string Id, Level Parent, Vector2 Position, Laser_Turret Owner)
        {
            max_health = 25;
            health = max_health;
            id = Id;
            parent = Parent;
            position = Position;
            owner = Owner;
            bounds = new BoundingBox(new Vector3(position.X-30, position.Y-30, -1), new Vector3(position.X + 30, position.Y + 30, 1));

            color = new Color(owner.color.ToVector3() + new Vector3(-.5f, -.5f, -.5f));
            lit_up = false;
        }
Esempio n. 13
0
        public Laser_Turret(Level parent, InputController.InputMode playerMode, LevelManager Manager, int a, int b, int c)
        {
            energy = 748;
            health = 748;
            m_parent = parent;
            input = new InputController(playerMode);
            id = input.getMode();
            manager = Manager;

               reflect_limit=b;
               absorb_limit=a;
               refract_limit=c;
               absorb_amount=0;
               reflect_amount=0;
               refract_amount=0;
               m_rotation = 0;

            switch (id)
            {
                case "Player1":
                    health_bar_pos = 0;
                    energy_bar_pos = 8;
                    position = new Vector2(30, m_parent.height / 2);
                    laserStart = new Vector2(51, m_parent.height / 2);
                    orientation = 0f;
                    id = "Player 1";
                    color = Color.Red;
                    cursor = new Cursor(this, input, m_parent);
                    break;

                case "Player2":

                    health_bar_pos = m_parent.width - 5;
                    energy_bar_pos = m_parent.width - 13;
                    position = new Vector2(m_parent.width - 33, m_parent.height / 2);
                    laserStart = new Vector2(m_parent.width - 54, m_parent.height / 2);
                    orientation = (float)Math.PI;
                    id = "Player 2";
                    color = Color.Blue;

                    cursor = new Cursor(this, input, m_parent);
                    break;

                default:
                    throw new NotImplementedException("Received unexpected input mode");
            }
            bounds = new BoundingBox(new Vector3(position.X - 20, position.Y - 20, -1), new Vector3(position.X + 20, position.Y + 20, 1));
        }
Esempio n. 14
0
        //private bool tower_selected;
        public Cursor(Laser_Turret Parent, InputController Input, Level Region)
        {
            input = Input;
            parent = Parent;
            player = Parent.id;
            region = Region;
            position = parent.getPosition();
            switch (player){

                case "Player 1":

            position.X += 10f;

                    break;

                case "Player 2":
                    position.X -= 10f;
                break;

                default:
                throw new NotImplementedException("Received unexpected output");
            }
            color = parent.color;
        }
Esempio n. 15
0
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if ((Keyboard.GetState().IsKeyDown(Keys.Escape)))
                this.Exit();

            smith.Update(CurrentLevel.blks);

            CurrentLevel.Update();

            if (CurrentLevel.isNextLevel())
            {
                CurrentLevel.LoadNext();
                CurrentLevel = CurrentLevel.NextLevel;

            }

            if (CurrentLevel.isLastLevel())
            {
                CurrentLevel.LoadLast();
                CurrentLevel = CurrentLevel.LastLevel;
            }

            if (smith.prect.Y +  (smith.prect.Height) > Window.ClientBounds.Height + smith.Height)
            {
                Console.WriteLine("Smith is Dead");
                CurrentLevel = L1.getLevel(smith, Window.ClientBounds, white);
                smith.Die();
            }

            foreach (Block b in CurrentLevel.blks)
            {
                if (smith.prect.Intersects(b.Bounds) && b is DeathBlock)
                {
                    Console.WriteLine("Smith is Dead");
                    CurrentLevel = L1.getLevel(smith, Window.ClientBounds, white);
                    smith.Die();
                }
            }

            if (smith.lives <= 0)
            {
                CurrentLevel = AfterLife.getLevel(smith, Screen.Bounds, white, sf);
                smith.action = new Dead(smith.action);
            }

            base.Update(gameTime);
        }
Esempio n. 16
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // sprites

            white = Content.Load<Texture2D>("White");

            Screen.background = Content.Load<Texture2D>("bgnd");

            stexture = Content.Load<Texture2D>("smith");

            Create.TLadder = Content.Load<Texture2D>("ladder");
            Create.TGround = Content.Load<Texture2D>("ground");
            Create.TDeath = Content.Load<Texture2D>("death");

            // fonts
            sf = Content.Load<SpriteFont>("Font");

            EndFont = Content.Load<SpriteFont>("Font2");

            smith = new Smith(stexture, startpos);

            AfterLife.getLevel(smith, Screen.Bounds, white, EndFont);

            Create.t = white;

            CurrentLevel = L1.getLevel(smith, Window.ClientBounds, white);
            CurrentLevel.LoadNext();
        }
Esempio n. 17
0
 public Tower(Level Parent, Vector2 Position)
 {
     parent = Parent;
     position = Position;
     lit_up = false;
 }
Esempio n. 18
0
 public void addOption(String Id, Level.WallType newOption)
 {
     toggleOptions.Add(newOption);
 }
Esempio n. 19
0
 public Level_Button(LevelManager Parent, Level Target)
 {
     parent = Parent;
     target = Target;
     id = target.id;
 }
Esempio n. 20
0
 public void addLevel(Level add)
 {
     levels.Add(add);
     LevelMenu.addMenuItem(new Level_Button(this,add));
 }
Esempio n. 21
0
        public void HandleCollision(Laser l, Level parent)
        {
            /* Is this a laser we're generating? Don't bother! */
            if (m_collisions.ContainsValue(l)) { return; }

            Vector2? pIntersectNullable = l.FindIntersectionPoint(surfaceLineSegment);
            if (pIntersectNullable == null) {
                return;
            }

            Vector2 pIntersect = (Vector2)pIntersectNullable;

            Laser generating = null;

            // Have we already started a laser for this collision?
            if (!m_collisions.ContainsKey(l))
            {
                if (m_type == SurfaceType.Reflective || m_type == SurfaceType.Refractive)
                {
                    generating = new Laser(pIntersect, calculateBounceDirection(l), l.Color);
                    parent.AddLaser(generating);
                }
                m_collisions.Add(l, generating);
            } else {
                generating = m_collisions[l];
            }

            float chompdAmount = l.Chomp(surfaceLineSegment);

            if (m_type == SurfaceType.Reflective || m_type == SurfaceType.Refractive)
            {
                generating.AdjustLength(chompdAmount);
            }

            m_handledCollision.Add(l);
        }
Esempio n. 22
0
        public void deleteLasers(Level parent)
        {
            List<Laser> deleted = new List<Laser>();
            foreach (Laser l in m_collisions.Keys)
            {
                if (!m_handledCollision.Contains(l))
                {
                    // Finish chomping.
                    deleted.Add(l);
                }
            }

            foreach (Laser l in deleted)
            {
                if (m_type == SurfaceType.Reflective)
                {
                    m_collisions[l].AdjustLength(l.Length);
                }
                parent.RemoveLaser(l);
                m_collisions.Remove(l);
            }

            m_handledCollision.Clear();
        }
Esempio n. 23
0
        protected override void LoadContent()
        {
            //Old mouse state
            oldMouseState = Mouse.GetState();

            //Initial selected skill **move or replace**
            skillSelected = "right";
            setSkill = 1;

            //Row and column of tiles
            tileRows = 5;
            tileColumns = 9;
            tileRowSet = false;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Fonts
            Font = Content.Load<SpriteFont>("Font");
            skillHotkeysFont = Content.Load<SpriteFont>("skillHotkeysFont");

            //Starting game status
            gameStatus = "playing";

            //Level 1
            level1 = level1.create(level1, screenWidth, screenHeight);

            //Setup UI
            menu = menu.setupMenu(level1.rectangle.X, level1.rectangle.Y, level1.bkgWidth, level1.bkgHeight);
            menu.image = Content.Load<Texture2D>("ui");

            topBar = topBar.setupTopBar(level1.rectangle.X, level1.rectangle.Y, level1.bkgWidth, level1.bkgHeight);
            topBar.image = Content.Load<Texture2D>("topBar");

            moneySign = moneySign.setupMoneySign(topBar.rectangle.X, topBar.rectangle.Y, level1.bkgWidth);
            moneySign.image = Content.Load<Texture2D>("dollarSign");
            cash.setLocation(moneySign.rectangle.X, moneySign.rectangle.Y);

            mouse.image = Content.Load<Texture2D>("arrowPointer");

            //Setup Tiles
            tiles.setupTiles(250, 10, 100, 100, screenWidth, screenHeight);
            tileArray = tiles.get();
            tiles.image = Content.Load<Texture2D>("skillOverlay");

            //Setup Skills
            setupSkills.setupSkills(menu.rectangle.X, menu.rectangle.Y, menu.rectangle.Height, menu.rectangle.Width);
            skills = setupSkills.getSkillsList();
            setupSkills.placeSkills(skills);
            chosenSkills = setupSkills.getChosenSkillsList();
            setupSkills.setupSkillHotkeys(skills);
            skillHotkeys = setupSkills.getSkillHotkeys();

            //Setup Hotkeys **change when adding user input for settings**
            setupHotkey.setupHotkeys();
            hotkeys = setupHotkey.getHotkeys();

            //Setup Skill Images
            for (int i = 0; i < chosenSkills.Count; i++)
            {
                chosenSkills[i].image = Content.Load<Texture2D>("skillButtons");
            }
        }
Esempio n. 24
0
 public OpenLevelItem()
 {
     target = null;
     parent = null;
 }
Esempio n. 25
0
 public void addPuzzleLevel(Level add)
 {
     levels.Add(add);
     PuzzleMenu.addMenuItem(new Level_Button(this, add));
 }
Esempio n. 26
0
 public void closeLevel()
 {
     currentLevel = null;
 }
Esempio n. 27
0
        int stateChange = 0; //0 is for idle , 1 is for attack for hero

        #endregion Fields

        #region Constructors

        public Hero(ContentManager content, Level level)
        {
            this.content = content;
            this.level = level;
        }
Esempio n. 28
0
 public ToggleWallsButton(Level Target)
 {
     target = Target;
     basicId = "Wall Settings: ";
 }
Esempio n. 29
0
 public void setLevel(Level target)
 {
     target.addPlayers(players);
     target.clearAll();
     currentLevel = target;
     currentLevel.loadImages(CM);
 }
 public Monster(ContentManager content, Level level)
 {
     this.content = content;
     this.level = level;
     setHp(1);
 }