public override void Process() { Processed = true; if (TimeToFeed == 0) { Ocean1[OffSet] = null; Ocean1.NumMegalodon -= 1; } else { var foodCoord = GetSharkNeighborCoord(OffSet) ?? GetPreyNeighborCoord(OffSet); Coordinate initCoord = (Coordinate)OffSet.Clone(); if (foodCoord != null) { if (Ocean1[foodCoord] is Prey) { if (Ocean1[foodCoord] is Tuna) { Ocean1.NumTuna -= 1; } else { Ocean1.NumStingray -= 1; } } else { Ocean1.NumShark -= 1; } Ocean1.NumEaten += 1; TimeToFeed = InitTimeToFeed; MoveTo(initCoord, foodCoord); if (TimeToReproduce == 0) { Reproduce(initCoord); } } else { Coordinate newCoord = GetEmptyNeighborCoord(OffSet); TimeToFeed -= 1; if (newCoord != null) { TimeToReproduce -= 1; MoveTo(initCoord, newCoord); if (TimeToReproduce == 0) { Reproduce(initCoord); } } } } }
public void setOffSet(OffSet off) { if (off == OffSet.Center) { foreach (Animation animation in animations) { animation.origin = animation.getFrameDimensions(); animation.origin /= 2; } } else if (off == OffSet.BottomCenterHorizontal) { foreach (Animation animation in animations) { animation.origin = animation.getFrameDimensions(); animation.origin.X /= 2; } } }
public override string BuildUrl() { this.Url = this.EndPoint; // build URL string checkValue("datasetid", DatasetId); checkValue("datacategoryid", DatacategoryId); checkValue("locationid", LocationId); checkValue("datatypeid", DatatypeId); checkValue("startdate", From); checkValue("enddate", To); if (Limit <= 0) { Limit = DefaultValues.Limit; } checkValue("limit", Limit.ToString()); checkValue("offset", OffSet.ToString()); checkValue("sortfield", SortBy); checkValue("sortorder", Order); return(this.Url); }
public virtual void Process() { Processed = true; Coordinate newCoord = GetEmptyNeighborCoord(OffSet); Coordinate initCoord = (Coordinate)OffSet.Clone(); if (newCoord != null) { if (TimeToReproduce > 0) { TimeToReproduce -= 1; } MoveTo(initCoord, newCoord); if (TimeToReproduce == 0) { TimeToReproduce = InitTimeToReproduce; Reproduce(initCoord); } } }
public override void Process() { Processed = true; if (_timeToFeed == 0) { Ocean1[OffSet] = null; Ocean1.NumPredators -= 1; } else { Coordinate foodCoord = GetPreyNeighborCoord(OffSet); Coordinate initCoord = (Coordinate)OffSet.Clone(); if (foodCoord != null) { Ocean1.NumEaten += 1; _timeToFeed = _initTimeToFeed; MoveTo(initCoord, foodCoord); Ocean1.NumPreys -= 1; if (TimeToReproduce == 0) { Reproduce(initCoord); } } else { Coordinate newCoord = GetEmptyNeighborCoord(OffSet); _timeToFeed -= 1; if (newCoord != null) { TimeToReproduce -= 1; MoveTo(initCoord, newCoord); if (TimeToReproduce == 0) { Reproduce(initCoord); } } } } }
public Particule(Vector2 position, float speed, OffSet offset = OffSet.Center) : base(offset) { this.position = position; this.speed = speed; }
public GraphicObj(OffSet offSet = OffSet.None) { animations = new List <Animation>(); components = new List <IComponent>(); this.offSet = offSet; }
/// <summary> /// Constructor, making an empty dictionary, and setting offset /// from origin and cell dimensions /// </summary> public ManhattanShapes(MapWinGIS.Point p, double dX, double dY) { ShapesTable = new Dictionary <int, Data>(); offset = new OffSet(p, dX, dY); }
/// <summary> /// Constructor, making an empty dictionary, and setting offset /// from header. /// </summary> public ManhattanShapes(MapWinGIS.GridHeader h) { ShapesTable = new Dictionary <int, Data>(); offset = new OffSet(h); }