Exemplo n.º 1
0
    //Blocks freeze when collided
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Block" && canFreezeBlocks == true)
        {
            ShapeMovement shapeMovementScript = other.gameObject.GetComponent <ShapeMovement>();

            shapeMovementScript.rb.constraints = RigidbodyConstraints2D.FreezeAll;
            shapeMovementScript.isFrozen       = true;
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        shapeMovementScript = collision.gameObject.GetComponent <ShapeMovement>();

        if (GameData.isTutorial == true && collision.gameObject.tag == "Block" && shapeMovementScript.isFrozen == false)
        {
            StartCoroutine(ShowMessage());
        }

        //Create Game Over If
        else if (!GameData.isGameOver)
        {
            if (collision.tag == "Block")
            {
                //real game over sequence
                if (shapeMovementScript.isFrozen == false && GameData.canGameOver == true)
                {
                    lossCounter++;
                    GameData.canSpawnShape = false;
                    totalScore             = heightLineScript.height;
                    CurrentData.gameData.totalBlocksPlaced += GameData.blocksPlacedInGame;

                    SetGameOverVaribles();
                    UpdateDataBase();
                }
                if (forceGameOver == true && shapeMovementScript.isFrozen == false)
                {
                    lossCounter++;
                    GameData.canSpawnShape = false;
                    totalScore             = heightLineScript.height;
                    CurrentData.gameData.totalBlocksPlaced += GameData.blocksPlacedInGame;


                    SetGameOverVaribles();
                    UpdateDataBase();
                }
            }

            if (collision.gameObject.tag == "Block" && shapeMovementScript.isFrozen == false)
            {
                if (GameData.isGameOver == true)
                {
                    gameOverUIPrefab.transform.GetChild(0).gameObject.SetActive(true);
                    gameOverSound = gameOverUIPrefab.GetComponent <AudioSource>();
                    gameOverSound.Play();
                    GameData.gameSpeed       = 0.3f;
                    GameData.freezeGameSpeed = true;
                }
            }
        }
    }
Exemplo n.º 3
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Block")
     {
         ShapeMovement shapeMove = other.gameObject.GetComponent <ShapeMovement>();
         if (shapeMove.canBeControlled == false)
         {
             collectCoinSound.Play();
             CollectCoin();
             if (GameData.canCollectCoin == true)
             {
                 GameData.firstCoin = true;
             }
         }
     }
 }
Exemplo n.º 4
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Block")
     {
         ShapeMovement shapeMove = collision.gameObject.GetComponent <ShapeMovement>();
         if (shapeMove.canBeControlled == false)
         {
             collectCoinSound.Play();
             CollectCoin();
             if (GameData.canCollectCoin == true) //for tutorial
             {
                 GameData.firstCoin = true;
             }
         }
     }
 }
Exemplo n.º 5
0
    private void SpawnShape()
    {
        //spawnDotScript.SetNoOfDots((lastHealth - 1) / 10 + 2);
        int        shapeIndex            = Random.Range(0, shapes.Length);
        int        shapeCoordinatesIndex = Random.Range(0, shapesCoordinates.Length);
        GameObject shape = Instantiate(shapes[shapeIndex], shapesCoordinates[shapeCoordinatesIndex], Quaternion.identity);

        shape.GetComponent <ShapeHeart>().SetShapeLife(lastHealth);
        ShapeMovement shapeMovement = shape.GetComponent <ShapeMovement>();

        shapeMovement.SetMovementDuration(movementDuration);
        shapeMovement.SetDestinationPoint(-1 * shapesCoordinates[shapeCoordinatesIndex].x, -1 * shapesCoordinates[shapeCoordinatesIndex].y);
        lastHealth++;
        spawnTime           += spawnTimeInc;
        spawnTimeInc        += 0.005f;
        movementDuration    += movementDurationInc;
        movementDurationInc += 0.005f;
    }
Exemplo n.º 6
0
 public GameplayState(ShapeMovement shapeMovement, UIManager uiManager)
 {
     _shapeMovement = shapeMovement;
     _uiManager     = uiManager;
 }
Exemplo n.º 7
0
 private void Construct(ShapeMovement shapeMovement, Settings settings)
 {
     _shapeMovement = shapeMovement;
     _settings      = settings;
 }
Exemplo n.º 8
0
 public InputManager(ShapeMovement shapeMovement)
 {
     _shapeMovement = shapeMovement;
 }