Exemplo n.º 1
0
        public Menu(string _name, List<Buttons.Button> _buttons)
        {

            name = _name;
            buttons = _buttons;
            texture = Managers.AssetManager.GetTextureAsset(name);
        }
Exemplo n.º 2
0
 public Button(Vector2 _position, string _name)
 {
     size = new Point(240, 50);
     //enabled = true;
     name = _name;
     position = _position;
     texture = Managers.AssetManager.GetTextureAsset(name);
     hitBox = new Rectangle((int)position.X, (int)position.Y, texture.sprite.Width, texture.sprite.Height);
 }
 private static void SetNormalsOpaqueTexture(Assets.Texture normalTexture)
 {
     EngineManager.Device.SamplerStates[1] = SamplerState.PointClamp;
     // It’s not enough to compare the assets, the resources has to be different because the resources could be regenerated when a device is lost.
     if (lastUsedNormalsOpaqueTexture != normalTexture.Resource)
     {
         lastUsedNormalsOpaqueTexture = normalTexture.Resource;
         epNormalsOpaqueTexture.SetValue(normalTexture.Resource);
     }
 } // SetNormalsOpaqueTexture
 private static void SetDepthFoliageTexture(Assets.Texture depthTexture)
 {
     EngineManager.Device.SamplerStates[2] = SamplerState.PointClamp;
     // It’s not enough to compare the assets, the resources has to be different because the resources could be regenerated when a device is lost.
     if (lastUsedDepthFoliageTexture != depthTexture.Resource)
     {
         lastUsedDepthFoliageTexture = depthTexture.Resource;
         epDepthFoliageTexture.SetValue(depthTexture.Resource);
     }
 } // SetDepthFoliageTexture
Exemplo n.º 5
0
 public static void CreateTextureAsset(string name, string data, Texture2D sprite)
 {
     int i = 0;
     int[] vertData = new int[3];
     split = data.Split(',');
     foreach (string csv in split)
     {
         vertData[i] = Convert.ToInt32(csv);
         i++;
     }
     texture = new Assets.Texture(name, sprite, vertData[0], vertData[1], vertData[2]);
     textures.Add(name, texture);
 }
Exemplo n.º 6
0
 public Enemy(Vector2 _position, string _name) : base(_position, _name)
 {
     gravity = 0.2f;
     endTime = 300f;
     colorTimer = endTime + 1;
     state = new States.Enemy.EnemyIdle();
     animStarts = Managers.AssetManager.GetAnimIndexes(name)[0];
     animEnds = Managers.AssetManager.GetAnimIndexes(name)[1];
     animStarts = new List<Point>();
     animEnds = new List<Point>();
     animStarts = Managers.AssetManager.GetAnimIndexes(name)[0];
     animEnds = Managers.AssetManager.GetAnimIndexes(name)[1];
     NewAnimation(state.animState);
     flip = SpriteEffects.None;
     knockbackSpeed = 2f;
     heart = Managers.AssetManager.GetTextureAsset("Heart");
 }
Exemplo n.º 7
0
 public Editor(Elements.Level level, int _changeIndex)
 {
     changeIndex = _changeIndex;
     editing = level;
     camMoveSpeed = 8;
     editing.NewEditLevel(changeIndex);
     input = '.';
     exported = false;
     help = false;
     back = false;
     endFilling = false;
     filling = false;
     startFill = Point.Zero;
     endFill = Point.Zero;
     selectTexture = AssetManager.GetTextureAsset("Select");
     Managers.Camera.NewLevel();
     editing.EditUpdate();
 }
Exemplo n.º 8
0
 public SwingingBall(Vector2 _position, string _name, float _delay) : base(_position, _name)
 {
     delay = _delay;
     angle = 0f;
     hitCircle = new Circle(new Vector2(position.X + ((Tile.width / 2)), position.Y + ((Tile.width / 2))), (Tile.width / 2));
     chainTexture = Managers.AssetManager.GetTextureAsset("Chain");
     radians = (angle / 180f) * (float)Math.PI;
     chainrads = ((angle - 90) / 180f) * (float)Math.PI;
     Vector2 aposition = new Vector2((int)(position.X) + Tile.width / 2, (int)(position.Y) + Tile.height / 2);
     Vector2 rot = new Vector2((Tile.width * 1.1f) * (float)Math.Cos(radians), (Tile.height * 1.1f) * (float)Math.Sin(radians));
     Vector2 origin = new Vector2(0, 0);
     aposition.X += (int)rot.X;
     aposition.Y += (int)rot.Y;
     hitCircle = new Circle(new Vector2(
         aposition.X
         , aposition.Y)
         , (Tile.width / 2) * 0.8f);
 }
Exemplo n.º 9
0
 public GameObject(Vector2 _position, string _name)
 {
     position = _position;
     name = _name;
     texture = Managers.AssetManager.GetTextureAsset(name);
 }
Exemplo n.º 10
0
 public Tile(Assets.Texture _texture, TileType _type, string _name)
 {
     name = _name;
     texture = _texture;
     type = _type;
 }
Exemplo n.º 11
0
 public Player(Level _level, Vector2 _position)
 {
     name = "Player";
     pressedKeys = Managers.User.kState.GetPressedKeys();
     level = _level;
     heartAsset = Managers.AssetManager.GetTextureAsset("Heart");
     position = _position;
     startHearts = 3;
     velocity = new Vector2();
     texture = Managers.AssetManager.GetTextureAsset(name);
     animStarts = Managers.AssetManager.GetAnimIndexes(name)[0];
     animEnds = Managers.AssetManager.GetAnimIndexes(name)[1];
     state = new States.Idle();
     equip = new States.Equip();
     moveAcceleration = 0.25f;
     maxFallSpeed = 15f;
     ignoreTile = Rectangle.Empty;
     gravityAcceleration = 0.15f;
     maxSpeed = 2.5f;
     jumpAcceleration = 3.4f;
     flip = SpriteEffects.None;
     NewAnimation(state.animState);
     effectState = null;
     immune = false;
     collCheck = false;
     midPoint = new Point(Hitbox.X + (Hitbox.Width / 2), Hitbox.Y + (Hitbox.Height / 2));
     circCollPoints = new List<Vector2>();
     circCollPoints.Add
         (new Vector2(Hitbox.X, Hitbox.Y));
     circCollPoints.Add
         (new Vector2(Hitbox.X + Hitbox.Width, Hitbox.Y));
     circCollPoints.Add
         (new Vector2(Hitbox.X, Hitbox.Y + Hitbox.Height));
     circCollPoints.Add
         (new Vector2(Hitbox.X + Hitbox.Width, Hitbox.Y + Hitbox.Height));
     circCollPoints.Add
         (new Vector2(Hitbox.X, Hitbox.Y + (Hitbox.Height / 2)));
     circCollPoints.Add
         (new Vector2(Hitbox.X + Hitbox.Width, Hitbox.Y + (Hitbox.Height / 2)));
     equip.EquipItem(this, new Items.TorchItem(position, "Torch", new Light(Color.White, 0.2f, LightType.Point, new Point((int)position.X, (int)position.Y))));
 }
Exemplo n.º 12
0
 public void NewEditLevel(int changeIndex)
 {
     border = Managers.AssetManager.GetTextureAsset("Border");
     background = Managers.AssetManager.GetTextureAsset("Level0");
     if (changeIndex == 0 || changeIndex == 2)
         for (int x = 0; x < charMap.GetLength(0); x++)
         {
             for (int y = 0; y < charMap.GetLength(1); y++)
             {
                 charMap[x, y] = '.';
             }
         }
     Managers.Camera.NewLevel();
 }
Exemplo n.º 13
0
        public void LoadLevel()
        {
            signData = Managers.Executive.signData[index];
            signIndex = 0;
            try
            {
                background = Managers.AssetManager.GetTextureAsset("Level" + index);
            }
            catch
            {
                background = Managers.AssetManager.GetTextureAsset("Level0");
            }
            Main.ChangeState(Main.GameState.Playing);

            for (int x = 0; x < charMap.GetLength(0); x++)
            {
                for (int y = 0; y < charMap.GetLength(1); y++)
                {
                    tileMap[x, y] = GenerateTile(charMap[x, y], x, y);
                }
            }

            for (int x = 0; x < backCharMap.GetLength(0); x++)
            {
                for (int y = 0; y < backCharMap.GetLength(1); y++)
                {
                    backTileMap[x, y] = GenerateBackTile(backCharMap[x, y], x, y);
                }
            }
            if (player == null)
                throw new NotSupportedException(String.Format("No starting position on level {0}", index));
            Managers.Executive.level = this;
            Managers.Camera.NewLevel();
        }