Esempio n. 1
0
        void DestroyBlocks(GameObject selectedSquare)
        {
            FloorProperties square = selectedSquare.GetComponent <FloorProperties> ();

            switch (square.cubeColor)
            {
            case ColorEnum.Gray:
                Destroy(square.cube);
                ScoreSystem.grayNum    += 1;
                ScoreSystem.multiplier += 1;
                ScoreSystem.CalculateScore();
                break;

            case ColorEnum.Black:
                square.color = ColorEnum.None;
                selectedSquare.GetComponent <Renderer> ().material      = normalPlacementMaterial;
                square.indicator.GetComponent <MeshRenderer> ().enabled = false;
                break;

            case ColorEnum.Green:
                GreenOnGreen(selectedSquare.transform);
                break;

            case ColorEnum.Red:
                RedOnRed(selectedSquare.transform);
                break;
            }
        }
Esempio n. 2
0
    public void denyKasse()
    {
        int oldScore  = score.getScore();
        int itemScore = ScoreSystem.CalculateScore(holdItem);

        ScoreSystem.SendScoreChange(oldScore, oldScore - itemScore);

        setHandsFree();
    }
Esempio n. 3
0
        IEnumerator DestroyGreenChain(List <GameObject> chainList)
        {
            for (int c = 0; c < chainList.Count; c++)
            {
                CubeSpawn.turnPause = true;

                var overlappingCubes = Physics.OverlapSphere(chainList[c].transform.position, 4);

                Destroy(chainList[c].gameObject);
                ScoreSystem.IncreaseBlockScore(ColorEnum.Green);
                ScoreSystem.multiplier += 1;

                for (int b = 0; b < overlappingCubes.Length; b++)
                {
                    if (overlappingCubes[b].tag.ToLower() == "block")
                    {
                        ResetFloorProperties(overlappingCubes[b].gameObject, false);
                        continue;
                    }

                    var cubeController = overlappingCubes[b].GetComponent <CubeController>();
                    if (cubeController == null)
                    {
                        continue;
                    }

                    if (cubeController.cubeColor == ColorEnum.Green)
                    {
                        //If the green block is not currently in the list of green blocks to destroy, add it
                        bool greenCubeExists = false;

                        for (int ba = 0; ba < chainList.Count; ba++)
                        {
                            if (chainList [ba].gameObject != null)
                            {
                                if (overlappingCubes[b].transform.position == chainList[ba].transform.position)
                                {
                                    greenCubeExists = true;
                                }
                            }
                        }

                        if (!greenCubeExists)
                        {
                            chainList.Add(overlappingCubes [b].gameObject);
                        }
                    }


                    if (cubeController.cubeColor == ColorEnum.Gray || cubeController.cubeColor == ColorEnum.Red)
                    {
                        ScoreSystem.IncreaseBlockScore(cubeController.cubeColor);
                        Destroy(cubeController.gameObject);
                    }
                }
                yield return(new WaitForSeconds(destructionSpeed));
            }

            CubeSpawn.turnPause = false;
            ScoreSystem.CalculateScore();
        }