Esempio n. 1
0
 /// <summary>
 /// Initialize all the values of the variables
 /// </summary>
 /// <param name="gd">GraphicsDevice of game</param>
 /// <param name="Content">ContentManager of game</param>
 public static void init(GraphicsDevice gd, ContentManager Content)
 {
     SeekerAnimation["WalkDown"] = new Animation.Animation(Content.Load <Texture2D>("Seeker/WalkinDown"), 4);
     HiderAnimation = new Dictionary <string, Animation.Animation>()
     {
         { "WalkUp", new Animation.Animation(Content.Load <Texture2D>("Hider/WalkingUp"), 4) },
         { "WalkDown", new Animation.Animation(Content.Load <Texture2D>("Hider/WalkingDown"), 4) },
         { "WalkLeft", new Animation.Animation(Content.Load <Texture2D>("Hider/WalkingLeft"), 4) },
         { "WalkRight", new Animation.Animation(Content.Load <Texture2D>("Hider/WalkingRight"), 4) },
     };
     font       = Content.Load <SpriteFont>("Arial");
     START_TIME = DateTime.Now;
     map        = new Map(Content.Load <Texture2D>("mask1"));
     mapScale   = 1;
     rnd        = new Random();
     sb         = new SpriteBatch(gd);
     pixel      = new Texture2D(gd, 1, 1);
     pixel.SetData <Color>(new Color[1] {
         Color.White
     });
     v    = new View();
     maph = new MapHider();
     Stats["MaxFitness"]   = 0;
     Stats["LastFitness"]  = 0;
     Stats["NumOfFounds"]  = 0;
     StartSeekerPos        = StaticClass.GetRandPos();
     MainGame.UpdateEvent += update;
 }
Esempio n. 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            StaticClass.init(base.GraphicsDevice, Content);
            map = new Drawer(Content.Load <Texture2D>("map1"),
                             new Vector2(0, 0),
                             null, Color.White, 0, new Vector2(0),
                             new Vector2(StaticClass.mapScale), SpriteEffects.None, 0);

            InitSeekers();
            hider = new Hider(StaticClass.HiderAnimation, new UserKeys(Keys.Left, Keys.Right, Keys.Up, Keys.Down),
                              StaticClass.GetRandPos(),
                              null, Color.White, 0, new Vector2(StaticClass.HiderAnimation.First().Value.FrameWidth / 2, StaticClass.HiderAnimation.First().Value.FrameHeight / 2),
                              new Vector2(StaticClass.CharacterScale), 0, 0);
            while ((SeekerPop[0].Position - hider.Position).Length() < 400)
            {
                hider.Position = StaticClass.GetRandPos();
            }
            List <IFocus> focus = new List <IFocus>();

            focus.Add(hider);
            //focus.AddRange(SeekerPop);
            cam = new Camera(focus, new Viewport(0, 0, StaticClass.WIDTH, StaticClass.HEIGHT), Vector2.Zero);
        }
Esempio n. 3
0
        /// <summary>
        /// Draw lines on screen
        /// </summary>
        public override void draw()
        {
            float   angele = Rotation + (float)Math.PI / 6;
            Matrix  mat    = Matrix.CreateRotationZ(angele);
            Vector2 step   = Vector2.Transform(Vector2.UnitY, mat);
            Vector2 temp   = Position;

            while (StaticClass.map[temp].ToString() != "Obstacle" && (Position - temp).Length() <= 300)
            {
                temp += step * 2;
            }
            StaticClass.drawVec(Rotation + (float)Math.PI + (float)Math.PI / 6, Position, Color.Blue, (Position - temp).Length(), 3);
            angele = Rotation - (float)Math.PI / 6;
            mat    = Matrix.CreateRotationZ(angele);
            step   = Vector2.Transform(Vector2.UnitY, mat);
            temp   = Position;
            while (StaticClass.map[temp].ToString() != "Obstacle" && (Position - temp).Length() <= 300)
            {
                temp += step * 2;
            }
            StaticClass.drawVec(Rotation + (float)Math.PI - (float)Math.PI / 6, Position, Color.Blue, (Position - temp).Length(), 3);
            base.draw();
        }
Esempio n. 4
0
 public void draw()
 {
     StaticClass.drawVec(dir, l, Color.White, (start - l).Length(), 3);
 }
Esempio n. 5
0
 public void draw()
 {
     StaticClass.drawVec(0, new Vector2(v.X, v.Y + HiderHeight), Color.Red, HiderHeight * 2,
                         HiderWidth * 2);
 }