Example #1
0
    void Update()
    {
        p1PlatformsGen.Generate();
        p2PlatformsGen.Generate();

        if (gameOver)
        {
            return;
        }

        if (p1.playerDead || p2.playerDead)
        {
            currentScore += singleScoreIncrement * Time.deltaTime;
        }
        else
        {
            currentScore += doubleScoreIncrement * Time.deltaTime;
        }

        uiScore.text = "Score: " + (int)currentScore;
    }
Example #2
0
    void GeneratePlatforms()
    {
        CamToWorldUtility.CameraBounds camBounds = CamToWorldUtility.GetCameraBoundsInWorld(cam);
        float startY = camBounds.down.y;

        // left player
        float p1LeftCorner  = camBounds.left.x;
        float p1RightCorner = camBounds.up.x;

        p1PlatformsGen = gameObject.AddComponent <PlatformGenerator>();
        p1PlatformsGen.Initialize(cam, platforms, platformsContainer, deathRays, deathRaysContainer, p1LeftCorner, p1RightCorner, startY, deathRaysProbability, deathRaysOffset, initialVelocity, velocityIncrement);
        p1PlatformsGen.Generate();

        // right player
        float p2LeftCorner  = camBounds.up.x;
        float p2RightCorner = camBounds.right.x;

        p2PlatformsGen = gameObject.AddComponent <PlatformGenerator>();
        p2PlatformsGen.Initialize(cam, platforms, platformsContainer, deathRays, deathRaysContainer, p2LeftCorner, p2RightCorner, startY, deathRaysProbability, deathRaysOffset, initialVelocity, velocityIncrement);
        p2PlatformsGen.Generate();
    }