Exemplo n.º 1
0
    public void Build(Function_Pergola.PElement m,BuildDatas bd,PergolaRule pr,int index,int off7)
    {
        float h = m._h - bd._frameH;

        float sizeH = _opening * h;
        float posH = h-(sizeH/2);

        int sizeL = m._l- bd._subFrameW;
        int sizeW = m._w - bd._subFrameW;

        if(m._pergolaType ==  Function_Pergola.PergolaType.single)
        {
            if(m._W1 != screensType[0].name)
                AddPartAtWthMat(new Vector3(off7+m._w/2,posH,-m._l/2+bd._footSize/2),new Vector3(sizeW,1,sizeH),screens,index,GetScreenType(m._W1).mat,180);
            if(m._W2 != screensType[0].name)
                AddPartAtWthMat(new Vector3(off7+m._w/2,posH,m._l/2-bd._footSize/2),new Vector3(sizeW,1,sizeH),screens,index,GetScreenType(m._W2).mat,0);
            if(m._L2 != screensType[0].name)
                AddPartAtWthMat(new Vector3(off7+bd._footSize/2,posH,0),new Vector3(sizeL,1,sizeH),screens,index,GetScreenType(m._L2).mat,-90);
            if(m._L1 != screensType[0].name)
                AddPartAtWthMat(new Vector3(off7+m._w-bd._footSize/2,posH,0),new Vector3(sizeL,1,sizeH),screens,index,GetScreenType(m._L1).mat,90);
        }
        else if(m._pergolaType == Function_Pergola.PergolaType.CL)
        {
            if(m._W1 != screensType[0].name)
                AddPartAtWthMat(new Vector3(off7+m._w/2,posH,-m._l/2+bd._footSize/2),new Vector3(sizeW,1,sizeH),screens,index,GetScreenType(m._W1).mat,180);
            if(m._W2 != screensType[0].name)
                AddPartAtWthMat(new Vector3(off7+m._w/2,posH,m._l/2-bd._footSize/2),new Vector3(sizeW,1,sizeH),screens,index,GetScreenType(m._W2).mat,0);

            if(m._L2 != screensType[0].name)
                AddPartAtWthMat(new Vector3(off7+bd._footSize/2,posH,0),new Vector3(sizeL,1,sizeH),screens,index,GetScreenType(m._L2).mat,-90);
            if(m._L1 != screensType[0].name)
                AddPartAtWthMat(new Vector3(off7+m._w-bd._footSize/2,posH,0),new Vector3(sizeL,1,sizeH),screens,index,GetScreenType(m._L1).mat,90);
        }
        else if(m._pergolaType == Function_Pergola.PergolaType.CW)
        {
            if(m._W1 != screensType[0].name)
                AddPartAtWthMat(new Vector3(0,posH,off7+bd._footSize/2),new Vector3(sizeW,1,sizeH),screens,index,GetScreenType(m._W1).mat,180);
            if(m._W2 != screensType[0].name)
                AddPartAtWthMat(new Vector3(0,posH,off7+m._l-bd._footSize/2),new Vector3(sizeW,1,sizeH),screens,index,GetScreenType(m._W2).mat,0);
            if(m._L2 != screensType[0].name)
                AddPartAtWthMat(new Vector3(-m._w/2+bd._footSize/2,posH,off7+m._l/2),new Vector3(sizeL,1,sizeH),screens,index,GetScreenType(m._L2).mat,-90);
            if(m._L1 != screensType[0].name)
                AddPartAtWthMat(new Vector3(m._w/2-bd._footSize/2,posH,off7+m._l/2),new Vector3(sizeL,1,sizeH),screens,index,GetScreenType(m._L1).mat,90);
        }

        UpdateScreens();
    }
Exemplo n.º 2
0
    public void Build(Function_Pergola.PElement m,BuildDatas bd,PergolaRule pr,int index,int off7)
    {
        float sizeH = m._h - bd._frameH;
        float posH = sizeH/2;

        int sizeL = bd._footSize;
        int sizeW = bd._footSize;

        Vector3 size = new Vector3(sizeW,sizeH,sizeL);

        if(m._pergolaType ==  Function_Pergola.PergolaType.single)
        {
            if(m._dpW1)
                AddPartAt(new Vector3(off7+m._w/2,posH,-m._l/2+bd._footSize/2),size,doors,index);
            if(m._dpW2)
                AddPartAt(new Vector3(off7+m._w/2,posH,m._l/2-bd._footSize/2),size,doors,index);
            if(m._dpL2)
                AddPartAt(new Vector3(off7+bd._footSize/2,posH,0),size,doors,index);
            if(m._dpL1)
                AddPartAt(new Vector3(off7+m._w-bd._footSize/2,posH,0),size,doors,index);
        }
        else if(m._pergolaType == Function_Pergola.PergolaType.CL)
        {
            if(m._dpW1)
                AddPartAt(new Vector3(off7+m._w/2,posH,-m._l/2+bd._footSize/2),size,doors,index);
            if(m._dpW2)
                AddPartAt(new Vector3(off7+m._w/2,posH,m._l/2-bd._footSize/2),size,doors,index);
            if(m._dpL2)
                AddPartAt(new Vector3(off7+bd._footSize/2,posH,0),size,doors,index);
            if(m._dpL1)
                AddPartAt(new Vector3(off7+m._w-bd._footSize/2,posH,0),size,doors,index);
        }
        else if(m._pergolaType == Function_Pergola.PergolaType.CW)
        {
            if(m._dpW1)
                AddPartAt(new Vector3(0,posH,off7+bd._footSize/2),size,doors,index);
            if(m._dpW2)
                AddPartAt(new Vector3(0,posH,off7+m._l-bd._footSize/2),size,doors,index);
            if(m._dpL2)
                AddPartAt(new Vector3(-m._w/2+bd._footSize/2,posH,off7+m._l/2),size,doors,index);
            if(m._dpL1)
                AddPartAt(new Vector3(m._w/2-bd._footSize/2,posH,off7+m._l/2),size,doors,index);
        }
    }
Exemplo n.º 3
0
    void BuildCWRoofAt(Vector3 posStart,float Length,Function_Pergola.PElement m,BuildDatas bd,int index)
    {
        _screenSize = Mathf.Abs((Length/2)/(Mathf.Cos(10* Mathf.Deg2Rad)));	//Longueur du screen
        float triangleSize = m._l - 1200; 									// Taille du triangle
        float pivotAlt = (600)*Mathf.Tan(Mathf.Tan(10* Mathf.Deg2Rad));		//altitude de la barre

        Vector3 posEnd = posStart;
        posEnd.x +=m._w - 2*bd._frameW;

        Vector3 triStUpAf = new Vector3(-0.1f,0.2f,1); // décalage anti flick
        Vector3 triEdUpAf = new Vector3(0.1f,0.2f,1);

        //Build Des Triangles
        AddPartAt(posStart+triStUpAf,new Vector3(triangleSize,triangleSize,1000),new Vector3(0,-90,0),_roof,index+"_mL",side,_fp.GetMaterial());
        AddPartAt(posEnd+triEdUpAf,new Vector3(triangleSize,triangleSize,1000),new Vector3(0,90,0),_roof,index+"_mR",side,_fp.GetMaterial());

        //Build Des Screens
        GameObject screen1 = new GameObject(index+"_screen1");

        AddPartAt(new Vector3(-m._w/2+sectionBOx/2+bd._frameW,0,-(_screenSize * _opening)/2),new Vector3(sectionBOx,sectionBOy,(_screenSize * _opening)),Vector3.zero,screen1,"sl",bar,_fp.GetMaterial());
        AddPartAt(new Vector3(m._w/2-sectionBOx/2-bd._frameW,0,-(_screenSize * _opening)/2),new Vector3(sectionBOx,sectionBOy,(_screenSize * _opening)),Vector3.zero,screen1,"sr",bar,_fp.GetMaterial());
        AddPartAt(new Vector3(0,0,-(_opening * (_screenSize * _opening))/2),new Vector3(m._w-sectionBOx-2*bd._frameW,1000,_opening * (_screenSize * _opening)),Vector3.zero,screen1,"screen",screen,_roof.GetComponent<Renderer>().material);

        screen1.transform.parent = _roof.transform;
        screen1.transform.localPosition = (new Vector3(0,m._h-pivotAlt-sectionBOy/2,posStart.z + Length/2))/1000f;
        Quaternion q = new Quaternion(0,0,0,0);
        q.eulerAngles = new Vector3(10.0f,0f,0f);
        screen1.transform.localRotation = q;

        GameObject screen2 = new GameObject(index+"_screen2");

        AddPartAt(new Vector3(-m._w/2+sectionBOx/2+bd._frameW,0,(_screenSize * _opening)/2),new Vector3(sectionBOx,sectionBOy,(_screenSize * _opening)),Vector3.zero,screen2,"sl",bar,_fp.GetMaterial());
        AddPartAt(new Vector3(m._w/2-sectionBOx/2-bd._frameW,0,(_screenSize * _opening)/2),new Vector3(sectionBOx,sectionBOy,(_screenSize * _opening)),Vector3.zero,screen2,"sr",bar,_fp.GetMaterial());
        AddPartAt(new Vector3(0,0,(_opening * (_screenSize * _opening))/2),new Vector3(m._w-sectionBOx-2*bd._frameW,1000,_opening * _screenSize),Vector3.zero,screen2,"screen",screen,_roof.GetComponent<Renderer>().material);

        screen2.transform.parent = _roof.transform;
        screen2.transform.localPosition = (new Vector3(0,m._h-pivotAlt-sectionBOy*1.5f,posStart.z -Length/2))/1000f;
        Quaternion q2 = new Quaternion(0,0,0,0);
        q2.eulerAngles = new Vector3(-10.0f,0f,0f);
        screen2.transform.localRotation = q2;
    }
Exemplo n.º 4
0
    public void Build(Function_Pergola.PElement m,BuildDatas bd,PergolaRule pr,int index,int off7)
    {
        if(m._pergolaType == Function_Pergola.PergolaType.CL || m._pergolaType == Function_Pergola.PergolaType.single)
        {
            Vector3 start;
            Vector3 start2;
            float width;
            float width2;
            if(_fp.GetModulesCount() == 1) // Single
            {
                if(m._w <= pr.limit)
                {
                    start = new Vector3(off7+bd._frameW,m._h,0);
                    width = m._w-2*bd._frameW;
                    BuildCLRoofAt(start,width,m,bd,index);
                }
                else
                {
                    start = new Vector3(off7+bd._frameW,m._h,0);
                    width = m._subW1 - bd._frameW - bd._subFrameW/2;
                    BuildCLRoofAt(start,width,m,bd,index);
                    //BUILD LA BARRE
                    AddPartAt(new Vector3(off7+m._subW1,m._h - bd._frameH/2,0),new Vector3(bd._subFrameW,bd._frameH,m._l-2*bd._frameL),_fp.GetFrame(),index,bar,0,_fp.GetMaterial());
                    //-----------
                    start2 = new Vector3(off7+m._subW1+bd._subFrameW/2,m._h,0);
                    width2 = m._subW2 - bd._frameW - bd._subFrameW/2;
                    BuildCLRoofAt(start2,width2,m,bd,index);

                }
            }
            else// Multi
            {
                if(index == 0)// 1er
                {
                    if(m._w <= pr.limit)
                    {
                        start = new Vector3(off7+bd._frameW,m._h,0);
                        width = m._w-bd._frameW-bd._subFrameW/2;
                        BuildCLRoofAt(start,width,m,bd,index);
                    }
                    else
                    {
                        start = new Vector3(off7+bd._frameW,m._h,0);
                        width = m._subW1 - bd._frameW - bd._subFrameW/2;
                        BuildCLRoofAt(start,width,m,bd,index);
                        //BUILD LA BARRE
                        AddPartAt(new Vector3(off7+m._subW1,m._h - bd._frameH/2,0),new Vector3(bd._subFrameW,bd._frameH,m._l-2*bd._frameL),_fp.GetFrame(),index,bar,0,_fp.GetMaterial());
                        //-----------
                        start2 = new Vector3(off7+m._subW1+bd._subFrameW/2,m._h,0);
                        width2 = m._subW2 - bd._subFrameW;
                        BuildCLRoofAt(start2,width2,m,bd,index);

                    }
                }
                else if(index == _fp.GetModulesCount()-1)//dernier
                {
                    if(m._w <= pr.limit)
                    {
                        start = new Vector3(off7+bd._subFrameW/2,m._h,0);
                        width = m._w-bd._frameW-bd._subFrameW/2;
                        BuildCLRoofAt(start,width,m,bd,index);
                    }
                    else
                    {
                        start = new Vector3(off7+bd._subFrameW/2,m._h,0);
                        width = m._subW1 - bd._subFrameW/2 - bd._subFrameW/2;
                        BuildCLRoofAt(start,width,m,bd,index);
                        //BUILD LA BARRE
                        AddPartAt(new Vector3(off7+m._subW1,m._h - bd._frameH/2,0),new Vector3(bd._subFrameW,bd._frameH,m._l-2*bd._frameL),_fp.GetFrame(),index,bar,0,_fp.GetMaterial());
                        //-----------
                        start2 = new Vector3(off7+m._subW1+bd._subFrameW/2,m._h,0);
                        width2 = m._subW2 - bd._frameW - bd._subFrameW/2;
                        BuildCLRoofAt(start2,width2,m,bd,index);

                    }
                }
                else//les Autres
                {
                    if(m._w <= pr.limit)
                    {
                        start = new Vector3(off7+bd._subFrameW/2,m._h,0);
                        width = m._w-bd._subFrameW;
                        BuildCLRoofAt(start,width,m,bd,index);
                    }
                    else
                    {
                        start = new Vector3(off7+bd._subFrameW/2,m._h,0);
                        width = m._subW1 - bd._subFrameW;
                        BuildCLRoofAt(start,width,m,bd,index);
                        //BUILD LA BARRE
                        AddPartAt(new Vector3(off7+m._subW1,m._h - bd._frameH/2,0),new Vector3(bd._subFrameW,bd._frameH,m._l-2*bd._frameL),_fp.GetFrame(),index,bar,0,_fp.GetMaterial());
                        //-----------
                        start2 = new Vector3(off7+m._subW1+bd._subFrameW/2,m._h,0);
                        width2 = m._subW2 - bd._subFrameW;
                        BuildCLRoofAt(start2,width2,m,bd,index);

                    }
                }
            }
        }
        else // COUPLAGE W
        {
            Vector3 wStart;
            float 	wLength;

            if(_fp.GetModulesCount() == 1) 	// Single
            {

                    wStart = new Vector3(-m._w/2 + bd._frameW,m._h,off7+m._l/2);
                    wLength = m._l - 2*bd._frameL;
                    BuildCWRoofAt(wStart,wLength,m,bd,index);
            }
            else 							//Multi
            {
                if(index == 0)// 1er
                {
                    wStart = new Vector3(-m._w/2 + bd._frameW,m._h,off7+(m._l+bd._subFrameL)/2);
                    wLength = m._l - bd._frameL - bd._subFrameL/2;
                    BuildCWRoofAt(wStart,wLength,m,bd,index);
                }
                else if(index == _fp.GetModulesCount()-1)//dernier
                {
                    wStart = new Vector3(-m._w/2 + bd._frameW,m._h,off7+(m._l-bd._subFrameL)/2);
                    wLength = m._l - bd._frameL - bd._subFrameL/2;
                    BuildCWRoofAt(wStart,wLength,m,bd,index);
                }
                else//les Autres
                {
                    wStart = new Vector3(-m._w/2 + bd._frameW,m._h,off7+m._l/2);
                    wLength = m._l - bd._subFrameL;
                    BuildCWRoofAt(wStart,wLength,m,bd,index);
                }
            }
        }
    }
Exemplo n.º 5
0
    public void Build(Function_Pergola.PElement m,BuildDatas bd,PergolaRule pr,int index,int off7)
    {
        if(m._pergolaType == Function_Pergola.PergolaType.CL || m._pergolaType == Function_Pergola.PergolaType.single)
        {
            int len = m._l - 2*bd._footSize;
            int h = m._h - bd._frameH/2;
            int centre = off7+m._w/2;
            int startZ = -len/2+_bladeW/2;
            int nb = Mathf.FloorToInt(len/_bladeW);
            for(int i=0;i<nb;i++)
            {
                AddPartAt(new Vector3(centre,h,startZ+i*_bladeW),new Vector3(m._w-bd._subFrameW,_bladeH,_bladeW),blades,index,_BasePrimitive,0);
            }
            if(m._w > pr.limit)
            {
                AddPartAt(new Vector3(off7+m._subW1,h,0),new Vector3(bd._subFrameW,bd._frameH,len),_fp.GetFrame(),index,_BasePrimitive,0);
            }

        }
        else// if(m._pergolaType == PergolaType.CW)
        {
            int startZ = 0;
            int len = 0;
            if(_fp == null)
                _fp = GetComponent<Function_Pergola>();

            if(_fp.GetModulesCount() == 1)//1 module
            {
                startZ = off7+bd._footSize;
                len = m._l - 2*bd._footSize;
            }
            else//plusieurs modules
            {
                if(index == 0)//1er
                {
                    startZ = off7+bd._footSize;
                    len = m._l - bd._footSize - bd._subFrameW;
                }
                else if(index == _fp.GetModulesCount()-1)//dernier
                {
                    startZ = off7+bd._subFrameW/2;
                    len = m._l - bd._footSize - bd._subFrameW;
                }
                else//intermediares
                {
                    startZ = off7+bd._subFrameW/2;
                    len = m._l - 2*bd._subFrameW;
                }
            }

            startZ+=_bladeW/2;

            int nb = Mathf.CeilToInt(len/_bladeW);
            int h = m._h - bd._frameH/2;

            for(int i=0;i<nb;i++)
            {
                AddPartAt(new Vector3(0,h,startZ+i*_bladeW),new Vector3(m._w-2*bd._footSize,_bladeH,_bladeW),blades,index,_BasePrimitive,0);
            }
        }

        UpdateBladesOrientation();
    }
Exemplo n.º 6
0
    public void Build(Function_Pergola.PElement m,BuildDatas bd,PergolaRule pr,int index,int off7)
    {
        if(m._pergolaType == Function_Pergola.PergolaType.CL || m._pergolaType == Function_Pergola.PergolaType.single)
        {
            int len = m._l - 2*bd._footSize;
            int h = m._h - bd._frameH/2;
            int centre = off7+m._w/2;
        //			int nb = Mathf.FloorToInt(len/bladeSize);
        //
        //			if((len-(nb*bladeSize))>(bladeSize/2))
        //				nb++;
            int nb = Mathf.FloorToInt(len/bladeSize);
            if((len-(nb*bladeSize))>(bladeSize/4))
                nb++;
            float alpha = 1;
            if((nb*bladeSize)>len)
            {
                alpha = 1-(((float)(nb*bladeSize)-len)/((float)len));
            }
            else
            {
                alpha = 1-(((float)(nb*bladeSize)-len)/((float)len));
            }

            int startZ = -m._l/2+bd._footSize;//(-(nb*bladeSize)/2)+10;

            for(int i=0;i<nb;i++)
            {
                GameObject tmp = AddPartAt(new Vector3(centre,h,startZ+i*bladeSize),new Vector3(1000*alpha,1000,m._w-(2*bd._subFrameW)),_blades,index*100+i,basePrimitive,90);
                if(_prevBlade == null)
                    _prevBlade = tmp;
                else
                {
                    tmp.GetComponent<AnimateBlade>().alignTo = _prevBlade.transform.FindChild("1").transform;
                    _prevBlade = tmp;
                }
            }
            _prevBlade = null;

            if(useDoubleFrame)
            {
                if(m._w > uDFWidthLimit && m._l <= uDFLengthLimit) // 1barre
                {
                    AddPartAt(new Vector3(off7+m._subW1,h,0),new Vector3(bd._subFrameW,bd._frameH,len),_fp.GetFrame(),index,frame,0);
                }
                else if(m._w > uDFWidthLimit && m._l > uDFLengthLimit) // 2 barres
                {
                    AddPartAt(new Vector3(off7+m._subW1-bd._subFrameW/2,h,0),new Vector3(bd._subFrameW,bd._frameH,len),_fp.GetFrame(),index,frame,0);
                    AddPartAt(new Vector3(off7+m._subW1+bd._subFrameW/2,h,0),new Vector3(bd._subFrameW,bd._frameH,len),_fp.GetFrame(),index,frame,0);
                }
            }
            else
            {
                if(m._w > pr.limit)
                {

                    AddPartAt(new Vector3(off7+m._subW1,h,0),new Vector3(bd._subFrameW,bd._frameH,len),_fp.GetFrame(),index,frame,0);
                }
            }
        }
        else
        {
            int len = m._l - 2*bd._footSize;
            int h = m._h - bd._frameH/2;
            int centre = off7+m._l/2;
        //			int nb = Mathf.FloorToInt(len/bladeSize);
        //
        //			if((len-(nb*bladeSize))>(bladeSize/2))
        //				nb++;
            int nb = Mathf.FloorToInt(len/bladeSize);
            if((len-(nb*bladeSize))>(bladeSize/4))
                nb++;
            float alpha = 1;
            if((nb*bladeSize)>len)
            {
                alpha = 1-(((float)(nb*bladeSize)-len)/((float)len));
            }
            else
            {
                alpha = 1-(((float)(nb*bladeSize)-len)/((float)len));
            }

            int startZ = -m._l/2+bd._footSize;//(-(nb*bladeSize)/2)+10;

            for(int i=0;i<nb;i++)
            {
                GameObject tmp = AddPartAt(new Vector3(0,h,centre+startZ+i*bladeSize),new Vector3(1000*alpha,1000,m._w-(2*bd._subFrameW)),_blades,index*100+i,basePrimitive,90);
                if(_prevBlade == null)
                    _prevBlade = tmp;
                else
                {
                    tmp.GetComponent<AnimateBlade>().alignTo = _prevBlade.transform.FindChild("1").transform;
                    _prevBlade = tmp;
                }
            }
            _prevBlade = null;
        }
        UpdateBladesAnimation();
    }