示例#1
0
 // This is more of a debugging version to let me spawn an object without making up an animation for it
 public AnimatedGameObject(Texture2D texture, Vector2 position)
     : base(texture, position)
 {
     Texture2D[] singleTexture = new Texture2D[1];
         singleTexture[0] = texture;
         Animations = new Animation[1];
         Animations[0] = new Animation(singleTexture, 1, 1);
 }
示例#2
0
 public Projectile(Animation animation, Vector2 Position, Vector2 Velocity, GameObject Target)
     : base(animation, Position, Velocity)
 {
     this.Target = Target;
         RotMode = RotationMode.Velocity;
 }
示例#3
0
 public void HandleButtonPress(object sender, InputStateEventArgs e)
 {
     Console.WriteLine("Button {0} Pressed, at position {1}", Enum.GetName(typeof(AllButtons), e.Button), e.MousePos.ToString());
     string explColor = "debug";
     switch (e.Button) {
         case AllButtons.Q:
             explColor = "ExplosionThreeRedDown";
             break;
         case AllButtons.W:
             explColor = "ExplosionThreeRedLeft";
             break;
         case AllButtons.E:
             explColor = "ExplosionThreeRedRight";
             break;
         case AllButtons.R:
             explColor = "ExplosionThreeRedUp";
             break;
         case AllButtons.A:
             explColor = "ExplosionThreeBlueDown";
             break;
         case AllButtons.S:
             explColor = "ExplosionThreeBlueLeft";
             break;
         case AllButtons.D:
             explColor = "ExplosionThreeBlueRight";
             break;
         case AllButtons.F:
             explColor = "ExplosionThreeBlueUp";
             break;
         case AllButtons.Spacebar:
             if (e.Modifier.HasFlag(ModifierKeys.Alt))
                 throw new Exception();
             explColor = "ExplosionThreeGreen";
             break;
         default:
             return;
     }
     if (e.Button == AllButtons.Spacebar && e.Modifier.HasFlag(ModifierKeys.Alt))
         throw new Exception();
     Animation[] a = new Animation[1];
     a[0] = new Animation(TexManager[explColor], 30);
     a[0].Begin();
     SpawnedAnimations.Add(new AnimatedGameObject(a, e.MousePos.ToVector2()));
 }
示例#4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            TexManager = new TextureManager(Content, GraphicsDevice);
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Background = Content.Load<Texture2D>("Art\\light_sand_template");
            //testLevel = new GameLevel(background);
            this.Window.Position = new Point((graphics.PreferredBackBufferHeight - Background.Height) / 2, (this.graphics.PreferredBackBufferWidth - Background.Width) / 2);
            graphics.PreferredBackBufferHeight = Background.Height / 4 * 3;
            graphics.PreferredBackBufferWidth = Background.Width / 4 * 3;
            graphics.ApplyChanges();
            Texture2D circle = Content.Load<Texture2D>("circle");
            Sphere = new AnimatedGameObject(circle, new Vector2(50, 50));
            DebugAnimation = new Animation(TexManager["ExplosionOneRed"], 20);
            DebugAnimation.Looping = true;
            DebugAnimation.Begin();
            TexManager.requestTextureLoad("ExplosionThreeRed");
            TexManager.requestTextureLoad("ExplosionThreeBlue");
            TexManager.requestTextureLoad("BasicTower");
            TexManager.requestTextureLoad("BasicCreep");
            TexManager.requestTextureLoad("light_sand_template");
            TexManager.requestTextureLoad("BulletSprites");
            TexManager.BeginLoadTextures();
            //  Loader.WriteStandardizedTextures();
            while (TexManager.LoadingTextures == true)
                ;
            TexManager.SplitLaserTexture();
            // While we wait for everything to load - until I implement a proper loading screen
            // Just spin

            DebugCreep = new Creep(new Animation(TexManager["BasicCreep"], 1), new Vector2(100, 100), new Vector2(20f, 20f), 20);
            DebugCreep.RotationZero = new Vector2(0, -1);
            DebugCreep2 = new Creep(DebugCreep.Animations[0], new Vector2(200, 100), new Vector2(50f, 50f), 20);
            DebugCreep2.RotationZero = new Vector2(0, -1);
            DebugTower = new Tower(new Animation(TexManager["BasicTower"], 1), new Vector2(200, 400), 50, .1f);
            DebugTower.AttackType = Projectile.DebugProjectile;
            MainEntityManager.AddCreep(DebugCreep);
            MainEntityManager.AddTower(DebugTower);
            MainEntityManager.AddCreep(DebugCreep2);
            PlayerInputHandler.MouseMovement += MainEntityManager.GetMousePos;
        }
示例#5
0
 public Tower NewTower(Vector2 Position)
 {
     Animation Toweranim = new Animation(TexManager["BasicTower"], 1);
     Animation[] animarr = new Animation[1];
     animarr[0] = Toweranim;
     Tower tower = new Tower(animarr, Position, 50f, 1.5f);
     return tower;
 }
示例#6
0
 /// <summary>
 /// News the explosion.
 /// </summary>
 /// <param name="Position">The position.</param>
 /// <param name="color">The color.</param>
 /// <returns></returns>
 public AnimatedGameObject NewExplosion(Vector2 Position, string color)
 {
     Animation[] Anim = new Animation[1];
     Anim[0] = new Animation(TexManager[color], 40);
     AnimatedGameObject AGO = new AnimatedGameObject(Anim, Position, new Vector2(2, 2));
     AGO.Animations[0].Begin();
     return AGO;
 }
示例#7
0
 public Creep NewCreep(Vector2 Position, Vector2 Velocity)
 {
     Animation CreepAnimation = new Animation(TexManager["BasicCreep"], 1);
     Animation[] AnimationArray = new Animation[1];
     AnimationArray[0] = CreepAnimation;
     Creep C = new Creep(AnimationArray, Position, Velocity, 30);
     return C;
 }
示例#8
0
 public Creep NewCreep(Vector2 Position)
 {
     Animation Creepanim = new Animation(TexManager["BasicCreep"], 1);
     Animation[] animarr = new Animation[1];
     animarr[0] = Creepanim;
     Creep creep = new Creep(animarr, Position, 30);
     return creep;
 }
示例#9
0
 public Creep(Animation animation, Vector2 position, Vector2 velocity, int HP)
     : base(animation, position, velocity)
 {
     this.HP = HP;
     RotMode = RotationMode.Velocity;
 }
示例#10
0
 public Creep(Animation[] animationList, Vector2 position, int HP)
     : base(animationList, position)
 {
     this.HP = HP;
     RotMode = RotationMode.Velocity;
 }
示例#11
0
 public AnimatedGameObject(Animation animation, Vector2 position, Vector2 velocity)
     : base(animation.getIdleTexture(), position, velocity)
 {
     Animations = new Animation[1];
     Animations[0] = animation;
 }
示例#12
0
 public AnimatedGameObject(Animation[] animationList, Vector2 position, Vector2 velocity)
     : base(animationList[0].getIdleTexture(), position, velocity)
 {
     Animations = animationList;
 }
示例#13
0
 public Tower(Animation animation, Vector2 position, float range, float CD)
     : base(animation, position)
 {
     Range = range;
         Cooldown = CD;
 }