예제 #1
0
        public void SetEditMode(WaterfallController ctrl, ModuleWaterfallFX mod)
        {
            showWindow        = true;
            control           = ctrl;
            fxMod             = mod;
            newControllerName = ctrl.name;
            controllerFlag    = controllerTypes.ToList().IndexOf(ctrl.linkedTo);
            windowMode        = ControllerPopupMode.Modify;
            WindowPosition    = new Rect(Screen.width / 2 - 100, Screen.height / 2f - 50, 400, 100);
            eventCurve        = new FloatCurve();
            try
            {
                RandomnessController r = (RandomnessController)control;
                if (r.noiseType == "random")
                {
                    randomStrings[0] = r.range.x.ToString();
                    randomStrings[1] = r.range.y.ToString();
                }
                if (r.noiseType == "perlin")
                {
                    randomStrings[0] = r.seed.ToString();
                    randomStrings[1] = r.scale.ToString();
                    randomStrings[2] = r.speed.ToString();
                    randomStrings[3] = r.minimum.ToString();
                }
                EngineEventController e = (EngineEventController)control;
                ThrottleController    t = (ThrottleController)control;

                throttleStrings[0] = t.responseRateUp.ToString();
                throttleStrings[1] = t.responseRateDown.ToString();

                eventCurve = e.eventCurve;
            }
            catch (Exception)
            { }
            GenerateCurveThumbs();
        }
        WaterfallController CreateNewController()
        {
            if (controllerTypes[controllerFlag] == "atmosphere_density")
            {
                AtmosphereDensityController newCtrl = new AtmosphereDensityController();
                newCtrl.name     = newControllerName;
                newCtrl.linkedTo = controllerTypes[controllerFlag];
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "custom")
            {
                CustomController newCtrl = new CustomController();
                newCtrl.name     = newControllerName;
                newCtrl.linkedTo = controllerTypes[controllerFlag];
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "engineEvent")
            {
                EngineEventController newCtrl = new EngineEventController();
                newCtrl.name          = newControllerName;
                newCtrl.linkedTo      = controllerTypes[controllerFlag];
                newCtrl.eventName     = eventTypes[eventFlag];
                newCtrl.eventCurve    = eventCurve;
                newCtrl.eventDuration = eventDuration;
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "gimbal")
            {
                GimbalController newCtrl = new GimbalController();
                newCtrl.name     = newControllerName;
                newCtrl.axis     = axisTypes[axisFlag];
                newCtrl.linkedTo = controllerTypes[controllerFlag];
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "light")
            {
                LightController newCtrl = new LightController();
                newCtrl.name     = newControllerName;
                newCtrl.linkedTo = controllerTypes[controllerFlag];
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "mach")
            {
                MachController newCtrl = new MachController();
                newCtrl.name     = newControllerName;
                newCtrl.linkedTo = controllerTypes[controllerFlag];
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "random")
            {
                RandomnessController newCtrl = new RandomnessController();
                newCtrl.name      = newControllerName;
                newCtrl.range     = randomRange;
                newCtrl.scale     = perlinScale;
                newCtrl.minimum   = perlinMin;
                newCtrl.seed      = perlinSeed;
                newCtrl.speed     = perlinSpeed;
                newCtrl.noiseType = randTypes[randFlag];
                newCtrl.linkedTo  = controllerTypes[controllerFlag];
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "rcs")
            {
                RCSController newCtrl = new RCSController();
                newCtrl.name             = newControllerName;
                newCtrl.linkedTo         = controllerTypes[controllerFlag];
                newCtrl.responseRateUp   = rampRateUp;
                newCtrl.responseRateDown = rampRateDown;
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "throttle")
            {
                ThrottleController newCtrl = new ThrottleController();
                newCtrl.name     = newControllerName;
                newCtrl.linkedTo = controllerTypes[controllerFlag];

                newCtrl.responseRateUp   = rampRateUp;
                newCtrl.responseRateDown = rampRateDown;
                return(newCtrl);
            }
            else if (controllerTypes[controllerFlag] == "thrust")
            {
                ThrustController newCtrl = new ThrustController();
                newCtrl.name     = newControllerName;
                newCtrl.linkedTo = controllerTypes[controllerFlag];
                return(newCtrl);
            }
            else
            {
                return(null);
            }
        }