Exemplo n.º 1
0
    public ArrayList getConfig()
    {
        ArrayList config = new ArrayList();

        int nb = 0;
        foreach(Transform t in transform)
        {
            if(t.GetComponent<AABBOutlineResizer>())
            {
                nb ++;
            }
        }
        config.Add(nb);//int

        foreach(Transform t in transform)
        {
            if(t.GetComponent<AABBOutlineResizer>())
            {
                _resizer = t.GetComponent<AABBOutlineResizer>();
                config.Add(t.name);//string
                if(t.gameObject.name != "margelle")
                {
                    config.Add(_resizer.GetDownOffset());// vv Floats vv
                    config.Add(_resizer.GetUpOffset());
                    config.Add(_resizer.GetForwardOffset());
                    config.Add(_resizer.GetBackOffset());
                    config.Add(_resizer.GetRightOffset());
                    config.Add(_resizer.GetLeftOffset());
                }
                config.Add(_resizer.getOffsetRotationUV());
                config.Add(_resizer.getOffsetTileUV());

                if(t.gameObject.name == "plage")
                {
                    config.Add(_resizer.getColorPlage().x);
                    config.Add(_resizer.getColorPlage().y);
                    config.Add(_resizer.getColorPlage().z);
                }
                else if(t.gameObject.name == "margelle")
                {
                    config.Add(_resizer.getColorMargelle().x);
                    config.Add(_resizer.getColorMargelle().y);
                    config.Add(_resizer.getColorMargelle().z);
                }
                else if(t.gameObject.name == "muret")
                {
                    config.Add(_resizer.getColorMuret().x);
                    config.Add(_resizer.getColorMuret().y);
                    config.Add(_resizer.getColorMuret().z);
                }
                config.Add(_resizer.getHueLevel());
                config.Add(_resizer.getSaturation());
            }
        }

        return config;
    }
Exemplo n.º 2
0
    public void SetPoolObject(GameObject pool)
    {
        if (pool == null)
        {
            DestroyArrows ();
            return;
        }

        _poolObject = pool;
        _hasPool = true;

        _sideWalkResizer = getResizer("plage");

        if (_sideWalkResizer == null)
        {
            DestroyArrows ();
            return;
        }

        _occlusionResizer = getResizer("SolOcclu");
        _hasOcclusion = _occlusionResizer != null;

        if (_hasOcclusion)
            _occlusionInitialPosition = _occlusionResizer.transform.localPosition;

        _lowWallResizer = getResizer("muret");

        Bounds b = _sideWalkResizer.InitialBounds;

        // place arrows in relation to the sidewalk initial bounding box
        if(_forwardArrow == null)
        {
            CreateArrows();
        }

        //		_forwardArrow.parent = _sideWalkResizer.transform;
        //		_forwardArrow.localPosition = new Vector3 (b.center.x, Y_ARROW, b.center.z + b.extents.z);
        //		_forwardArrow.localRotation = Quaternion.AngleAxis (-90, Vector3.up);
        //
        //		_rightArrow.parent = _sideWalkResizer.transform;
        //		_rightArrow.localPosition = new Vector3 (b.center.x + b.extents.x, Y_ARROW, b.center.z);
        //		_rightArrow.localRotation = Quaternion.AngleAxis (0, Vector3.up);
        //
        //		_leftArrow.parent = _sideWalkResizer.transform;
        //		_leftArrow.localPosition = new Vector3 (b.center.x - b.extents.x, Y_ARROW, b.center.z);
        //		_leftArrow.localRotation = Quaternion.AngleAxis (180, Vector3.up);
        //
        //		_backArrow.parent = _sideWalkResizer.transform;
        //		_backArrow.localPosition = new Vector3 (b.center.x, Y_ARROW, b.center.z - b.extents.z);
        //		_backArrow.localRotation = Quaternion.AngleAxis (90, Vector3.up);

        float arrowLength = _forwardArrow.GetComponent<Renderer>().bounds.extents.z * 4;

        _forwardArrow.parent = _sideWalkResizer.transform;
        _forwardArrow.localPosition = new Vector3 (b.center.x, Y_ARROW, b.center.z + arrowLength);
        _forwardArrow.localRotation = Quaternion.AngleAxis (-90, Vector3.up);

        _rightArrow.parent = _sideWalkResizer.transform;
        _rightArrow.localPosition = new Vector3 (b.center.x + arrowLength, Y_ARROW, b.center.z);
        _rightArrow.localRotation = Quaternion.AngleAxis (0, Vector3.up);

        _leftArrow.parent = _sideWalkResizer.transform;
        _leftArrow.localPosition = new Vector3 (b.center.x - arrowLength, Y_ARROW, b.center.z);
        _leftArrow.localRotation = Quaternion.AngleAxis (180, Vector3.up);

        _backArrow.parent = _sideWalkResizer.transform;
        _backArrow.localPosition = new Vector3 (b.center.x, Y_ARROW, b.center.z - arrowLength);
        _backArrow.localRotation = Quaternion.AngleAxis (90, Vector3.up);

        // get offsets from resizer
        _forwardOffset = _sideWalkResizer.GetForwardOffset ();
        _rightOffset = _sideWalkResizer.GetRightOffset ();
        _leftOffset = _sideWalkResizer.GetLeftOffset ();
        _backOffset = _sideWalkResizer.GetBackOffset ();
        _lowWallHeight = _lowWallResizer.GetDownOffset ();

        tmpOff7Tab[0] = _sideWalkResizer.GetForwardOffset ();
        tmpOff7Tab[1] = _sideWalkResizer.GetRightOffset ();
        tmpOff7Tab[2] = _sideWalkResizer.GetLeftOffset ();
        tmpOff7Tab[3] = _sideWalkResizer.GetBackOffset ();
        tmpOff7Tab[4] = _lowWallResizer.GetDownOffset ();

        tmpOff7RotationUV = getResizer ("plage").getOffsetRotationUV ();
        tmpOff7TilePlage = getResizer ("plage").getOffsetTileUV ();
        if (tmpOff7TilePlage <= 0.01f)
            tmpOff7TilePlage = 0.4f;

        Vector3 vec = getResizer ("plage").getColorPlage ();
        _colorTab [0] = new Color (vec.x,vec.y,vec.z);

        camRGB.gameObject.SetActive(true);

        Color color;

        if (getResizer ("plage").gameObject.GetComponent<Renderer> ().material.shader.name == "Pointcube/StandardObjet")
        {
            color = getResizer ("plage").GetComponent<Renderer> ().material.GetColor ("_Huecolor");
            picker.GetComponent<HSVPicker> ().currentPlageColor = color;

        }

        if (getResizer ("plage").gameObject.GetComponent<Renderer> ().material.shader.name == "Pointcube/StandardObjet") {

            if (getResizer ("muret") != null) {
                vec = getResizer ("muret").getColorPlage ();
                _colorTab [1] = new Color (vec.x, vec.y, vec.z);

                color = getResizer ("muret").GetComponent<Renderer> ().material.GetColor ("_Huecolor");
                picker.GetComponent<HSVPicker> ().currentMuretColor = color;
                tmpOff7TileMuret = getResizer ("muret").getOffsetTileUV ();
                if (tmpOff7TileMuret <= 0.01f)
                    tmpOff7TileMuret = 0.4f;
            }
        }
            if( getResizer ("plage").gameObject.GetComponent<Renderer>().material.shader.name == "Pointcube/StandardObjet" )
            {
                if( getResizer ("margelle") != null)
                {
                    vec = getResizer ("margelle").getColorPlage ();
                    _colorTab[2] = new Color (vec.x,vec.y,vec.z);

                    color = getResizer ("margelle").GetComponent<Renderer>().material.GetColor("_Huecolor");
                    picker.GetComponent<HSVPicker>().currentMargelleColor = color;
                    tmpOff7TileMargelle = getResizer ("margelle").getOffsetTileUV ();
                    if (tmpOff7TileMargelle <= 0.01f)
                    tmpOff7TileMargelle = 0.4f;
                }
            }

        camRGB.gameObject.SetActive(false);

        Function_hideObject hider = pool.GetComponent<Function_hideObject> ();
        if (hider != null && hider._hide)
        {
            //hider.DoAction ();
        }
    }
Exemplo n.º 3
0
    //SAVE/LOAD
    public void save(BinaryWriter buf)
    {
        int nb = 0;
        foreach(Transform t in transform)
        {
            if(t.GetComponent<AABBOutlineResizer>())
            {
                nb ++;
            }
        }
        buf.Write(nb);//int

        foreach(Transform t in transform)
        {
            if(t.GetComponent<AABBOutlineResizer>())
            {
                _resizer = t.GetComponent<AABBOutlineResizer>();
                buf.Write(t.name);//string
                if(t.gameObject.name != "margelle")
                {
                    buf.Write(_resizer.GetDownOffset());// vv Floats vv
                    buf.Write(_resizer.GetUpOffset());
                    buf.Write(_resizer.GetForwardOffset());
                    buf.Write(_resizer.GetBackOffset());
                    buf.Write(_resizer.GetRightOffset());
                    buf.Write(_resizer.GetLeftOffset());
                }
                buf.Write(_resizer.getOffsetRotationUV());
                buf.Write(_resizer.getOffsetTileUV());
                //Debug.Log("ECRITURE TILE : " + _resizer.getOffsetTileUV());
                if(t.gameObject.name == "plage")
                {
                    buf.Write(_resizer.getColorPlage().x);
                    buf.Write(_resizer.getColorPlage().y);
                    buf.Write(_resizer.getColorPlage().z);
                    //Debug.Log("ECRITURE COLORPLAGE  x:" + _resizer.getColorPlage().x + "  y:"+_resizer.getColorPlage().y + "  z:"+_resizer.getColorPlage().z);
                }
                else if(t.gameObject.name == "margelle")
                {
                    buf.Write(_resizer.getColorMargelle().x);
                    buf.Write(_resizer.getColorMargelle().y);
                    buf.Write(_resizer.getColorMargelle().z);
                }
                else if(t.gameObject.name == "muret")
                {
                    buf.Write(_resizer.getColorMuret().x);
                    buf.Write(_resizer.getColorMuret().y);
                    buf.Write(_resizer.getColorMuret().z);
                }
                buf.Write(_resizer.getHueLevel());
                buf.Write(_resizer.getSaturation());
            }
        }
    }