コード例 #1
0
    // Generates references to each type of powerup object
    public static void GenerateAllPowerups()
    {
        if (PowerUps == null)
        {
            //initializes the array
            PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT];

            //the array of all possible PowerUps the spawned PowerUp could be
            PowerUps[0] = new LaneConversion(durationLaneConversion);
            PowerUps[1] = new SlowFall(fallSpeedModifierSlowFall, timeBonusSlowFall, durationSlowFall);
            PowerUps[2] = new Fuel(timeBonusAddTime);
            PowerUps[3] = new Multiply(multiplierElementMultiply);
            PowerUps[4] = new BucketShield(bucketShieldHitPoints);
            PowerUps[5] = new TapToCollect(durationTapToCollect);
            PowerUps[6] = new Invincible(durationInvincible, spawnRateModifierInvincible);
            PowerUps[7] = new TotalConversion(durationTotalConversion);
            PowerUps[8] = new CollectAll();
        }
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        //make PowerUpScreen active since Content is referenced
        powerScreen = GameObject.Find ("Canvas/PowerUpScreen");
        powerScreen.SetActive (true);
        contentList = GameObject.Find ("Canvas/PowerUpScreen/ScrollView/Content");
        powerScreen.SetActive (false);

        buttonScale = new Vector3 (buttonSize, buttonSize, buttonSize);
        upgradeBarImages = new Sprite[]{upgradeBar0,upgradeBar1,upgradeBar2,upgradeBar3};
        upgradeCardImages = new Sprite[]{upgradeCard0,upgradeCard1,upgradeCard2,upgradeCard3};

        PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT];

        //the array of all possible PowerUps the spawned PowerUp could be
        PowerUps[0] = new LaneConversion(DEFAULT_NUMBER);
        PowerUps[1] = new SlowFall(DEFAULT_NUMBER,DEFAULT_NUMBER,DEFAULT_NUMBER);
        PowerUps[2] = new Fuel(DEFAULT_NUMBER) ;
        PowerUps[3] = new Multiply(DEFAULT_NUMBER,DEFAULT_NUMBER);
        PowerUps[4] = new BucketShield(DEFAULT_NUMBER);
        PowerUps[5] = new TapToCollect(DEFAULT_NUMBER);
        PowerUps[6] = new Invincible(DEFAULT_NUMBER, DEFAULT_NUMBER);
        PowerUps[7] = new TotalConversion(DEFAULT_NUMBER);
        PowerUps[8] = new CollectAll();

        powerDescriptions = new string[TOTAL_BASE_POWERUPS*UPGRADE_LEVELS]{
            "Tap or drag this ability into a specific lane to convert the elements contained to the lane’s elemental type.",//power 1, level 1
            "Tap or drag this ability into a specific lane to convert the elements contained, and an adjacent lane, to each lane’s elemental type.",//power 1, level 2
            "Tap or drag this ability to convert the elements contained within each lane to the lane’s elemental type.",//power 1, level 3
            "Tap or drag this ability into a specific lane to slow down the fall of elements contained.",//power 2, level 1
            "Tap or drag this ability into a specific lane to significantly slow down the fall of elements contained.",//power 2, level 2
            "Tap or drag this ability to significantly slow down the fall all elements.",//power 2, level 3
            "Your fuel does not deplete for a certain duration.",//power 3, level 1
            "You gain additional fuel and it does not deplete for a certain duration.",//power 3, level 2
            "You gain a significant amount of additional fuel and it does not deplete for a certain duration.",//power 3, level 3
            "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type.",//power 4, level 1
            "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type, and an adjacent lane’s elemental type.",//power 4, level 2
            "Tap or drag this ability to receive a score multiplier for elements collected of all elemental types.",//power 4, level 3
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 2 incorrect elements that fall into it.",//power 5, level 1
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 4 incorrect elements that fall into it.",//power 5, level 2
            "Tap or drag this ability to give all lanes no miss penalty for the next 4 incorrect elements that fall into them, for each lane.",//power 5, level 3
            "Simply tap elements to automatically collect them.",//power 6, level 1
            "Simply tap elements to automatically collect them.",//power 6, level 2
            "Simply tap elements to automatically collect them.",//power 6, level 3
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for a small amount of time.",//power 7, level 1
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for a decent amount of time.",//power 7, level 2
            "Tap or drag this ability to give all lanes no miss penalty for a decent amount of time.",//power 7, level 3
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a small amount of time.",//power 8, level 1
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a decent amount of time.",//power 8, level 2
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type and gain invincibility for a decent amount of time.",//power 8, level 3
            "Tap or drag this ability into a specific lane to automatically collect all elements in that lane.",//power 9, level 1
            "Tap or drag this ability into a specific lane to automatically collect all elements in that lane and an adjacent lane.",//power 9, level 2
            "Tap or drag this ability to automatically collect all elements in all lanes."};//power 9, level 3

        bonusTexts = new string[TOTAL_BASE_POWERUPS*UPGRADE_LEVELS]{
            "1 Lane",//power 1, level 1
            "2 Lanes",//power 1, level 2
            "All Lanes",//power 1, level 3
            "Slow",//power 2, level 1
            "Slower",//power 2, level 2
            "Slower & All Lanes",//power 2, level 3
            "Fuel",//power 3, level 1
            "Fuel+",//power 3, level 2
            "Fuel++",//power 3, level 3
            "1 Element",//power 4, level 1
            "2 Elements",//power 4, level 2
            "4 Element",//power 4, level 3
            "2 Saves & 1 Lane",//power 5, level 1
            "4 Saves & 1 Lane",//power 5, level 2
            "4 Saves & All Lanes",//power 5, level 3
            "Tap Time",//power 6, level 1
            "Tap Time+",//power 6, level 2
            "Tap Time++",//power 6, level 3
            "Invincible Time & 1 Lane",//power 7, level 1
            "Invincible Time+ & 1 Lane",//power 7, level 2
            "Invincible Time+ & All Lanes",//power 7, level 3
            "Conversion Time",//power 8, level 1
            "Conversion Time+",//power 8, level 2
            "Conversion Time+ & Invincible",//power 8, level 3
            "1 Lane",//power 9, level 1
            "2 Lanes",//power 9, level 2
            "All Lanes"};//power 9, level 3

        elem = new string[TOTAL_BASE_POWERUPS*TIMES_UPGRADED,TYPES_OF_ELEMENTS_PER_UNLOCK]{
            {FirstPowerUpElements[0], FirstPowerUpElements[1], FirstPowerUpElements[2], FirstPowerUpElements[3]},//power 1, upgrade 1
            {"magma","cloud","mud","energy"},//power 1, upgrade 2
            {"desert","earthquake","blizzard","mountain"},//power 2, upgrade 1
            {"storm","glass","clay","brick"},//power 2, upgrade 2
            {"coal","volcano","tornado","glacier"},//power 3, upgrade 1
            {"ion","fission","ceramics","monsoon"},//power 3, upgrade 2
            {"diamond","aurora","smoke","flood"},//power 4, upgrade 1
            {"metal","grass","radiation","tsunami"},//power 4, upgrade 2
            {"meteoroid","supernova","archipelago","rust"},//power 5, upgrade 1
            {"wasteland","voltage","tide","edifice"},//power 5, upgrade 2
            {"algae","pulsar","dynamo","windmill"},//power 6, upgrade 1
            {"aliens","fusion","whirlpool","resistance"},//power 6, upgrade 2
            {"forest","crater","maze","apocalypse"},//power 7, upgrade 1
            {"dreams","balance","coincidence","fate"},//power 7, upgrade 2
            {"valley","fruit","sorcery","prophecy"},//power 8, upgrade 1
            {"inertia","morality","method","insight"},//power 8, upgrade 2
            {"emotion","chaos","deception","reason"},//power 9, upgrade 1
            {"information","chronology","absurd","motivation"}};//power 9, upgrade 2
        cost = new int[TOTAL_BASE_POWERUPS*TIMES_UPGRADED,TYPES_OF_ELEMENTS_PER_UNLOCK]{
            {50, 50, 50, 50},//power 1, upgrade 1
            {99,99,99,99},//power 1, upgrade 2
            {50,50,50,50},//power 2, upgrade 1
            {99,99,99,99},//power 2, upgrade 2
            {50,50,50,50},//power 3, upgrade 1
            {99,99,99,99},//power 3, upgrade 2
            {50,50,50,50},//power 4, upgrade 1
            {99,99,99,99},//power 4, upgrade 2
            {50,50,50,50},//power 5, upgrade 1
            {99,99,99,99},//power 5, upgrade 2
            {50,50,50,50},//power 6, upgrade 1
            {99,99,99,99},//power 6, upgrade 2
            {50,50,50,50},//power 7, upgrade 1
            {99,99,99,99},//power 7, upgrade 2
            {50,50,50,50},//power 8, upgrade 1
            {99,99,99,99},//power 8, upgrade 2
            {50,50,50,50},//power 9, upgrade 1
            {99,99,99,99}};//power 9, upgrade 2

        notEnoughColor = new Color(255.0f/255.0f,135.0f/255.0f,126.0f/255.0f);
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        //make PowerUpScreen active since Content is referenced
        powerScreen = GameObject.Find("Canvas/PowerUpScreen");
        powerScreen.SetActive(true);
        contentList = GameObject.Find("Canvas/PowerUpScreen/ScrollView/Content");
        powerScreen.SetActive(false);

        buttonScale       = new Vector3(buttonSize, buttonSize, buttonSize);
        upgradeBarImages  = new Sprite[] { upgradeBar0, upgradeBar1, upgradeBar2, upgradeBar3 };
        upgradeCardImages = new Sprite[] { upgradeCard0, upgradeCard1, upgradeCard2, upgradeCard3 };

        PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT];

        //the array of all possible PowerUps the spawned PowerUp could be
        PowerUps[0] = new LaneConversion(DEFAULT_NUMBER);
        PowerUps[1] = new SlowFall(DEFAULT_NUMBER, DEFAULT_NUMBER, DEFAULT_NUMBER);
        PowerUps[2] = new Fuel(DEFAULT_NUMBER);
        PowerUps[3] = new Multiply(DEFAULT_NUMBER, DEFAULT_NUMBER);
        PowerUps[4] = new BucketShield(DEFAULT_NUMBER);
        PowerUps[5] = new TapToCollect(DEFAULT_NUMBER);
        PowerUps[6] = new Invincible(DEFAULT_NUMBER, DEFAULT_NUMBER);
        PowerUps[7] = new TotalConversion(DEFAULT_NUMBER);
        PowerUps[8] = new CollectAll();

        powerDescriptions = new string[TOTAL_BASE_POWERUPS * UPGRADE_LEVELS] {
            "Tap or drag this ability into a specific lane to convert the elements contained to the lane’s elemental type.",                                                                //power 1, level 1
            "Tap or drag this ability into a specific lane to convert the elements contained, and an adjacent lane, to each lane’s elemental type.",                                        //power 1, level 2
            "Tap or drag this ability to convert the elements contained within each lane to the lane’s elemental type.",                                                                    //power 1, level 3
            "Tap or drag this ability into a specific lane to slow down the fall of elements contained.",                                                                                   //power 2, level 1
            "Tap or drag this ability into a specific lane to significantly slow down the fall of elements contained.",                                                                     //power 2, level 2
            "Tap or drag this ability to significantly slow down the fall all elements.",                                                                                                   //power 2, level 3
            "Your fuel does not deplete for a certain duration.",                                                                                                                           //power 3, level 1
            "You gain additional fuel and it does not deplete for a certain duration.",                                                                                                     //power 3, level 2
            "You gain a significant amount of additional fuel and it does not deplete for a certain duration.",                                                                             //power 3, level 3
            "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type.",                                        //power 4, level 1
            "Tap or drag this ability into a specific lane to receive a score multiplier for the elements collected of that lane’s elemental type, and an adjacent lane’s elemental type.", //power 4, level 2
            "Tap or drag this ability to receive a score multiplier for elements collected of all elemental types.",                                                                        //power 4, level 3
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 2 incorrect elements that fall into it.",                                         //power 5, level 1
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for the next 4 incorrect elements that fall into it.",                                         //power 5, level 2
            "Tap or drag this ability to give all lanes no miss penalty for the next 4 incorrect elements that fall into them, for each lane.",                                             //power 5, level 3
            "Simply tap elements to automatically collect them.",                                                                                                                           //power 6, level 1
            "Simply tap elements to automatically collect them.",                                                                                                                           //power 6, level 2
            "Simply tap elements to automatically collect them.",                                                                                                                           //power 6, level 3
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for a small amount of time.",                                                                  //power 7, level 1
            "Tap or drag this ability into a specific lane to give that lane no miss penalty for a decent amount of time.",                                                                 //power 7, level 2
            "Tap or drag this ability to give all lanes no miss penalty for a decent amount of time.",                                                                                      //power 7, level 3
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a small amount of time.",                                       //power 8, level 1
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type for a decent amount of time.",                                      //power 8, level 2
            "Tap or drag this ability into a specific lane to convert all spawned elements to the lane’s elemental type and gain invincibility for a decent amount of time.",               //power 8, level 3
            "Tap or drag this ability into a specific lane to automatically collect all elements in that lane.",                                                                            //power 9, level 1
            "Tap or drag this ability into a specific lane to automatically collect all elements in that lane and an adjacent lane.",                                                       //power 9, level 2
            "Tap or drag this ability to automatically collect all elements in all lanes."
        };                                                                                                                                                                                  //power 9, level 3

        bonusTexts = new string[TOTAL_BASE_POWERUPS * UPGRADE_LEVELS] {
            "1 Lane",                        //power 1, level 1
            "2 Lanes",                       //power 1, level 2
            "All Lanes",                     //power 1, level 3
            "Slow",                          //power 2, level 1
            "Slower",                        //power 2, level 2
            "Slower & All Lanes",            //power 2, level 3
            "Fuel",                          //power 3, level 1
            "Fuel+",                         //power 3, level 2
            "Fuel++",                        //power 3, level 3
            "1 Element",                     //power 4, level 1
            "2 Elements",                    //power 4, level 2
            "4 Element",                     //power 4, level 3
            "2 Saves & 1 Lane",              //power 5, level 1
            "4 Saves & 1 Lane",              //power 5, level 2
            "4 Saves & All Lanes",           //power 5, level 3
            "Tap Time",                      //power 6, level 1
            "Tap Time+",                     //power 6, level 2
            "Tap Time++",                    //power 6, level 3
            "Invincible Time & 1 Lane",      //power 7, level 1
            "Invincible Time+ & 1 Lane",     //power 7, level 2
            "Invincible Time+ & All Lanes",  //power 7, level 3
            "Conversion Time",               //power 8, level 1
            "Conversion Time+",              //power 8, level 2
            "Conversion Time+ & Invincible", //power 8, level 3
            "1 Lane",                        //power 9, level 1
            "2 Lanes",                       //power 9, level 2
            "All Lanes"
        };                                   //power 9, level 3

        elem = new string[TOTAL_BASE_POWERUPS * TIMES_UPGRADED, TYPES_OF_ELEMENTS_PER_UNLOCK] {
            { FirstPowerUpElements[0], FirstPowerUpElements[1], FirstPowerUpElements[2], FirstPowerUpElements[3] }, //power 1, upgrade 1
            { "magma", "cloud", "mud", "energy" },                                                                  //power 1, upgrade 2
            { "desert", "earthquake", "blizzard", "mountain" },                                                     //power 2, upgrade 1
            { "storm", "glass", "clay", "brick" },                                                                  //power 2, upgrade 2
            { "coal", "volcano", "tornado", "glacier" },                                                            //power 3, upgrade 1
            { "ion", "fission", "ceramics", "monsoon" },                                                            //power 3, upgrade 2
            { "diamond", "aurora", "smoke", "flood" },                                                              //power 4, upgrade 1
            { "metal", "grass", "radiation", "tsunami" },                                                           //power 4, upgrade 2
            { "meteoroid", "supernova", "archipelago", "rust" },                                                    //power 5, upgrade 1
            { "wasteland", "voltage", "tide", "edifice" },                                                          //power 5, upgrade 2
            { "algae", "pulsar", "dynamo", "windmill" },                                                            //power 6, upgrade 1
            { "aliens", "fusion", "whirlpool", "resistance" },                                                      //power 6, upgrade 2
            { "forest", "crater", "maze", "apocalypse" },                                                           //power 7, upgrade 1
            { "dreams", "balance", "coincidence", "fate" },                                                         //power 7, upgrade 2
            { "valley", "fruit", "sorcery", "prophecy" },                                                           //power 8, upgrade 1
            { "inertia", "morality", "method", "insight" },                                                         //power 8, upgrade 2
            { "emotion", "chaos", "deception", "reason" },                                                          //power 9, upgrade 1
            { "information", "chronology", "absurd", "motivation" }
        };                                                                                                          //power 9, upgrade 2
        cost = new int[TOTAL_BASE_POWERUPS * TIMES_UPGRADED, TYPES_OF_ELEMENTS_PER_UNLOCK] {
            { 50, 50, 50, 50 },                                                                                     //power 1, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 1, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 2, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 2, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 3, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 3, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 4, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 4, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 5, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 5, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 6, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 6, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 7, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 7, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 8, upgrade 1
            { 99, 99, 99, 99 },                                                                                     //power 8, upgrade 2
            { 50, 50, 50, 50 },                                                                                     //power 9, upgrade 1
            { 99, 99, 99, 99 }
        };                                                                                                          //power 9, upgrade 2


        notEnoughColor = new Color(255.0f / 255.0f, 135.0f / 255.0f, 126.0f / 255.0f);
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        // ----- CHEATS ----- \\
        //ActivatePowerUp.UnlockAllPowerups ();
        //Cheats.UnlockAllElements();
        // ----- CHEATS ----- \\
        animators[0] = animators[0].GetComponent<Animator>();
        animators [1] = animators [1].GetComponent<Animator> ();
        animators [2] = animators [2].GetComponent<Animator> ();
        animators [3] = animators [3].GetComponent<Animator> ();

        animators [0].SetTrigger ("finishedLoading");

        arrayOfPlayerPrefs = new string[4];
        arrayOfPlayerPrefs [0] = PlayerPrefs.GetString ("ELEMENT1", "fire");
        arrayOfPlayerPrefs [1] = PlayerPrefs.GetString ("ELEMENT2", "water");
        arrayOfPlayerPrefs [3] = PlayerPrefs.GetString ("ELEMENT3", "earth");
        arrayOfPlayerPrefs [2] = PlayerPrefs.GetString ("ELEMENT4", "air");

        //sets player prefs if they have not been set
        PlayerPrefs.SetString("ELEMENT1", PlayerPrefs.GetString ("ELEMENT1", "fire"));
        PlayerPrefs.SetString("ELEMENT2", PlayerPrefs.GetString ("ELEMENT2", "water"));
        PlayerPrefs.SetString("ELEMENT3", PlayerPrefs.GetString ("ELEMENT3", "earth"));
        PlayerPrefs.SetString("ELEMENT4", PlayerPrefs.GetString ("ELEMENT4", "air"));

        // Setting the player given sprites
        element1.transform.GetChild (0).GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [0]);
        collectionPot1.transform.GetChild (1).GetChild (0).GetComponent<SpriteRenderer> ().sprite = (elementSprites[0] = Resources.Load<Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [0]));

        element2.transform.GetChild (0).GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [1]);
        collectionPot2.transform.GetChild (1).GetChild (0).GetComponent<SpriteRenderer> ().sprite = (elementSprites[1] = Resources.Load<Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [1]));

        element3.transform.GetChild (0).GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [3]);
        collectionPot3.transform.GetChild (1).GetChild (0).GetComponent<SpriteRenderer> ().sprite = (elementSprites[3] = Resources.Load<Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [2]));

        element4.transform.GetChild (0).GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [2]);
        collectionPot4.transform.GetChild (1).GetChild (0).GetComponent<SpriteRenderer> ().sprite = (elementSprites[2] = Resources.Load<Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [3]));
        // End of setting player given sprites

        elements[0] = element1;
        elements[1] = element2;
        elements[2] = element3;
        elements[3] = element4;
        if (elements.Length > 4) {
            elements [4] = powerUp;
        }
        // At the start assign the lanes but create a method to change the lanes positions
        lanes [0] = LanePositions.GetLanePositions(9f, -1)[0];
        lanes [1] = LanePositions.GetLanePositions(9f, -1)[1];
        lanes [2] = LanePositions.GetLanePositions(9f, -1)[2];
        lanes [3] = LanePositions.GetLanePositions(9f, -1)[3];

        scoreTexts[0] = elementText1;
        scoreTexts[1] = elementText2;
        scoreTexts[2] = elementText3;
        scoreTexts[3] = elementText4;

        //reset powerUpCounter (number of powerUps seen in a given round)
        powerUpCounter = 0;
        powerUpsPerRound = 3;

        //difficulty setting
        defaultSpawnModifier = defaultFallSpeedModifier = 1;//0.6f + (0.9f * GlobalVars.NUMBER_ELEMENTS_UNLOCKED / ((float)GlobalVars.ELEMENTS.Count));
        creationFrequency = 60f + (140f * GlobalVars.NUMBER_ELEMENTS_UNLOCKED / ((float)GlobalVars.ELEMENTS.Count));
        elementMovementSpeed = 2 + (0.3f * GlobalVars.NUMBER_ELEMENTS_UNLOCKED / ((float)GlobalVars.ELEMENTS.Count));// 0.6f + (0.9f * GlobalVars.NUMBER_ELEMENTS_UNLOCKED / ((float)GlobalVars.ELEMENTS.Count));

        CollectionTimer.instance.setBaseCreationFrequency (creationFrequency);
        CollectionTimer.instance.setBaseMovementSpeed (elementMovementSpeed);

        fallSpeedModifiers = new float [GlobalVars.NUMBER_OF_LANES];

        //sets the fallSpeedModifiers to default
        for (int i = 0; i < fallSpeedModifiers.Length; i++) {
            fallSpeedModifiers[i] = defaultFallSpeedModifier;
        }

        //sets the spawnRateModifiers to default values
        spawnRateModifier = defaultSpawnModifier;

        //saves the starting values of fall speed and spawn rate
        initialCreationFrequency = creationFrequency;
        initialElementMovementSpeed = elementMovementSpeed;
        #if DEBUG
            powerUp1 = new BucketShield(2);
            PowerUp.ResetPowerUpLevel(powerUp1);
        #endif

        // Bools for tutorial checks
        isElementGiven = false;
        isSecondElementGiven = false;
        hasTutorialElementSpawned = false;
        timeToPowerUp = false;
        GlobalVars.SWIPE_TUTORIAL_FIRST_SPAWNED = false;

        //generates the powerups
        ActivatePowerUp.GenerateAllPowerups ();
        ActivatePowerUp.GenerateUnlockedPowerups ();

        // Instantiating the arrays for the power up tutorial
        tutorialElements = new GameObject[6];
        powerUpTutorialPosition = new Vector3[6];
        elementNumbers = new int[6];

        CheckForPowerUpTutorial ();
    }
コード例 #5
0
	// Generates references to each type of powerup object
	public static void GenerateAllPowerups () {
		if (PowerUps == null) {
			//initializes the array
			PowerUps = new PowerUp[GlobalVars.POWERUP_COUNT];
			
			//the array of all possible PowerUps the spawned PowerUp could be
			PowerUps[0] = new LaneConversion(durationLaneConversion);
			PowerUps[1] = new SlowFall(fallSpeedModifierSlowFall,timeBonusSlowFall,durationSlowFall);
			PowerUps[2] = new Fuel(timeBonusAddTime) ;
			PowerUps[3] = new Multiply(multiplierElementMultiply);
			PowerUps[4] = new BucketShield(bucketShieldHitPoints);
			PowerUps[5] = new TapToCollect(durationTapToCollect);
			PowerUps[6] = new Invincible(durationInvincible, spawnRateModifierInvincible);
			PowerUps[7] = new TotalConversion(durationTotalConversion);
			PowerUps[8] = new CollectAll();
		}
	}
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        // ----- CHEATS ----- \\
        //ActivatePowerUp.UnlockAllPowerups ();
        //Cheats.UnlockAllElements();
        // ----- CHEATS ----- \\
        animators[0]  = animators[0].GetComponent <Animator>();
        animators [1] = animators [1].GetComponent <Animator> ();
        animators [2] = animators [2].GetComponent <Animator> ();
        animators [3] = animators [3].GetComponent <Animator> ();

        animators [0].SetTrigger("finishedLoading");

        arrayOfPlayerPrefs     = new string[4];
        arrayOfPlayerPrefs [0] = PlayerPrefs.GetString("ELEMENT1", "fire");
        arrayOfPlayerPrefs [1] = PlayerPrefs.GetString("ELEMENT2", "water");
        arrayOfPlayerPrefs [3] = PlayerPrefs.GetString("ELEMENT3", "earth");
        arrayOfPlayerPrefs [2] = PlayerPrefs.GetString("ELEMENT4", "air");

        //sets player prefs if they have not been set
        PlayerPrefs.SetString("ELEMENT1", PlayerPrefs.GetString("ELEMENT1", "fire"));
        PlayerPrefs.SetString("ELEMENT2", PlayerPrefs.GetString("ELEMENT2", "water"));
        PlayerPrefs.SetString("ELEMENT3", PlayerPrefs.GetString("ELEMENT3", "earth"));
        PlayerPrefs.SetString("ELEMENT4", PlayerPrefs.GetString("ELEMENT4", "air"));

        // Setting the player given sprites
        element1.transform.GetChild(0).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [0]);
        collectionPot1.transform.GetChild(1).GetChild(0).GetComponent <SpriteRenderer> ().sprite = (elementSprites[0] = Resources.Load <Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [0]));

        element2.transform.GetChild(0).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [1]);
        collectionPot2.transform.GetChild(1).GetChild(0).GetComponent <SpriteRenderer> ().sprite = (elementSprites[1] = Resources.Load <Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [1]));

        element3.transform.GetChild(0).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [3]);
        collectionPot3.transform.GetChild(1).GetChild(0).GetComponent <SpriteRenderer> ().sprite = (elementSprites[3] = Resources.Load <Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [2]));

        element4.transform.GetChild(0).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [2]);
        collectionPot4.transform.GetChild(1).GetChild(0).GetComponent <SpriteRenderer> ().sprite = (elementSprites[2] = Resources.Load <Sprite> (GlobalVars.FILE_PATH + arrayOfPlayerPrefs [3]));
        // End of setting player given sprites

        elements[0] = element1;
        elements[1] = element2;
        elements[2] = element3;
        elements[3] = element4;
        if (elements.Length > 4)
        {
            elements [4] = powerUp;
        }
        // At the start assign the lanes but create a method to change the lanes positions
        lanes [0] = LanePositions.GetLanePositions(9f, -1)[0];
        lanes [1] = LanePositions.GetLanePositions(9f, -1)[1];
        lanes [2] = LanePositions.GetLanePositions(9f, -1)[2];
        lanes [3] = LanePositions.GetLanePositions(9f, -1)[3];

        scoreTexts[0] = elementText1;
        scoreTexts[1] = elementText2;
        scoreTexts[2] = elementText3;
        scoreTexts[3] = elementText4;

        //reset powerUpCounter (number of powerUps seen in a given round)
        powerUpCounter   = 0;
        powerUpsPerRound = 3;

        //difficulty setting
        defaultSpawnModifier = defaultFallSpeedModifier = 1;                                                          //0.6f + (0.9f * GlobalVars.NUMBER_ELEMENTS_UNLOCKED / ((float)GlobalVars.ELEMENTS.Count));
        creationFrequency    = 60f + (140f * GlobalVars.NUMBER_ELEMENTS_UNLOCKED / ((float)GlobalVars.ELEMENTS.Count));
        elementMovementSpeed = 2 + (0.3f * GlobalVars.NUMBER_ELEMENTS_UNLOCKED / ((float)GlobalVars.ELEMENTS.Count)); // 0.6f + (0.9f * GlobalVars.NUMBER_ELEMENTS_UNLOCKED / ((float)GlobalVars.ELEMENTS.Count));

        CollectionTimer.instance.setBaseCreationFrequency(creationFrequency);
        CollectionTimer.instance.setBaseMovementSpeed(elementMovementSpeed);

        fallSpeedModifiers = new float [GlobalVars.NUMBER_OF_LANES];

        //sets the fallSpeedModifiers to default
        for (int i = 0; i < fallSpeedModifiers.Length; i++)
        {
            fallSpeedModifiers[i] = defaultFallSpeedModifier;
        }

        //sets the spawnRateModifiers to default values
        spawnRateModifier = defaultSpawnModifier;


        //saves the starting values of fall speed and spawn rate
        initialCreationFrequency    = creationFrequency;
        initialElementMovementSpeed = elementMovementSpeed;
                #if DEBUG
        powerUp1 = new BucketShield(2);
        PowerUp.ResetPowerUpLevel(powerUp1);
                #endif

        // Bools for tutorial checks
        isElementGiven            = false;
        isSecondElementGiven      = false;
        hasTutorialElementSpawned = false;
        timeToPowerUp             = false;
        GlobalVars.SWIPE_TUTORIAL_FIRST_SPAWNED = false;

        //generates the powerups
        ActivatePowerUp.GenerateAllPowerups();
        ActivatePowerUp.GenerateUnlockedPowerups();

        // Instantiating the arrays for the power up tutorial
        tutorialElements        = new GameObject[6];
        powerUpTutorialPosition = new Vector3[6];
        elementNumbers          = new int[6];

        CheckForPowerUpTutorial();
    }