Example #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();
    }
Example #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);
        }
    }
Example #3
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);
                }
            }
        }
    }
Example #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)
        {
            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();
    }
Example #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 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();
    }