Пример #1
0
    void Start()
    {
        sstm = GetComponent <SendShapeToManager> ();
        ar   = GetComponent <ActualRotation> ();
        mc   = GetComponent <MovingController> ();
        cr   = GetComponent <ControlRigidbodies> ();
        cc   = GetComponentsInChildren <CubeController> ();

        foreach (Transform tr in transform)
        {
            child = tr.gameObject;
        }

        drc = child.GetComponentsInChildren <DrawRaysCube> ();
    }
Пример #2
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));
    }