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>(); }
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; }
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); } } }
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); }
/// <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); } } }
private void buttonMountain_Click(object sender, EventArgs e) { _selectedTexture = BoxGround.Mountain; }
private void _grassButton_Click(object sender, EventArgs e) { _selectedTexture = BoxGround.Grass; }
private void _desertButton_Click(object sender, EventArgs e) { _selectedTexture = BoxGround.Desert; }
private void _snowButton_Click(object sender, EventArgs e) { _selectedTexture = BoxGround.Snow; }
private void _waterButton_Click(object sender, EventArgs e) { _selectedTexture = BoxGround.Water; }