Ejemplo n.º 1
0
        void SpawnAnimal(Vector3 spawnPosition, float direction)
        {
            GameObject animal = GameObject.Instantiate(AreaPalettes [CurrentArea].Animals [Random.Range(0, AreaPalettes [CurrentArea].Animals.Count - 1)], spawnPosition, Quaternion.identity);

            animal.transform.localScale = new Vector2(1, direction);
            animal.GetComponent <AnimalController> ().mySpawner = this;

            SpawnedAnimals.Add(animal.GetComponent <AnimalController> ());
            AnimalSpawningWatchtower.AllSpawnedAnimals.Add(animal.GetComponent <AnimalController> ());
            AnimalSpawningWatchtower.AnimalSpawnTimer = AnimalSpawningWatchtower.GetNextSpawnInterval();
        }
Ejemplo n.º 2
0
        protected override void FixedUpdate()
        {
            AnimalSpawningWatchtower.AnimalSpawnCountdown();
            base.FixedUpdate();
            lastLanesCrossed = lanesCrossed;
            lanesCrossed     = transform.position.y / Roads.RoadGeneration.LaneWidth + .5f;

            if (Mathf.FloorToInt(lastLanesCrossed) < Mathf.FloorToInt(lanesCrossed) && Mathf.FloorToInt(lanesCrossed) >= 1 && Mathf.FloorToInt(lanesCrossed) <= maxLanes)
            {
                CrossedLane();
            }

            if (StaticItems.healthValue <= 0)
            {
                isDead = true;
                StaticItems.deathTurtle.gameObject.SetActive(true);
                StaticItems.deathTurtle.DeathScreen();
            }
        }