private void Die() { stats.UpdateAverages(this, StatType.Death); if (!die) { FruitSpawner.MakeFruit(transform.position, fruitPrefab); } Destroy(this.gameObject); Destroy(this); }
public void DropFruit() { if (!isOnMap) { return; } Vector3 randomSpawnPosition = LocationUtil.GetRandomSpotAroundPosition(transform.localScale.x * 3, transform.position); var fruit = FruitSpawner.MakeFruit(randomSpawnPosition, fruitPrefab); if (fruit == null) { return; } // pass those genes along! // genetic drift will happen on germination, not here fruit.gestation = lifespan / 100; fruit.genes = new TreeGenes(growDropRatio, lifespan, fastGrowTime, mediumGrowTime, slowGrowTime); }