Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows.Media;
- namespace SimFishLib
- {
- public delegate void MoveRandom();
- public delegate void Move(int i);
- public class Fish
- {
- public int X { get; set; }
- public int Y { get; set; }
- public string GUID { get; set; }
- public SolidColorBrush b { get; set; }
- Random rnd = new Random();
- public bool side = true;
- public Move MoveNearX;
- public Move MoveNearY;
- public void MoveNearXPlus(int i)
- {
- int tmp = (rnd.Next(5, 10) + i);
- while (tmp > 400) tmp = (400 % tmp);
- if(tmp < 0) tmp = (int)System.Math.Abs(tmp);
- this.X = tmp;
- }
- public void MoveNearYPlus(int i)
- {
- int tmp = (rnd.Next(5, 10) + i);
- while (tmp > 400) tmp = (400 % tmp);
- if (tmp < 0) tmp = (int)System.Math.Abs(tmp);
- this.Y = tmp;
- }
- public MoveRandom MoveX;
- public MoveRandom MoveY;
- public void MoveXPlus()
- {
- this.X += rnd.Next(1, 10);
- }
- public void MoveXMinus()
- {
- this.X -= rnd.Next(1, 10);
- }
- public void MoveYPlus()
- {
- this.Y += rnd.Next(1, 10);
- }
- public void MoveYMinus()
- {
- this.Y -= rnd.Next(1, 10);
- }
- public Fish(int i)
- {
- X = i + 1;
- Y = 100;
- Random r = new Random();
- Color c = new Color();
- c.B = (byte)X;
- c.R = (byte)Y;
- c.G = (byte)r.Next(1, 255);
- c.A = (byte)255;
- b = new SolidColorBrush(c);
- this.GUID = new Guid().ToString();
- MoveX = MoveXPlus;
- MoveY = MoveYPlus;
- MoveNearX = MoveNearXPlus;
- MoveNearY = MoveNearYPlus;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement