Пример #1
0
    // Use this for initialization
    void Start()
    {
        platformWidths = new float[objectPools.Length];

        for (int i = 0; i < objectPools.Length; i++)
        {
            platformWidths[i] = objectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }

        minPlatformHeight = transform.position.y;
        maxPlatformHeight = maxPlatformHeightPoint.position.y;

        coinGenerator    = FindObjectOfType <CoinGenerator>();
        powerUpGenerator = FindObjectOfType <PowerUpGenerator>();

        if (PlayerPrefs.HasKey("PowerUpChanceUpgrade"))
        {
            powerUpThreshold = 1 + PlayerPrefs.GetInt("PowerUpChanceUpgrade");
        }
        else
        {
            powerUpThreshold = 1;
        }

        if (PlayerPrefs.HasKey("CarrotSpawnChanceUpgrade"))
        {
            randomCarrotThreshold = 35 + PlayerPrefs.GetInt("CarrotSpawnChanceUpgrade");
        }
        else
        {
            randomCarrotThreshold = 35;
        }

        aboveMidCounter = 0;
    }
Пример #2
0
    void Start()
    {
        GameManager.Instance.WorldGenerator = this;

        lastChunkPosX    = -1;
        readyForChunks   = false;
        chunkWidth       = 50;
        chunkHeight      = 14;
        chunkShapes      = new List <BaseChunkShape>();
        biomes           = new List <BaseBiome>();
        chunkGenerator   = new ChunkGenerator();
        coinGenerator    = new CoinGenerator();
        powerupGenerator = new PowerupGenerator();
        enemyGenerator   = new EnemyGenerator();
        worldChunkPrefab = Resources.Load("WorldChunkPrefab");
        platformPrefab   = Resources.Load("Platform_Prefab");
        tilePrefab       = Resources.Load("Tile_Prefab");

        chunkShapes.Add(new FlatShape());
        chunkShapes.Add(new FlatShape2());
        chunkShapes.Add(new PowerupShape1());
        chunkShapes.Add(new GapyShape1());
        chunkShapes.Add(new GapyShape2());
        chunkShapes.Add(new ChrisShape1());

        biomes.Add(new GrassBiome());
        biomes.Add(new CaveBiome());
        biomes.Add(new StormyBiome());
        biomes.Add(new LavaCaveBiome());
        biomes.Add(new WesternBiome());

        GameManager.Instance.ResetGame();
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        platformWidths  = new float[theObjectPools.Length];
        platformHeights = new float[theObjectPools.Length];

        for (int i = 0; i < theObjectPools.Length; i++)
        {
            platformWidths[i]  = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
            platformHeights[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.y;
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        platformByLevel = new List <int> [3];
        //platformByLevel[0] = new List<int>{8};
        //platformByLevel[1] = new List<int>{8};
        //platformByLevel[2] = new List<int>{4, 5};
        platformByLevel[0] = new List <int> {
            6, 7, 8
        };
        platformByLevel[1] = new List <int> {
            0, 1, 2, 3, 6
        };
        platformByLevel[2] = new List <int> {
            0, 1, 2, 3, 4, 5
        };

        theCoinGenerator = FindObjectOfType <CoinGenerator> ();
    }
Пример #4
0
 void Start()
 {
     gameOver    = false;
     score_value = 0;
     CoinsController.coins_value   = 0;
     score_multiplier              = 1;
     CoinCatchScript.multiplier    = 1;
     lastIterationUpdateTime       = Time.time;
     lastMiniExploderSpawnTime     = Time.time;
     lastPowerUpSpawnTime          = Time.time;
     lastStaticObjectSpawnTime     = Time.time;
     lastMachineGunSpawnTime       = Time.time;
     lastAsteroidSpawnTime         = Time.time;
     lastMiniExploderWaveSpawnTime = Time.time;
     lastLaserSpawnTime            = -1 * lasersDeltaTime;
     asteroidGenerator             = FindObjectOfType <AsteroidGenerator>();
     coinGenerator          = FindObjectOfType <CoinGenerator>();          //find the only1 coingenerator object
     miniExploderGenerator  = FindObjectOfType <MiniExploderGenerator>();  //find the only1 Exploder object
     staticObjectsGenerator = FindObjectOfType <StaticObjectsGenerator>(); //find the only1 StaticObjectgenerator object
     machineGunGenerator    = FindObjectOfType <MachineGunGenerator>();
     bigLaserGenerator      = FindObjectOfType <BigLaserGenerator>();
     lastCoinSpawnTime      = Time.time;
     gameInterface.SetActive(true);
     powerUp.SetActive(false);
     UpdateSound();
     game_over_menu.SetActive(false);
     game_win_menu.SetActive(false);
     FindObjectOfType <AudioManager>().Play("Jungle");
 }
Пример #5
0
    // Start is called before the first frame update
    void Start()
    {
        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        coinGenerator   = FindObjectOfType <CoinGenerator>();
        hazardGenerator = FindObjectOfType <HazardGenerator>();
        itemGenerator   = FindObjectOfType <ItemGenerator>();
    }
    private void Awake()
    {
        platformWidthArray = new float[objPoolerArray.Length];
        coinGenerator      = FindObjectOfType <CoinGenerator>();

        for (int i = 0; i < objPoolerArray.Length; i++)
        {
            platformWidthArray[i] = objPoolerArray[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }
    }
Пример #7
0
 /* Initiates the Countdown for the game and finds all objects needed for the game */
 public void StartGame()
 {
     // activated when play button is hit
     SetPageState(PageState.Countdown);
     theScoreManager = FindObjectOfType <ScoreManager>();
     theLevel        = FindObjectOfType <LevelGenerator>();
     coinSpawn       = FindObjectOfType <CoinGenerator>();
     playmove        = FindObjectOfType <PlayerMovement2>();
     alienmove       = FindObjectOfType <AlienMovement>();
 }
Пример #8
0
 void Start()
 {
     minY         = minHeight.transform.position.y;
     maxY         = maxHeight.transform.position.y;
     groundWidths = new float[groundPoolers.Length];
     for (int i = 0; i < groundPoolers.Length; i++)
     {
         groundWidths[i] = groundPoolers[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
     }
     coinGenerator = FindObjectOfType <CoinGenerator>();
 }
Пример #9
0
    void Start()
    {
        platformWidths = new float[theObjectPools.Length];

        for (int i = 0; i < theObjectPools.Length; i++)
        {
            platformWidths[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }

        theCoinGenerator = FindObjectOfType <CoinGenerator> ();
    }
Пример #10
0
        public static void CollectCoin(Player player, CoinGenerator coinGenerator)
        {
            Coin coin = coinGenerator.Coins.FirstOrDefault(c => c.Position.Equals(player.Position));

            if (coin != null)
            {
                player.Points += coin.Value;
                player.CoinsCollected.Push(coin);
                coinGenerator.Coins.Remove(coin);
            }
        }
Пример #11
0
// Use this for initialization

    void Start()
    {
        platformWidths = new float[theObjectPools.Length];
        for (int i = 0; i < theObjectPools.Length; i++)
        {
            platformWidths[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }
        minHeight        = transform.position.y;
        maxHeight        = maxHeightPoint.position.y;
        theCoinGenerator = FindObjectOfType <CoinGenerator>();
    }
Пример #12
0
 // Start is called before the first frame update
 void Start()
 {
     MinY         = minHieghtpt.position.y;
     MaxY         = maxHieghtpt.position.y;
     groundWidths = new float[grndpooler.Length];
     for (int i = 0; i < grndpooler.Length; i++)
     {
         groundWidths[i] = grndpooler[i].poolObj.GetComponent <BoxCollider2D>().size.x;
     }
     coingenerator = FindObjectOfType <CoinGenerator>();
 }
Пример #13
0
 private void CreateCoinGenerator()
 {
     CoinGenerator.Ctx coinCtx = new CoinGenerator.Ctx
     {
         lineCount      = _rootView.LevelConfig.LineCount,
         spawnTime      = _rootView.LevelConfig.SpawnTime,
         parent         = _rootView.gameObject,
         positionFinder = _positionFinder,
     };
     _coinGenerator = new CoinGenerator(coinCtx);
 }
Пример #14
0
	// Use this for initialization
	void Start () {
		//platformWidth = thePlatform.GetComponent<BoxCollider2D> ().size.x;
		thePlatformsWidths = new float[theObjectPools.Length];

		for(int i =0; i<theObjectPools.Length; i++)
		{
			thePlatformsWidths[i] = theObjectPools[i].pooledObject.GetComponent<BoxCollider2D> ().size.x;
		}

		theCoinGenerator = FindObjectOfType<CoinGenerator> ();
		//theKillBoxGenerator = FindObjectOfType<CoinGenerator> ();
	}
    public float exitHeight = 3.5f;               //user passes in this value to specify how high the exit should be spawned


    void Start()
    {
        generationPoint  = GameObject.Find("GenerationPoint").transform;                        //get our reference to the generation point for future use
        theCoinGenerator = FindObjectOfType <CoinGenerator> ();                                 //get reference to the coin generator
        ResetLevelExit();                                                                       //sets coordinates of levelexit

        //getting an array of all the lengths of objects to use.        <<BETTER IF ALL OBJECTS HAVE CLASS THAT EXPRESSES WIDTH
//		sectionWidths = new float[sectionPools.pooledObjects.Count];		//create an array that's going to store the legnths of each of the map sections in the sectionPools array
//		for (int i = 0; i < sectionPools.pooledObjects.Count; i++) {		//a loop in order to set up our array of sections widths
//			sectionWidths[i] = sectionPools[i].pooledObjects[0].GetComponent<BoxCollider2D>().size.x;		//we want the box collider of the objects in the pool, so have to access the .pooledObject
//		}
    }
Пример #16
0
 private void Start()
 {
     LoadGameData();
     Game.IsTransitioning = false;
     Game.GameManager     = this;
     InitializeTrack();
     InitializePlayer();
     InitializeIntroduction();
     _coinGenerator    = gameObject.AddComponent <CoinGenerator>();
     _bulletGenerator  = gameObject.AddComponent <BulletGenerator>();
     _monsterGenerator = gameObject.AddComponent <MonsterGenerator>();
 }
Пример #17
0
    // Use this for initialization
    void Start()
    {
        randPlatformWidth = new float[op.Length];
        for (int i = 0; i < randPlatformWidth.Length; i++)
        {
            randPlatformWidth[i] = op[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPt.position.y;

        cg = FindObjectOfType <CoinGenerator>();
    }
 void Start()
 {
     platformWidths = new int[theObjectPools.Length];
     for (int i = 0; i < theObjectPools.Length; i++)
     {
         platformWidths [i] = (int)theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
     }
     minHeight         = (int)transform.position.y;
     maxHeight         = (int)maxHeightPoint.position.y;
     theCoinGenerator  = FindObjectOfType <CoinGenerator> ();
     theEnemyGenerator = FindObjectOfType <EnemyGenerator> ();
     occupied          = false;
 }
Пример #19
0
    // Use this for initialization
    void Start()
    {
        platformWidth = new float[objPool.Length];
        for (int a = 0; a < objPool.Length; a++)
        {
            platformWidth[a] = objPool[a].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }

        coinGenerator = FindObjectOfType <CoinGenerator>();

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;
    }
Пример #20
0
    // Use this for initialization
    void Start()
    {
        platformWidths = new float[reusePlatforms.Length];

        for (int i = 0; i < reusePlatforms.Length; i++)
        {
            platformWidths [i] = reusePlatforms [i].platform.GetComponent <BoxCollider2D> ().size.x; //gets the widths of the different platforms
        }                                                                                            //end for

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        myCoinGenerator = FindObjectOfType <CoinGenerator> ();
    }
Пример #21
0
    // Start is called before the first frame update

    private void Awake()
    {
        pooler        = poolerObject.GetComponent <Pooler>();
        platformWidth = getWidthofPlatform(LastDefaultplatform);
        startPoint    = transform.position;

        debuffGenerator  = FindObjectOfType <DebuffGenerator>();
        TheCoinGenerator = FindObjectOfType <CoinGenerator>();

        startPoint.x      += platformWidth / 2 + Random.Range(minDistance, maxDistance);
        transform.position = startPoint;
        gameStartPosition  = transform.position;
        enemyGeneration    = GameObject.Find("EnemyGenerator").GetComponent <EnemyGeneration>();
    }
    // Use this for initialization
    void Start()
    {
        //platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x;
        platformWidths = new float[theObjectPool.Length];
        for (int i = 0; i < theObjectPool.Length; i++)
        {
            platformWidths[i] = theObjectPool[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
            Debug.Log("Platform width is: " + platformWidths[i]);
        }

        coinGenerator = FindObjectOfType <CoinGenerator>();

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;
    }
Пример #23
0
    // Use this for initialization
    void Start()
    {
        minHeight = transform.position.y;
        heightChange= transform.position.y;
        maxHeight = maxHeightPoint.transform.position.y;
        maxHeightChange = 2.5f;

        platformWidths = new float[theObjectPools.Length];
        for (int i=0; i<theObjectPools.Length; i++) {
            platformWidths[i]=theObjectPools[i].pooledObject.GetComponent<BoxCollider2D>().size.x;
        }

        theCoinGenerator = FindObjectOfType<CoinGenerator> ();
        theSpikeGenerator = FindObjectOfType<SpikeGenerator> ();
    }
Пример #24
0
    public float randomCoinThreshold; //set in inspector, the random number generated in coin generation is checked against this number to see how many coins to generate.



    // Use this for initialization
    void Start()
    {
        //platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x; //the game will automatically grab the length of whatever item we dragged onto "Platform" in inspector

        platformWidths = new float[theObjectPools.Length]; //there should be the same number of random widths as there are platform types- we have created an array called platformWidths[] and set its size equal to objectPools[].length

        for (int i = 0; i < theObjectPools.Length; i++)
        {
            platformWidths[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x; //whatever platform is spawned, platformWidth's int will be equal to the x length of that platform.
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        theCoinGenerator = FindObjectOfType <CoinGenerator> ();   //finds the object that has the CoinGenerator script attached to it.
    }
    // Use this for initialization
    void Start()
    {
        //platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x;
        platformHeight = thePlatform.GetComponent <BoxCollider2D>().size.y;
        platformWidths = new float[theObjectPools.Length];

        for (int i = 0; i < theObjectPools.Length; i++)
        {
            platformWidths[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }


        minHeight        = transform.position.y;
        maxHeight        = maxHeightPoint.position.y;
        theCoinGenerator = FindObjectOfType <CoinGenerator>();  // locates the only thing with the coingenerator name and places it as a callable object
    }
Пример #26
0
    // Use this for initialization
    void Start()
    {
        coinGenerator = FindObjectOfType<CoinGenerator>();

        generationPoint = GameObject.FindGameObjectWithTag("PlatformGenerationPoint").transform;        

        platformWidths = new float[objectPools.Length];

        for (int i = 0; i < objectPools.Length; i++)
        {
            platformWidths[i] = objectPools[i].pooledObject.GetComponent<BoxCollider2D>().size.x;
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;
	}
        public static void CollectCoin(Player player, CoinGenerator coinGenerator)
        {
            Coin coin = coinGenerator.Coins.FirstOrDefault(c => c.Position.Equals(player.Position));

            if (coin != null)
            {
                player.Points += coin.Value;
                Console.Beep(1000, 100);
                player.CoinsCollected.Push(coin);
                coinGenerator.Coins.Remove(coin);
                if (player.CoinsCollected.Count % 3 == 0)
                {
                    player.Lives++;
                }
            }
        }
Пример #28
0
    void Start()
    {
        coinGenerator = FindObjectOfType <CoinGenerator>();

        plaformWidths = new float[ObjectPools.Length];

        for (int i = 0; i < ObjectPools.Length; i++)
        {
            plaformWidths[i] = ObjectPools[i].PoolObject.GetComponent <BoxCollider2D>().size.x;
        }

        minPlatformHeight = transform.position.y;
        maxPlatformHeight = maxHeightPoint.position.y;

        ShouldCreateSpikes = true;
    }
Пример #29
0
    // Use this for initialization
    void Start()
    {
        //platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x; // Gets us the width of the platform.
        platformWidths = new float[theObjectPools.Length];

        for (int i = 0; i < theObjectPools.Length; i++)
        {
            // theObjectPools has no BoxCollider2D so here we must call the specific pooledObject and get the BoxCollider2D of that object.
            platformWidths[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        theCoinGenerator = FindObjectOfType <CoinGenerator>();
    }
Пример #30
0
    public float PowerUpThreshold;          // chance of spawning a powerup


    // Use this for initialization
    void Start()
    {
        // assigning the length based on how many objects in the pools
        platformWidths = new float[theObjectPool.Length];
        // for every object in the object pool
        for (int i = 0; i < theObjectPool.Length; i++)
        {
            // assigning the widths
            platformWidths[i] = theObjectPool[i].pooledObject.transform.localScale.x;
        }
        // assigning more stuff...
        heightMin = transform.position.y;
        heightMax = heightMaxPoint.position.y;

        theCoinGenerator = FindObjectOfType <CoinGenerator>(); // finding the coin generator
    }
Пример #31
0
    void Start()
    {
        //platformWidth = pool.GetPooledObject().GetComponent<BoxCollider2D>().size.x;

        platformWidths = new float[pools.Length];

        for (int i = 0; i < platformWidths.Length; ++i)
        {
            platformWidths[i] = pools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        coinGen = FindObjectOfType <CoinGenerator>();
    }
Пример #32
0
    // Use this for initialization
    void Start()
    {
        //platformWidth = platform.GetComponent<BoxCollider2D>().size.x;

        platformArrayWidth = new float[objectPool.Length];

        for (int i = 0; i < objectPool.Length; i++)
        {
            platformArrayWidth[i] = objectPool[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        coinGenerator = FindObjectOfType <CoinGenerator>();
    }
Пример #33
0
 // Use this for initialization
 void Awake()
 {
     current          = this;
     currentCoinIndex = 0;
     coins            = new Coin[coinCount];
     notShowingCoins  = new Queue <Coin>();
     for (int a = 0; a != coinCount; ++a)
     {
         GameObject coinObject = (GameObject)Instantiate <GameObject>(coinPrefab);
         coinObject.transform.position = Vector3.zero;
         coins[a]       = coinObject.GetComponent <Coin>();
         coins[a].index = a;
         coins[a].disableCoin();
         notShowingCoins.Enqueue(coins[a]);
         coinObject.transform.parent = transform;
     }
 }