Ejemplo n.º 1
0
        public static BlobModel MutateBlobModel(BlobModel parent)
        {
            var child = MutationController.MutateFrom(parent);

            child.Id = _idCounter++;
            return(child);
        }
Ejemplo n.º 2
0
        private void CreateBlob(BlobModel blobModel, Vector3 position)
        {
            var blob = BlobFactory.InstantiateBlob(BlobPrefab, blobModel, _worldModel, position, RemoveBlob, CreateBlob, EatFood);

            blob.Terrain = terrain;


            _blobsToAdd.Add(blob);
        }
Ejemplo n.º 3
0
 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)
     });
 }
Ejemplo n.º 4
0
 public static BlobModel CopyBlobModel(BlobModel parent)
 {
     return(new BlobModel()
     {
         Color = parent.Color,
         Id = _idCounter++,
         Size = parent.Size,
         MovementSpeed = parent.MovementSpeed,
         SensorRadius = parent.SensorRadius
     });
 }
Ejemplo n.º 5
0
        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);
        }