Ejemplo 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;
 }
Ejemplo 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);
        }