Пример #1
0
 public Box(int line, int column, Map map)
 {
     _map              = map;
     _line             = line;
     _column           = column;
     _ground           = BoxGround.Grass;
     _relativePosition = new Point(line, column);
     _relativeSize     = new Size(_map.BoxSize, _map.BoxSize);
     _animalList       = new List <Animal>();
 }
Пример #2
0
 public Animal(Map map, Point position, Size size, AnimalTexture texture)
 {
     _map                  = map;
     _position             = position;
     _size                 = size;
     _texture              = texture;
     _direction            = new SizeF(0, 0);
     _favoriteEnvironnment = BoxGround.Grass;
     _viewDistance         = 1000;
 }
Пример #3
0
 public void ChangeTexture(BoxGround SelectedTexture)
 {
     if (this.IsChangeTextureSelected)
     {
         foreach (Box box in this.SelectedBox)
         {
             box.Ground = SelectedTexture;
         }
     }
     if (this.IsFillTextureSelected)
     {
         foreach (Box box in this.SelectedBox)
         {
             this.FillBox(box, box.Ground, SelectedTexture);
         }
     }
 }
Пример #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _selectedAnimal     = AnimalTexture.Rabbit;
            _fpsCount           = 0;
            this.DoubleBuffered = true;
            button1.Text        = "Hide Debug";
            _selectedTexture    = BoxGround.Grass;
            _background         = new Bitmap(this.Width, this.Height);

            _map = new Map(50, 2);

            _boxWidth = _map.BoxSize;

            _viewPort      = new MainViewPort(_map);
            _map.ShowDebug = true;
            _mouseRect     = new Rectangle(0, 0, 100, 100);

            g = this.CreateGraphics();
            _screenGraphic = Graphics.FromImage(_background);
            _screenGraphic.CompositingQuality = CompositingQuality.HighSpeed;
            _screenGraphic.InterpolationMode  = InterpolationMode.Low;


            _selectionCursorWidth = new Size(_boxWidth, _boxWidth);
            this.MouseWheel      += new MouseEventHandler(T_mouseWheel);

            t    = new System.Windows.Forms.Timer();
            fpst = new System.Windows.Forms.Timer();


            fpst.Interval = 200;
            fpst.Tick    += new EventHandler(fpst_Tick);

            t.Interval = 10;
            t.Tick    += new EventHandler(t_Tick);

            fpst.Start();
            t.Start();
            _soundEnvironment = new SoundEnvironment();
            _soundEnvironment.LoadMap(_map);
        }
Пример #5
0
 /// <summary>
 /// Select the boxes with the targetedColor texture, and remplace them with the desired Color
 /// </summary>
 /// <param name="target"></param>
 /// <param name="targetColor">Texture you wish to change</param>
 /// <param name="Color">Remplacement color</param>
 public void FillBox(Box target, BoxGround targetColor, BoxGround Color)
 {
     if (target.Ground == targetColor && Color != target.Ground)
     {
         target.Ground = Color;
         if (target.Top != null)
         {
             FillBox(target.Top, targetColor, Color);
         }
         if (target.Bottom != null)
         {
             FillBox(target.Bottom, targetColor, Color);
         }
         if (target.Left != null)
         {
             FillBox(target.Left, targetColor, Color);
         }
         if (target.Right != null)
         {
             FillBox(target.Right, targetColor, Color);
         }
     }
 }
Пример #6
0
 private void buttonMountain_Click(object sender, EventArgs e)
 {
     _selectedTexture = BoxGround.Mountain;
 }
Пример #7
0
 private void _grassButton_Click(object sender, EventArgs e)
 {
     _selectedTexture = BoxGround.Grass;
 }
Пример #8
0
 private void _desertButton_Click(object sender, EventArgs e)
 {
     _selectedTexture = BoxGround.Desert;
 }
Пример #9
0
 private void _snowButton_Click(object sender, EventArgs e)
 {
     _selectedTexture = BoxGround.Snow;
 }
Пример #10
0
 private void _waterButton_Click(object sender, EventArgs e)
 {
     _selectedTexture = BoxGround.Water;
 }