public FinalCell(TissueCell parentCell) : base(parentCell) { initializeFinalCell(); //if (parentCell.GetType() == typeof(BlastCell)) //{ // this.generation = 1; // if (SimulationCore.DEBUG) // { // if (parentCell.CellBehaviors.GetType() == typeof(GOBehaviorAggregate)) // throw new NotImplementedException("have not implemented GO behaviors yet"); // } // //cellBehaviors = new SimpleBehaviorAggregate(SimulationCore.Instance.SimulationParams.FinalCellConfig); //} cellBehaviors = new SimpleBehaviorAggregate((SimpleBehaviorAggregate)parentCell.CellBehaviors); if (parentCell.GetType() == typeof(FinalCell)) this.generation = ((FinalCell)parentCell).generation + 1; //cellBehaviors = new SimpleBehaviorAggregate((SimpleBehaviorAggregate)parentCell.CellBehaviors); /* else if (parentCell.GetType() == typeof(FinalCell)) { this.generation = ((FinalCell)parentCell).generation + 1; cellBehaviors = new SimpleBehaviorAggregate((SimpleBehaviorAggregate)parentCell.CellBehaviors); } * */ }
public PeriodicalSignal(TissueCell parentCell, int strength, int maxRange, int growTime) : base(parentCell) { this.maxRange = maxRange; this.growTime = growTime; this.strength = strength; signalWaves = new List<SignalWave>(); SignalWave newWave = new SignalWave(this, maxStrength, maxRange); signalWaves.Add(newWave); currentTime = 1; affectedLocations.UnionWith(newWave.CurrentPosition); affectedLocations.UnionWith(newWave.PreviousPosition); foreach (Vector3 affectedLoc in affectedLocations) // step through every new location { if (Environment.Instance.GoodPoint(affectedLoc)) // if its valid Environment.Instance.GetContentsAt(affectedLoc).SignalsAffectingThisLocation.Add(this); // add this signal from that location } }
public Signal(TissueCell parentCell) { this.parentCell = parentCell; affectedLocations = new HashSet<Vector3>(); }
public void RemoveCell(TissueCell cell) { cellCount--; cellPipeRatio = pipeValue / cellCount; }
public void AddCell(TissueCell cell) { cellCount++; cellPipeRatio = pipeValue / cellCount; }
public BlastCell(TissueCell parentCell) : base(parentCell) { cellBehaviors = new SimpleBehaviorAggregate((SimpleBehaviorAggregate)parentCell.CellBehaviors); initializeBlastCell(); }
public void DeleteCell(TissueCell deadCell) { dyingCells.Add(deadCell); if (deadCell.Mutated) MutatedCellTotal--; // for the cell count if (deadCell.GetType() == typeof(FinalCell)) Environment.Instance.FinalCellTotal--; else if (deadCell.GetType() == typeof(BlastCell)) Environment.Instance.BlastCellTotal--; else throw new Exception("unsupported cell type"); }
public void AddNewCell(TissueCell newCell) { newCells.Add(newCell); if (newCell.Mutated) MutatedCellTotal++; // for the cell count if (newCell.GetType() == typeof(FinalCell)) FinalCellTotal++; else if (newCell.GetType() == typeof(BlastCell)) BlastCellTotal++; else throw new Exception("unsupported cell type"); }
public void RemoveHungryCell(TissueCell c) { hungryCells.Remove(c); }
public PleaseMoveSignal(TissueCell parentCell, int range, int strength) : base(parentCell, strength, range, PleaseMoveSingnalGrowTime) { }
public void AddHungryCell(TissueCell c) { hungryCells.Add(c); }
private EndothelialCell pipeSearchParent(TissueCell target, EndothelialCell currPos, int currDistance) { if (currPos.Parent == null) return currPos; int tmpDistance = UtilityMethods.CityBlockDistance(currPos.Parent.CellLocation, target.CellLocation); if (tmpDistance < currDistance) return pipeSearchParent(target, currPos.Parent, tmpDistance); else return currPos; }
private EndothelialCell pipeSearchChildren(TissueCell target, EndothelialCell currPos, int currDistance) { if (currPos.Children.Count == 0) return currPos; int tmpDistance; EndothelialCell bestChild = null; foreach (EndothelialCell child in currPos.Children) { tmpDistance = UtilityMethods.CityBlockDistance(child.CellLocation, target.CellLocation); if (tmpDistance < currDistance) { currDistance = tmpDistance; bestChild = child; } } if (bestChild == null) return currPos; else return pipeSearchChildren(target, bestChild, currDistance); }
private EndothelialCell pipeSearch(TissueCell target, EndothelialCell startingLocation) { Vector3 targetLocation = target.CellLocation; int currDistance = UtilityMethods.CityBlockDistance(startingLocation.CellLocation, targetLocation); EndothelialCell parent = pipeSearchParent(target, startingLocation, currDistance); int pDistance = UtilityMethods.CityBlockDistance(parent.CellLocation, targetLocation); EndothelialCell child = pipeSearchChildren(target, startingLocation, currDistance); int cDistance = UtilityMethods.CityBlockDistance(child.CellLocation, targetLocation); if (pDistance < cDistance) return parent; return child; }
private EndothelialCell findClosestPipeSectionTo(TissueCell hungryCell) { Vector3 hungryCellLocation = hungryCell.CellLocation; EndothelialCell closestCell = pipeCells[0]; double closestDistance = UtilityMethods.CityBlockDistance(closestCell.CellLocation, hungryCellLocation); double dist; for(int i=1; i<pipeCells.Count; i++){ // can use higher step count for efficieny, for ex step through every 3 or 4 cells. dist = UtilityMethods.CityBlockDistance(pipeCells[i].CellLocation, hungryCellLocation); if(dist < closestDistance){ closestDistance = dist; closestCell = pipeCells[i]; } } return closestCell; }