Example #1
0
 private void Die()
 {
     stats.UpdateAverages(this, StatType.Death);
     if (!die)
     {
         FruitSpawner.MakeFruit(transform.position, fruitPrefab);
     }
     Destroy(this.gameObject);
     Destroy(this);
 }
Example #2
0
    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);
    }