public static EditorWindow GetWindow(Base_ProceduralWing forWing)
        {
            if (Window != null)
                Window.closeWindow();

            if (!wingWindows.TryGetValue(forWing.ClassID, out Window))
            {
                Window = forWing.CreateWindow();
                wingWindows.Add(forWing.ClassID, Window);
            }

            return Window;
        }
        public void UpgradeModule(Base_ProceduralWing newModule)
        {
            // assign all the variables
            newModule.RootWidth = rootScale.y * modelChordLength;
            newModule.RootThickness = rootScale.z * modelThickness;

            newModule.TipWidth = tipScale.y * modelChordLength;
            newModule.TipThickness = tipScale.z * modelThickness;

            newModule.TipOffset = tipPosition.x - TipSpawnOffset.x;
            newModule.Length = tipPosition.z - TipSpawnOffset.z;

            newModule.fuelSelectedTankSetup = fuelSelectedTankSetup;
        }
Esempio n. 3
0
 public static EditorWindow GetWindow(Base_ProceduralWing forWing)
 {
     if (Window != null)
         Window.closeWindow();
     if (!wingWindows.TryGetValue(forWing.ClassID, out Window))
     {
         Window = forWing.CreateMainWindow();
         Window.wing = forWing;
         forWing.AddMatchingButtons(Window);
         if (forWing.CanBeFueled)
         {
             Window.AddFuelPanel();
         }
         wingWindows.Add(forWing.ClassID, Window);
     }
     Window.wing = forWing;
     return Window;
 }
        public override void inheritShape(Base_ProceduralWing parent)
        {
            base.inheritShape(parent);

            if (TipWidth < tipWidth.min)
                Length *= (RootWidth - tipWidth.min) / (RootWidth - TipWidth);
            else if (TipWidth > tipWidth.max)
                Length *= tipWidth.max / TipWidth;

            if (TipOffset > tipOffset.max)
                Length *= tipOffset.max / TipOffset;
            else if (TipOffset < tipOffset.min)
                Length *= tipOffset.min / TipOffset;

            Length = Utils.Clamp(Length, length.min, length.max);
            TipWidth = Utils.Clamp(TipWidth, tipWidth.min, tipWidth.max);
            TipOffset = Utils.Clamp(TipOffset, tipOffset.min, tipOffset.max);
            TipThickness = Utils.Clamp(RootThickness + Length / parent.Length * (parent.TipThickness - parent.RootThickness), tipThickness.min, tipThickness.max);
        }
        public virtual void inheritEdges(Base_ProceduralWing parent)
        {
            B9_ProceduralWing wing = parent as B9_ProceduralWing;
            if (wing == null)
                return;

            LeadingEdgeType = wing.LeadingEdgeType;
            RootLeadingEdge = wing.TipLeadingEdge;
            TipLeadingEdge = Utils.Clamp(RootLeadingEdge + ((wing.TipLeadingEdge - wing.RootLeadingEdge) / wing.Length) * Length, tipLeadingEdge.min, tipLeadingEdge.max);

            TrailingEdgeType = wing.TrailingEdgeType;
            RootTrailingEdge = wing.TipTrailingEdge;
            TipTrailingEdge = Utils.Clamp(RootTrailingEdge + ((wing.TipTrailingEdge - wing.RootTrailingEdge) / wing.Length) * Length, tipTrailingEdge.min, tipTrailingEdge.max);
        }
        public virtual void inheritColours(Base_ProceduralWing parent)
        {
            B9_ProceduralWing wing = parent as B9_ProceduralWing;
            if (wing == null)
                return;

            SurfTopMat = wing.SurfTopMat;
            SurfTopOpacity = wing.SurfTopOpacity;
            SurfTopHue = wing.SurfTopHue;
            SurfTopSat = wing.SurfTopSat;
            SurfTopBright = wing.SurfTopBright;

            SurfBottomMat = wing.SurfBottomMat;
            SurfBottomOpacity = wing.SurfBottomOpacity;
            SurfBottomHue = wing.SurfBottomHue;
            SurfBottomSat = wing.SurfBottomSat;
            SurfBottomBright = wing.SurfBottomBright;

            SurfTrailMat = wing.SurfTrailMat;
            SurfTrailOpacity = wing.SurfTrailOpacity;
            SurfTrailHue = wing.SurfTrailHue;
            SurfTrailSat = wing.SurfTrailSat;
            SurfTrailBright = wing.SurfTrailBright;

            SurfLeadMat = wing.SurfLeadMat;
            SurfLeadOpacity = wing.SurfLeadOpacity;
            SurfLeadHue = wing.SurfLeadHue;
            SurfLeadSat = wing.SurfLeadSat;
            SurfLeadBright = wing.SurfLeadBright;
        }
        public override void inheritBase(Base_ProceduralWing parent)
        {
            base.inheritBase(parent);

            B9_ProceduralWing wing = parent as B9_ProceduralWing;
            if (wing == null)
                return;
            LeadingEdgeType = wing.LeadingEdgeType;
            RootLeadingEdge = wing.TipLeadingEdge;

            TrailingEdgeType = wing.TrailingEdgeType;
            RootTrailingEdge = wing.TipTrailingEdge;
        }
Esempio n. 8
0
        public void UpgradeModule(Base_ProceduralWing newModule)
        {
            Debug.Log($"Upgrading B9_PWing");
            B9_ProceduralWing newModule_B9 = (B9_ProceduralWing)newModule;
            // assign all the variables
            newModule_B9.Length = sharedBaseLength;
            newModule_B9.TipOffset = sharedBaseOffsetTip;
            newModule_B9.RootWidth = sharedBaseWidthRoot;
            newModule_B9.TipWidth = sharedBaseWidthTip;
            newModule_B9.RootThickness = sharedBaseThicknessRoot;
            newModule_B9.TipThickness = sharedBaseThicknessTip;

            if (!(newModule_B9 is B9_ProceduralControl))
            {
                newModule_B9.LeadingEdgeType = (int)sharedEdgeTypeLeading;
                newModule_B9.RootLeadingEdge = sharedEdgeWidthLeadingRoot;
                newModule_B9.TipLeadingEdge = sharedEdgeWidthLeadingTip;
            }

            newModule_B9.TrailingEdgeType = (int)sharedEdgeTypeTrailing;
            newModule_B9.RootTrailingEdge = sharedEdgeWidthTrailingRoot;
            newModule_B9.RootTrailingEdge = sharedEdgeWidthTrailingTip;

            newModule_B9.SurfTopMat = (int)sharedMaterialST;
            newModule_B9.SurfTopOpacity = sharedColorSTOpacity;
            newModule_B9.SurfTopHue = sharedColorSTHue;
            newModule_B9.SurfTopSat = sharedColorSTSaturation;
            newModule_B9.SurfTopBright = sharedColorSTBrightness;

            newModule_B9.SurfBottomMat = (int)sharedMaterialSB;
            newModule_B9.SurfBottomOpacity = sharedColorSBOpacity;
            newModule_B9.SurfBottomHue = sharedColorSBHue;
            newModule_B9.SurfBottomSat = sharedColorSBSaturation;
            newModule_B9.SurfBottomBright = sharedColorSBBrightness;

            newModule_B9.SurfTrailMat = (int)sharedMaterialET;
            newModule_B9.SurfTrailOpacity = sharedColorETOpacity;
            newModule_B9.SurfTrailHue = sharedColorETHue;
            newModule_B9.SurfTrailSat = sharedColorETSaturation;
            newModule_B9.SurfTrailBright = sharedColorETBrightness;

            newModule_B9.fuelSelectedTankSetup = fuelSelectedTankSetup;

            if (newModule_B9 is B9_ProceduralControl)
            {
                ((B9_ProceduralControl)newModule_B9).RootOffset = sharedBaseOffsetRoot;
            }
            else
            {
                newModule_B9.SurfLeadMat = (int)sharedMaterialEL;
                newModule_B9.SurfLeadOpacity = sharedColorELOpacity;
                newModule_B9.SurfLeadHue = sharedColorELHue;
                newModule_B9.SurfLeadSat = sharedColorELSaturation;
                newModule_B9.SurfLeadBright = sharedColorELBrightness;
            }
        }