public static BlobModel MutateBlobModel(BlobModel parent) { var child = MutationController.MutateFrom(parent); child.Id = _idCounter++; return(child); }
private void CreateBlob(BlobModel blobModel, Vector3 position) { var blob = BlobFactory.InstantiateBlob(BlobPrefab, blobModel, _worldModel, position, RemoveBlob, CreateBlob, EatFood); blob.Terrain = terrain; _blobsToAdd.Add(blob); }
public static BlobModel MutateFrom(BlobModel parent) { return(new BlobModel() { Color = MutateColor(parent.Color), MovementSpeed = MutateMovementSpeed(parent.MovementSpeed), Size = MutateSize(parent.Size), SensorRadius = MutateSensorRadius(parent.SensorRadius) }); }
public static BlobModel CopyBlobModel(BlobModel parent) { return(new BlobModel() { Color = parent.Color, Id = _idCounter++, Size = parent.Size, MovementSpeed = parent.MovementSpeed, SensorRadius = parent.SensorRadius }); }
public static BlobController InstantiateBlob( GameObject prefab, BlobModel blobModel, WorldModel worldModel, Vector3 position, Action <BlobController> onDeath, Action <BlobModel, Vector3> onReplicate, Action <BlobController, IEdible> onEat) { var blobGameObject = GameObject.Instantiate(prefab, position, Quaternion.identity); var blobController = blobGameObject.GetComponent <BlobController>(); blobController.Initialize(position, blobModel, worldModel, () => onDeath(blobController), onReplicate, edible => onEat(blobController, edible)); return(blobController); }