예제 #1
0
    void MoveIfPossible(Vector3 direction)
    {
        if (tL.currentState == TutorialLevel.TutorialStates.Drag ||
            weAccomplishedTutorial == true)
        {
            bool canMove = true;
            //  for each child we call this function
            foreach (DrawRaysCube drawRays in drc)
            {
                //  if it doesn't fullfil the requirements
                //  we cannot rotate and stop executing function
                canMove = drawRays.checkSphere(direction);
                if (canMove == false)
                {
                    if (GUIMain.soundEffectMuteBool == false)
                    {
                        audio.PlayOneShot(CantMove, 1f);
                    }
                    break;
                }
            }

            if (canMove)
            {
                transform.position += direction;
                if (GUIMain.soundEffectMuteBool == false)
                {
                    audio.PlayOneShot(MoveBump, 1f);
                }
                if (tL.currentState == TutorialLevel.TutorialStates.Drag && PlayerPrefs.GetString("FinidhedFirstTutorial") == "false")
                {
                    tL.currentState = statesList [numberOfTheState];
                    tL.CurrentTexture();
                    tL.NewPositionsOfTheVectors();
                    numberOfTheState++;
                }
                DestroyGhostShape();
                SpawnGhostShape();
            }
        }
    }
예제 #2
0
    public void PickShape()
    {
        if (ChangeableVariables.levelWeAreIn == "3x3_3")
        {
            ChangeableVariables.spawnFrom = 1;
        }
        //  tutorial level

        /*
         * if (ChangeableVariables.levelWeAreIn == "3x3_1" && numberOfTheState < 4)
         * {
         *      tL.currentState = statesList [numberOfTheState];
         *      tL.CurrentTexture ();
         *      tL.NewPositionsOfTheVectors ();
         *      numberOfTheState ++;
         * }
         */

        //  introduce accelerometer
        if (ChangeableVariables.levelWeAreIn == "3x3_2" && numberOfTheState < 2 &&
            PlayerPrefs.GetString("level3by3_3enabled") == "false")
        {
            tL.currentState = statesList [numberOfTheState];
            tL.CurrentTexture();
            tL.NewPositionsOfTheVectors();
            numberOfTheState++;
        }

        dP.numberOfFloorsWithDetail = lC.CountElementsInLists();
        dP.DynamicallyChangeCameraAndSpawner();


        if (lC.floor10Count.Count > 0)
        {
            lC.GameOver();
            return;
        }
        //  standard time before a shape falls down
        if (ChangeableVariables.levelWeAreIn == "3x3_1" || ChangeableVariables.levelWeAreIn == "3x3_2" || ChangeableVariables.levelWeAreIn == "3x3_3")
        {
            timer = 30;
        }
        else
        {
            timer = 20;
        }

        if (sc.FloorsCleared % 2 == 0 && sc.FloorsCleared > 0 && clearedFloorLastTime != (int)sc.FloorsCleared && sc.FloorsCleared < 27)
        {
            clearedFloorLastTime = (int)sc.FloorsCleared;
            timeToDecreaseTimer++;
//			Debug.Log ("Decreased it");
        }
        //dfc.DifficultyCurve ();
        //  and decrease it

        DecreaseTimer(timeToDecreaseTimer);
        if (newShapeToBeDisplayed == true)
        {
            CheckIfItIsNewShape();
        }

        tempcube1 = Instantiate(Cubes[tempnum], transform.position, transform.rotation) as GameObject;

        if (lC.floorClearedThisDrop)
        {
            lC.floorClearedThisDrop = false;
            lC.floorClearedLastDrop = true;
            sc.FloorComboMultiplyer++;
        }
        else if (!lC.floorClearedThisDrop && lC.floorClearedLastDrop)
        {
            lC.floorClearedLastDrop = false;
            sc.FloorComboMultiplyer = 1;
        }

        sc.ScoreForDrop = 10;
        tempcube1.tag   = "Active";
        index           = tempnum;
        gm.Dropping     = false;


        GettingRandomNumber();

        //  3x3 level - spawn the bomb only once.
        if (ChangeableVariables.levelWeAreIn == "3x3_3" && bombWasSpawnedIn3by3 == false)
        {
            if (lC.floor1Count.Count > 4 || lC.floor2Count.Count > 4 || lC.floor3Count.Count > 4 ||
                lC.floor4Count.Count > 4 || lC.floor5Count.Count > 4)
            {
//				Debug.Log ("Did it");
                tempnum = 0;
                ChangeableVariables.spawnFrom = 1;
//				Debug.Log (ChangeableVariables.spawnFrom);
                bombWasSpawnedIn3by3 = true;
            }
        }

        nameOfNextShape = Cubes [tempnum].name;
        gm.DisplayImage();

        /*
         * if (switchMovements != null)
         * {
         *      switchMovements ();
         * }
         */
    }
예제 #3
0
    void Start()
    {
        guiMain = Camera.main.GetComponent <GUIMain> ();


        shapesManager = GameObject.Find("ShapesManager");
        sM            = shapesManager.GetComponent <ShapesManager> ();
        tutorial      = GameObject.Find("Tutorial");
        tL            = tutorial.GetComponent <TutorialLevel> ();

        //  just for the first shape
        if (ChangeableVariables.levelWeAreIn == "3x3_1" && sM.activeShapes.Count < 1 &&
            PlayerPrefs.GetString("FinidhedFirstTutorial") == "false")
        {
            statesList.Add(TutorialLevel.TutorialStates.RotateHorizontally);
            statesList.Add(TutorialLevel.TutorialStates.RotateVertically);
            statesList.Add(TutorialLevel.TutorialStates.Drag);
            statesList.Add(TutorialLevel.TutorialStates.DoubleTap);

            tL.currentState = statesList [numberOfTheState];
            tL.CurrentTexture();
            tL.NewPositionsOfTheVectors();
            numberOfTheState++;
            weAccomplishedTutorial = false;
        }
        else
        {
            weAccomplishedTutorial = true;
        }


        SwapTexture();


        currentState = StatesOfTheShape.Idle;
        sc           = GameObject.Find("Platform").GetComponent <ScoreController> ();
        lS           = GameObject.Find("Platform").GetComponent <LineScore> ();

        lS.activeObject = this.gameObject;

        actualRot = transform.GetComponentInChildren <ActualRotation> ();
        drc       = transform.GetComponentsInChildren <DrawRaysCube> ();

        directions = GameObject.FindGameObjectWithTag("Directions");
        dfc        = (DirectionsFollowingCamera)directions.GetComponent(typeof(DirectionsFollowingCamera));

        curSpeed = dfc.speedOfFalling;

        //  get directions
        //  each time we spawn a new shape we need to know
        //  which directions we used for the last one
        dir1 = dfc.dir1;
        dir2 = dfc.dir2;
        dir3 = dfc.dir3;
        dir4 = dfc.dir4;

        rot1 = Vector3.down;
        rot2 = Vector3.up;


        camCon = (cameraController)Camera.main.gameObject.GetComponent(typeof(cameraController));
        camCon.GetTheShapeToChangeItsDirections(this.gameObject);
        camCon.DependsOnCameraPos();
        //  custom positions - most of details don't land in the center
        if (transform.gameObject.name.Contains("Sofa"))
        {
            transform.position = new Vector3(ChangeableVariables.LShapeX, transform.position.y + 1.5f, ChangeableVariables.LShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("CanShark"))
        {
            transform.position = new Vector3(ChangeableVariables.IShapeX, transform.position.y + 2.5f, ChangeableVariables.IShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("TV"))
        {
            transform.position = new Vector3(ChangeableVariables.OShapeX, transform.position.y + 0.5f, ChangeableVariables.OShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("Car"))
        {
            transform.position = new Vector3(ChangeableVariables.TShapeX, transform.position.y + 1.5f, ChangeableVariables.TShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("Microwave"))
        {
            transform.position = new Vector3(ChangeableVariables.ZShapeX, transform.position.y + 1, ChangeableVariables.ZShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("Barrels"))
        {
            transform.position = new Vector3(ChangeableVariables.SShapeX, transform.position.y + 0.5f, ChangeableVariables.SShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("Boxes"))
        {
            transform.position = new Vector3(ChangeableVariables.YShapeX, transform.position.y + 0.5f, ChangeableVariables.YShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("Fridge"))
        {
            transform.position = new Vector3(ChangeableVariables.NShapeX, transform.position.y + 0.5f, ChangeableVariables.NShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("BottleBox"))
        {
            transform.position = new Vector3(ChangeableVariables.TwoShapeX, transform.position.y + 0.5f, ChangeableVariables.TwoShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("WC"))
        {
            transform.position = new Vector3(ChangeableVariables.ThreeShapeX, transform.position.y + 0.5f, ChangeableVariables.ThreeShapeZ);
            SpawnGhostShape();
        }
        else if (transform.gameObject.name.Contains("TNT"))
        {
            transform.position = new Vector3(ChangeableVariables.OneShapeX, transform.position.y, ChangeableVariables.OneShapeZ);
            bgs = GetComponentInChildren <BombGhostShape> ();
            SpawnGhostShape();
        }
        root = transform.root.gameObject;
        cr   = (ControlRigidbodies)root.GetComponent(typeof(ControlRigidbodies));
    }