private void ProcessDeadChoppers() { var deadMeatChopperPoints = Global.Board.Get(Element.DeadMeatChopper); foreach (var deadMeatChopperPoint in deadMeatChopperPoints) { AllChoppers.RemovePoint(deadMeatChopperPoint); } }
public void Init() { //AllBombs.Tick(); ProcessDeadChoppers(); var liveMeatChopperPoints = Global.Board.GetMeatChoppers(); foreach (var liveMeatChopperPoint in liveMeatChopperPoints) { var nearPrevStepChoppers = NonConflictChoppers .Where(x => x.IsNear(liveMeatChopperPoint)) .ToList(); if (nearPrevStepChoppers.Any()) { if (nearPrevStepChoppers.Count() == 1) { nearPrevStepChoppers.First().CalculateAndSetDirection(liveMeatChopperPoint); } else { nearPrevStepChoppers.ForEach(x => x.SetConflict()); } } else { AllChoppers.Add(new Chopper(liveMeatChopperPoint, true)); } } AllChoppers.RemoveAll(x => !x.IsOnBoard); AllChoppers.ForEach(x => x.ResetStateFlags()); AllChoppers.ForEach(x => x.InitBoardPoints()); //Console.WriteLine("choppers at board: " + AllChoppers.Count); }
public Chopper Get(Point point) { return(AllChoppers.FirstOrDefault(x => x.Point.Equals(point) || x.BoardPoints.Any(y => y.Point.Equals(point)))); }