Beispiel #1
0
    public void SpaceWasHit()
    {
        //  check if the shape is outside the borders
        //actualRot.CheckIfItIsOutside ();
        if (guiMain.preLevelWOpen == false && spaceWasHitBool == false)
        {
            if (lS.cantSwitchWhenVictoryOrLose == false)
            {
                spaceWasHitBool = true;
                this.tag        = "Stuck";
                DestroyGhostShape();
                curSpeed = 0.05f;
                sc.DropShape();
                hitSpace     = true;
                currentState = StatesOfTheShape.Drop;
                //  stop drawing the circles
                stopDrawing              = true;
                nameOfTheClickedShape    = string.Empty;
                TutorialLevel.cornerText = string.Empty;

                //  adv tutorial
                if (weAccomplishedTutorial == false)
                {
                    weAccomplishedTutorial = true;
                }
            }
        }
    }
Beispiel #2
0
    void RotateIfPossibleVertically(Vector3 direction)
    {
        if (guiMain.preLevelWOpen == false)
        {
            if (tL.currentState == TutorialLevel.TutorialStates.RotateVertically ||
                weAccomplishedTutorial == true && lS.cantSwitchWhenVictoryOrLose == false)
            {
                bool canRotate = 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
                    canRotate = drawRays.RotateVertically();
                    if (canRotate == false)
                    {
                        if (GUIMain.soundEffectMuteBool == false)
                        {
                            audio.PlayOneShot(CantMove, 0.01f);
                        }
                        break;
                    }
                }

                if (canRotate)
                {
                    /*
                     * if (transform.gameObject.name.Contains ("Sofa") && sofaHigher == false)
                     * {
                     *      transform.position += Vector3.up * 1.5f;
                     *      sofaHigher = true;
                     * }
                     * else if (transform.gameObject.name.Contains ("Sofa") && sofaHigher == true)
                     * {
                     *      transform.position += Vector3.down * 1.5f;
                     *      sofaHigher = false;
                     * }
                     */
                    DestroyGhostShape();
                    currentState = StatesOfTheShape.Rotate;
                    //  rotate in a certain direction direction
                    actualRot.RotatePiece(direction);

                    if (GUIMain.soundEffectMuteBool == false)
                    {
                        audio.PlayOneShot(Swosh, 1f);
                    }

                    if (tL.currentState == TutorialLevel.TutorialStates.RotateVertically &&
                        PlayerPrefs.GetString("FinidhedFirstTutorial") == "false")
                    {
                        tL.currentState = statesList [numberOfTheState];
                        tL.CurrentTexture();
                        tL.NewPositionsOfTheVectors();
                        numberOfTheState++;
                    }
                }
            }
        }
    }
Beispiel #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));
    }