Exemple #1
0
    // Use this for initialization
    void Start()
    {
        if (ChangeableVariables.levelWeAreIn.Contains("5x5") || StartFunction.freePlaySubLevels3appearB == true)
        {
            barrelsAvailable = true;
        }
        else
        {
        }
        dfc = GameObject.Find("DirectionsConnectedWithCamera").GetComponent <DirectionsFollowingCamera> ();
        //  total time we spend on accomplishing a level
        totalTime = 0;

        if (ChangeableVariables.levelWeAreIn == "3x3_2")
        {
            statesList.Add(TutorialLevel.TutorialStates.Accelerometer);
            statesList.Add(TutorialLevel.TutorialStates.Switch);
        }

        StartCoroutine(Timer());

        for (int i = 1; i < 7; i++)
        {
            shapesToDisplay.Add(i);
        }

        gm      = Camera.main.GetComponent <GUIMain> ();
        sc      = GameObject.Find("Platform").GetComponent <ScoreController> ();
        tempnum = UnityEngine.Random.Range(ChangeableVariables.spawnFrom, ChangeableVariables.spawnTo);
        if (ChangeableVariables.levelWeAreIn == "3x3_3")
        {
            ChangeableVariables.spawnFrom = 0;
        }
        PickShape();
    }
Exemple #2
0
    void Start()
    {
        if (ChangeableVariables.levelWeAreIn == "3x3_1" || ChangeableVariables.levelWeAreIn == "3x3_2")
        {
            tL = GameObject.Find("Tutorial").GetComponent <TutorialLevel> ();
        }

        //  fire an event to change shapes directions (how we control the shape) - "switch feature"
        //  because we can rotate the camera before we decide to switch shapes
        //  and because the new shape each time takes the directions that used to be
        //  we need to change them
        SpawnCubes.switchMovements += ChangeDirections;

        scCtrl = GameObject.Find("Platform").GetComponent <ScoreController> ();

        dS = transform.GetComponent <DisablingScripts> ();

        zOc = transform.GetComponentInChildren <ZeroOverlappingCases> ();

        currentState = PossibleStates.TurnOff;
        cC           = GetComponentsInChildren <CubeController> ();

        spawner = GameObject.FindGameObjectWithTag("Spawner");
        sC      = (SpawnCubes)spawner.GetComponent(typeof(SpawnCubes));
        mC      = GetComponent <MovingController> ();

        directions = GameObject.FindGameObjectWithTag("Directions");
        dfc        = (DirectionsFollowingCamera)directions.GetComponent(typeof(DirectionsFollowingCamera));
    }
Exemple #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));
    }