Ejemplo n.º 1
0
    public void InitiatePanic()
    {
        m_PanicHasStarted = true;

        GameObject[] allDinos = GameObject.FindGameObjectsWithTag("Dino");

        foreach (GameObject dino in allDinos)
        {
            DinoBase dinoBase = dino.GetComponent <DinoBase>();

            if (dinoBase.IsAlive())
            {
                dinoBase.InitiatePanic();
            }
        }
    }
Ejemplo n.º 2
0
    private void EndGame()
    {
        m_GameHasEnded = true;

        m_GameTimeCounter = 0;

        GameObject[] allDinos = GameObject.FindGameObjectsWithTag("Dino");

        foreach (GameObject dino in allDinos)
        {
            DinoBase dinoBase = dino.GetComponent <DinoBase>();
            dinoBase.Die(true, false);
        }

        m_EndGameUI.SetActive(true);

        m_EndScoreText.text = "Your score: " + score;
    }
Ejemplo n.º 3
0
    private void SpawnSpecies(SpeciesSet species, bool inScreen = false)
    {
        int amountToSpawn = (int)Random.Range(species.spawnBurst.x, species.spawnBurst.y);

        for (int i = 0; i < amountToSpawn; i++)
        {
            if (species.amountAlive >= species.speciesMinMax.y)
            {
                break;
            }

            bool shouldBeChild = Random.value < species.childChange;

            Vector3 spawnPosition = Vector3.zero;

            if (!inScreen)
            {
                if (Random.value < 0.5f)
                {
                    spawnPosition = new Vector3(Random.Range(minSpawnTransfromRight.position.x, maxSpawnTransfromRight.position.x), minSpawnTransfromRight.position.y);
                }
                else
                {
                    spawnPosition = new Vector3(Random.Range(minSpawnTransfromLeft.position.x, maxSpawnTransfromLeft.position.x), minSpawnTransfromLeft.position.y);
                }
            }
            else
            {
                spawnPosition = new Vector3(Random.Range(maxSpawnTransfromLeft.position.x, minSpawnTransfromRight.position.x), minSpawnTransfromLeft.position.y);
            }

            GameObject dinoObject = Instantiate(species.speciesPrefab, spawnPosition, Quaternion.identity);
            DinoBase   dinoBase   = dinoObject.GetComponent <DinoBase>();
            dinoBase.Init(shouldBeChild);
            species.amountAlive += 1;
        }
    }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var utahraptor  = new Utahraptor();
            var triceratops = new Triceratops();
            var stygimoloch = new Stygimoloch();
            var stegosaurus = new Stegosaurus();
            var dinos       = new DinoBase[] { utahraptor, triceratops, stegosaurus, stygimoloch };

            var boxer     = new Boxer();
            var rotweiler = new Rotweiler();
            var chihuahua = new Chihuahua();
            var dogs      = new DogBase[] { boxer, rotweiler, chihuahua };

            Console.WriteLine("Do You want to learn about dogs or dinosaurs? (dog/dino)");

            string answer = Console.ReadLine();

            if (answer == "dino")
            {
                foreach (var dino in dinos)
                {
                    dino.PrintDinos();
                    dino.Carnivore();
                    Console.ReadLine();
                }
            }
            else if (answer == "dog")
            {
                foreach (var dog in dogs)
                {
                    dog.PrintDogs();
                    dog.Loyalty();
                    Console.ReadLine();
                }
            }
        }