Ejemplo n.º 1
0
        public override void Update(GameTime gameTime, ObjectPlayer player, MapBase map)
        {
            if (health > 0)
            {
                Vector2 releventPlayerPosition = new Vector2(player.Position.X + Convert.ToInt32(map.Offset.X), player.Position.Y + Convert.ToInt32(map.Offset.Y));

                this.Rotation = float.Parse(GameFunctions.GetAngle(this.Position, releventPlayerPosition).ToString());

                int rot = Convert.ToInt32(MathHelper.ToDegrees(float.Parse(this.Rotation.ToString()))) - 90;
                double xs = Math.Cos((rot * Math.PI) / 180);
                double xy = Math.Sin((rot * Math.PI) / 180);
                Vector2 OldPos = this.Position;
                this.Position = new Vector2(this.Position.X - float.Parse(xs.ToString()), this.Position.Y - float.Parse(xy.ToString()));
                this.BoundingRectangle = new Rectangle(Convert.ToInt32(this.Position.X - ((Texture.Width * scale) / 2)), Convert.ToInt32(this.Position.Y - ((Texture.Height * scale) / 2)), Convert.ToInt32(Texture.Width * scale), Convert.ToInt32(Texture.Height * scale));

                //Hit Test!
                float dis = Vector2.Distance(this.Position, releventPlayerPosition);
                Vector2 MV = (this.Position - releventPlayerPosition) * .05f;// / dis;
                if (dis < 40)
                {
                    this.Position = OldPos;
                    this.Position = this.Position + MV;
                    //player.Position = player.Position - MV;
                    player.Health -= 1;
                }
            }
            base.Update(gameTime);
        }
Ejemplo n.º 2
0
        public override void LoadContent()
        {
            //Player:
            Content.AddTexture2D("Player\\debug", "Player");
            player = (ObjectPlayer)Objects.AddObject(ObjectPool.ObjectTypes.Player, "Player", "Player");
            player.Position = new Vector2((GraphicsDevice.Viewport.Width / 2) - Convert.ToInt32((player.Texture.Width * player.Scale) / 2), (GraphicsDevice.Viewport.Height / 2) - Convert.ToInt32((player.Texture.Height * player.Scale) / 2));

            //Cursor:
            Content.AddTexture2D("Cursors\\Scope", "Cursor");
            cursor = (ObjectCursor)Objects.AddObject(ObjectPool.ObjectTypes.Cursor, "Cursor", "Cursor");
            cursor.Position = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);

            Content.AddTexture2D("Misc\\Clear\\1x1white", "1x1white");
            Content.AddTexture2D("Misc\\dialog", "debugdialog");

            //Map:
            testmap.LoadContent();
            //Weapons:
            weaponEngine.LoadContent();
            weaponEngine.AddAvailableWeapon(new Glock());
            weaponEngine.AddAvailableWeapon(new USP());

            //Debugging:
            dbvar = new DebugVar("MainFont", Content);
            dbvar.Add(weaponEngine.CurrentWeapon.Name, "Current Weapon");
            dbvar.Add(Content.Count, "Total Content");
            dbvar.Add((Objects.Count + testmap.Objects.Count), "Total Objects");
            dbvar.Add(Mouse.GetState().X, "Mouse X");
            dbvar.Add(Mouse.GetState().Y, "Mouse Y");
            dbvar.Add("", "Clip");
            Achivement = new AchivementEngine();
            Achivement.LoadContent(Objects, Content);

            base.LoadContent();
        }
Ejemplo n.º 3
0
 public override void Update(GameTime gameTime, ObjectPlayer player, MapBase map)
 {
     if (Math.Abs(Convert.ToInt32(Position.Y - map.Offset.Y - originalOffset.Y)) > Texture.Width)
     {
         Position = new Vector2(Position.X, Convert.ToInt32(map.Offset.Y) + originalOffset.Y);
     }
     if (Math.Abs(Convert.ToInt32(Position.X - map.Offset.X - originalOffset.X)) > Texture.Height)
     {
         Position = new Vector2(Convert.ToInt32(map.Offset.X) + originalOffset.X, Position.Y);
     }
     base.Update(gameTime);
 }
Ejemplo n.º 4
0
        public override void Update(GameTime gameTime, MapBase map, ObjectPlayer player)
        {
            for (int i = 0; i < Objects.Keys.Count;i++)
            {
                string[] arrayShit = new string[Objects.Keys.Count];
                Objects.Keys.CopyTo(arrayShit,0);
                string ObjectKey = arrayShit[i];
                ObjectBase Object = (ObjectBase)Objects[ObjectKey];
                switch (Object.Type)
                {
                    case ObjectPooling.ObjectPool.ObjectTypes.Enemy:
                        Object.Update(gameTime, player, map);
                        break;

                    case ObjectPooling.ObjectPool.ObjectTypes.EnemySpawner:
                        Object.Update(gameTime, map, ObjectPool);
                        break;
                }
            }
            base.Update(gameTime, map, player);
        }
Ejemplo n.º 5
0
        public virtual void Update(GameTime gameTime, ObjectPlayer player, MapBase map)
        {

        }
Ejemplo n.º 6
0
        public virtual void Update(GameTime gameTime, ObjectPlayer player)
        {

        }