void Awake()
    {
        transform.parent = GameObject.Find ("MainNode").transform;

        transform.localScale = Vector3.one;

        goParent3DPosition = new GameObject();
        //goParent3DPosition.transform.parent = GameObject.Find ("MainNode").transform;
        goParent3DPosition.name = "3Dposition_" + name;

        goBloc = GameObject.Instantiate(Resources.Load("GRI181")) as GameObject;
        goBloc.transform.parent = goParent3DPosition.transform;
        goBloc.GetComponent<Renderer>().enabled = false;
        goBloc.name = "GRI181";

        foreach(Transform child in goBloc.transform)
        {
            child.gameObject.layer = 14;  // underwater

            if(child.GetComponent<Renderer>())
            {
                child.GetComponent<Renderer>().enabled = false;
            }
        }

        _poolGen = new PoolGenerator (gameObject);

        if (pointsData.Length > 0)
        {
        //	pointsData = MirrorX(pointsData);
            _polygon = new Polygon (pointsData);

            if (!_IsGenerated)
            {
                _IsGenerated = true;

                _pointsDataBackup = new Point2Data[pointsData.Length];
                _polygon.CopyPoint2DataTo (_pointsDataBackup);

                _poolGen.Generate (_polygon);
                _rimCount = _poolGen.GetRimCount ();

                DesignerDesjoyaux fb = gameObject.AddComponent<DesignerDesjoyaux> ();
                fb.gofiltrationBlock = goBloc;
                fb.poolDesigner = this;

                Function_hideObject sidewalkHider = gameObject.AddComponent<Function_hideObject> ();
                sidewalkHider._nameObjectToHide = "plage";
                sidewalkHider._strObjectToHide = "plage";

                Function_hideObject rimHider = gameObject.AddComponent<Function_hideObject> ();
                rimHider.id = 1;
                rimHider._nameObjectToHide = "margelle";
                rimHider._strObjectToHide = "margelle";
                rimHider._hide = false;
                rimHider.SetObjectToHide (_poolGen.GetRimObjects ());

                gameObject.AddComponent<Function_PoolInitializer> ();
                //StartCoroutine (Generate ());
            }
            else
            {
                // copie
                _isLoading = true;
                StartCoroutine (Generate (_polygon));
            }
        }
        else
        {
            _IsGenerated = true;
            _polygon = new Polygon ();

            DesignerDesjoyaux fb = gameObject.AddComponent<DesignerDesjoyaux> ();
            fb.gofiltrationBlock = goBloc;
            fb.poolDesigner = this;

            Function_hideObject sidewalkHide = gameObject.AddComponent<Function_hideObject> ();
            sidewalkHide._nameObjectToHide = "plage";
            sidewalkHide._strObjectToHide = "plage";

            Function_hideObject rimHider = gameObject.AddComponent<Function_hideObject> ();
            rimHider.id = 1;
            rimHider._nameObjectToHide = "margelle";
            rimHider._strObjectToHide = "margelle";
            rimHider._hide = false;
            rimHider.SetObjectToHide (_poolGen.GetRimObjects ());

            gameObject.AddComponent<Function_PoolInitializer> ();

            //StartCoroutine (WaitForGameobjectReadyToDoAction ());
        }

        init3DPoints();

        nextCurrentStairwayID(pointsData);

        savedPointsData = new Point2Data[pointsData.Length];
        for(int j = 0; j < pointsData.Length; j++)
        {
            savedPointsData[j] = pointsData[j];
        }

        if(listDoubleV3.Count > 0)
        {
            idDoubleV3 = 0;
            v3positionBloc = listDoubleV3[0].v3start;
            goBloc.transform.position = v3positionBloc;

            moveBloc();
        }
        else
        {
            idDoubleV3 = -1;
        }
    }
Пример #2
0
    void Awake()
    {
        transform.parent = GameObject.Find ("MainNode").transform;

        if(_uiName != null)
        {
            setUI ((FunctionUI_OS3D)GameObject.Find ("MainScene").GetComponent ("PoolUIv2"));
        //			setUI ((FunctionUI_OS3D)GameObject.Find ("MainScene").GetComponent ("PoolDesignerUI"));
        }

        transform.localScale = Vector3.one;

        _poolGen = new PoolGenerator (gameObject);

        if (pointsData.Length > 0)
        {
        //	pointsData = MirrorX(pointsData);
            _polygon = new Polygon (pointsData);

            if (!_IsGenerated)
            {
                _IsGenerated = true;

                _pointsDataBackup = new Point2Data[pointsData.Length];
                _polygon.CopyPoint2DataTo (_pointsDataBackup);

                _poolGen.Generate (_polygon);
                _rimCount = _poolGen.GetRimCount ();

                Function_hideObject sidewalkHider = gameObject.AddComponent<Function_hideObject> ();
                sidewalkHider._nameObjectToHide = "plage";
                sidewalkHider._strObjectToHide = "plage";

                Function_hideObject rimHider = gameObject.AddComponent<Function_hideObject> ();
                rimHider.id = 1;
                rimHider._nameObjectToHide = "margelle";
                rimHider._strObjectToHide = "margelle";
                rimHider._hide = false;
                rimHider.SetObjectToHide (_poolGen.GetRimObjects ());

                gameObject.AddComponent<Function_PoolInitializer> ();
                //StartCoroutine (Generate ());
            }
            else
            {
                // copie
                _isLoading = true;
                StartCoroutine (Generate (_polygon));
            }
        }
        else
        {
            _IsGenerated = true;
            _polygon = new Polygon ();

            Function_hideObject sidewalkHide = gameObject.AddComponent<Function_hideObject> ();
            sidewalkHide._nameObjectToHide = "plage";
            sidewalkHide._strObjectToHide = "plage";

            Function_hideObject rimHider = gameObject.AddComponent<Function_hideObject> ();
            rimHider.id = 1;
            rimHider._nameObjectToHide = "margelle";
            rimHider._strObjectToHide = "margelle";
            rimHider._hide = false;
            rimHider.SetObjectToHide (_poolGen.GetRimObjects ());

            gameObject.AddComponent<Function_PoolInitializer> ();

            StartCoroutine (WaitForGameobjectReadyToDoAction ());
        }

        //gameObject.GetComponent ("ObjData").SendMessage ("updateSpecFcns");
        //transform.localPosition = currentPosition;
    }