Пример #1
0
        public bool UpdateCreep(Creep creep, int PathIndex)
        {
            if (PathIndex >= WaypointArray.Length - 1)
                return false;

            Vector2 WaypointDirection = creep.Velocity;
            Vector2 CreepDirection = WaypointArray[PathIndex] - creep.Center;
            // If the creep is still going in the right direction
            if (Math.Sign(WaypointDirection.X) == Math.Sign(CreepDirection.X) && Math.Sign(WaypointDirection.Y) == Math.Sign(CreepDirection.Y))
                return false;
            CreepDirection = WaypointArray[PathIndex + 1] - creep.Center;
            CreepDirection.Normalize();
            creep.Velocity = creep.Velocity.Rotate(CreepDirection);
            return true;
        }
Пример #2
0
 public void AddCreep(Creep creep)
 {
     creep.Center = creepPath.Beginning();
     CreepWaypointDict.Add(creep, 1);
 }
Пример #3
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;
        }
Пример #4
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;
 }
Пример #5
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;
 }
Пример #6
0
 public void AddCreep(Creep creep)
 {
     creep.Center = creepPath.Beginning();
     CreepWaypointDict.Add(creep, 1);
 }