Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     fleetManagerScript       = gameObject.GetComponent <FleetManager>();
     randomEventManagerScript = gameObject.GetComponent <RandomEventManager>();
     startTime = Time.time;
     GameOverScreen.gameObject.SetActive(false);
     gameEnd           = false;
     gameEndCalculator = GameObject.FindGameObjectWithTag("gameEndCalculator").GetComponent <GameEndCalculator>();
 }
Exemplo n.º 2
0
    // Use this for initialization

    void OnEnable()
    {
        fleetManScript    = GameObject.FindGameObjectWithTag("GameController").GetComponent <FleetManager>();
        gameEndCalculator = GameObject.FindGameObjectWithTag("gameEndCalculator").GetComponent <GameEndCalculator>();

        joblessR = fleetManScript.joblessR;
        joblessG = fleetManScript.joblessG;
        joblessB = fleetManScript.joblessB;

        R.value = 0f;
        G.value = 0f;
        B.value = 0f;

        R.maxValue = joblessR;
        G.maxValue = joblessG;
        B.maxValue = joblessB;
    }
    private void OnEnable()
    {
        spawnpoints       = GameObject.FindGameObjectsWithTag("spawnpoint");
        randEvMan         = GameObject.FindGameObjectWithTag("GameController").GetComponent <RandomEventManager>();
        gameEndCalculator = GameObject.FindGameObjectWithTag("gameEndCalculator").GetComponent <GameEndCalculator>();
        enabledTime       = Time.time;
        timeToChoose      = Mathf.RoundToInt(Random.Range(minTime, maxTime));
        shipStatScript    = GetComponentInChildren <ShipStartStats>();
        shipToSpawn       = shipStatScript.gameObject;

        int howMuchFood = Mathf.RoundToInt(Random.Range(minResourceCount, maxResourceCount));
        int howMuchAir  = Mathf.RoundToInt(Random.Range(minResourceCount, maxResourceCount));
        int howMuchFuel = Mathf.RoundToInt(Random.Range(minResourceCount, maxResourceCount));

        //show food air fuel in UI
        airCount.text  = (howMuchAir + " AIR");
        foodCount.text = (howMuchFood + " FUEL");
        fuelCount.text = (howMuchFuel + " FOOD");

        //population randomiser
        int whichPopulation    = Mathf.RoundToInt(Random.Range(0, 6));
        int populationModifier = Mathf.RoundToInt(Random.Range(0, shipStatScript.StartingPopModifier));

        if (whichPopulation >= 0 && whichPopulation < 1)
        {
            shipStatScript.StartingPopR = shipStatScript.StartingPopR + populationModifier;
            shipStatScript.StartingPopG = 0;
            shipStatScript.StartingPopB = 0;

            shipStatScript.startingFood = howMuchFood;
            shipStatScript.startingAir  = howMuchAir;
            shipStatScript.startingFuel = howMuchFuel;

            popCountNType.text = ("Population On Board: " + "\n" + "\n" + shipStatScript.StartingPopR + " Redsles" + "\n" + "\n" + "Redsles are strong and resilient, great in security and defence roles, but low in intelligence");
        }

        else if (whichPopulation >= 1 && whichPopulation < 2)
        {
            shipStatScript.StartingPopR = 0;
            shipStatScript.StartingPopG = shipStatScript.StartingPopG + populationModifier;
            shipStatScript.StartingPopB = 0;

            shipStatScript.startingFood = howMuchFood;
            shipStatScript.startingAir  = howMuchAir;
            shipStatScript.startingFuel = howMuchFuel;

            popCountNType.text = ("Population On Board: " + "\n" + "\n" + shipStatScript.StartingPopG + " Greenies" + "\n" + "\n" + "Greenies are very intelligent and good at production, but not very good in conflict");
        }

        else if (whichPopulation >= 2 && whichPopulation <= 6)
        {
            shipStatScript.StartingPopR = 0;
            shipStatScript.StartingPopG = 0;
            shipStatScript.StartingPopB = shipStatScript.StartingPopG + populationModifier;

            shipStatScript.startingFood = howMuchFood;
            shipStatScript.startingAir  = howMuchAir;
            shipStatScript.startingFuel = howMuchFuel;

            popCountNType.text = ("Population On Board: " + "\n" + "\n" + shipStatScript.StartingPopB + " Bluehoos" + "\n" + "\n" + "Bluehoos are sad all the time, don't work well with others and consume large quantities of food and air");
        }
    }
 // Use this for initialization
 void Start()
 {
     spawnpoints       = GameObject.FindGameObjectsWithTag("spawnpoint");
     randEvMan         = GameObject.FindGameObjectWithTag("GameController").GetComponent <RandomEventManager>();
     gameEndCalculator = GameObject.FindGameObjectWithTag("gameEndCalculator").GetComponent <GameEndCalculator>();
 }