public IController updateController(IControllerValue c) { this.main = ((EditControllerValue)c).main; this.UIview = ((EditControllerValue)c).view; this.entity = ((EditControllerValue)c).entity; return(this); }
public GameControllerValue(MainController _main, IView _view, PipeControllerValue _pControllerValue, bool _aiActive, int _scoreIncrement, Weights _weights) { this.main = _main; this.view = _view; this.pControllerValues = _pControllerValue; this.aiActive = _aiActive; this.scoreIncrement = _scoreIncrement; this.weights = _weights; }
/// <summary> /// Main constructor. Should not be used directly, rather a controller should be created using the /// ControllerManager so it can keep track of them. /// </summary> /// <param name="source"></param> /// <param name="destination"></param> /// <param name="function"></param> internal Controller(IControllerValue <T> source, IControllerValue <T> destination, IControllerFunction <T> function) { this.source = source; this.destination = destination; this.function = function; // enabled by default, of course isEnabled = true; }
/// <summary> /// Factory method for creating an instance of a controller based on the input provided. /// </summary> /// <param name="source">Controller value to use as the source.</param> /// <param name="destination">Controller value to use as the destination.</param> /// <param name="function">Controller funcion that will use the source value to set the destination.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller <float> CreateController(IControllerValue <float> source, IControllerValue <float> destination, IControllerFunction <float> function) { // create a new controller object Controller <float> controller = new Controller <float>(source, destination, function); // add the new controller to our list controllers.Add(controller); return(controller); }
/// <summary> /// Factory method for creating an instance of a controller based on the input provided. /// </summary> /// <param name="source">Controller value to use as the source.</param> /// <param name="destination">Controller value to use as the destination.</param> /// <param name="function">Controller funcion that will use the source value to set the destination.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller <Real> CreateController(IControllerValue <Real> source, IControllerValue <Real> destination, IControllerFunction <Real> function) { // create a new controller object var controller = new Controller <Real>(source, destination, function); // add the new controller to our list this.controllers.Add(controller); return(controller); }
public IController updateController(IControllerValue c) { pManager = (PipeController)gameObject.GetComponent <PipeController>().updateController(((GameControllerValue)c).pControllerValues); bgManager = (BackgroundController)gameObject.GetComponent <BackgroundController>(); this.main = ((GameControllerValue)c).main; this.UIview = ((GameControllerValue)c).view; this.weights = ((GameControllerValue)c).weights; this.runAi = ((GameControllerValue)c).aiActive; this.scoreIncrement = ((GameControllerValue)c).scoreIncrement; return(this); }
public RibbonTrail(string name, int maxElements, int numberOfChains, bool useTextureCoords, bool useColors, bool dynamic) : base(name, maxElements, 0, useTextureCoords, useColors, dynamic) { this.fadeController = null; this.timeControllerValue = new TimeControllerValue(this); TrailLength = 100; NumberOfChains = numberOfChains; // use V as varying texture coord, so we can use 1D textures to 'smear' TextureCoordDirection = TexCoordDirection.V; }
/// <summary> /// Creates a basic time-based texture coordinate modifier designed for creating rotating textures. /// </summary> /// <remarks> /// This simple method allows you to easily create constant-speed scrolling textures. If you want more /// control, look up the ControllerManager.CreateTextureWaveTransformer for more complex wave-based /// scrollers / stretchers / rotaters. /// </remarks> /// <param name="layer">The texture unit to animate.</param> /// <param name="speedU">Horizontal speed, in wraps per second.</param> /// <param name="speedV">Vertical speed, in wraps per second.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller <float> CreateTextureScroller(TextureUnitState layer, float speedU, float speedV) { IControllerValue <float> val = null; IControllerFunction <float> func = null; Controller <float> controller = null; // if both u and v speeds are the same, we can use a single controller for it if (speedU != 0 && (speedU == speedV)) { // create the value and function val = new TexCoordModifierControllerValue(layer, true, true); func = new MultipyControllerFunction(-speedU, true); // create the controller (uses FrameTime for source by default) controller = CreateController(val, func); } else { // create seperate for U if (speedU != 0) { // create the value and function val = new TexCoordModifierControllerValue(layer, true, false); func = new MultipyControllerFunction(-speedU, true); // create the controller (uses FrameTime for source by default) controller = CreateController(val, func); } // create seperate for V if (speedV != 0) { // create the value and function val = new TexCoordModifierControllerValue(layer, false, true); func = new MultipyControllerFunction(-speedV, true); // create the controller (uses FrameTime for source by default) controller = CreateController(val, func); } } // TODO: Revisit, since we can't return 2 controllers in the case of non equal U and V speeds return(controller); }
/// <summary> /// Creates a basic time-based texture v coordinate modifier designed for creating scrolling textures. /// </summary> /// <remarks> /// This simple method allows you to easily create constant-speed scrolling textures. If you want more /// control, look up the <see cref="CreateTextureWaveTransformer"/> for more complex wave-based /// scrollers / stretchers / rotaters. /// </remarks> /// <param name="layer">The texture unit to animate.</param> /// <param name="speed">speed, in wraps per second.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller <Real> CreateTextureVScroller(TextureUnitState layer, Real speed) { IControllerValue <Real> val = null; IControllerFunction <Real> func = null; Controller <Real> controller = null; // if both u and v speeds are the same, we can use a single controller for it if (speed != 0) { // create the value and function val = new TexCoordModifierControllerValue(layer, false, true); func = new MultipyControllerFunction(-speed, true); // create the controller (uses FrameTime for source by default) controller = CreateController(val, func); } return(controller); }
/// <summary> /// Creates a basic time-based texture u coordinate modifier designed for creating scrolling textures. /// </summary> /// <remarks> /// This simple method allows you to easily create constant-speed scrolling textures. If you want more /// control, look up the <see cref="CreateTextureWaveTransformer"/> for more complex wave-based /// scrollers / stretchers / rotaters. /// </remarks> /// <param name="layer">The texture unit to animate.</param> /// <param name="speed">speed, in wraps per second.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller <Real> CreateTextureUScroller(TextureUnitState layer, Real speed) { IControllerValue <Real> val = null; IControllerFunction <Real> func = null; Controller <Real> controller = null; // Don't create a controller if the speed is zero if (speed != 0) { // create the value and function val = new TexCoordModifierControllerValue(layer, true); func = new MultipyControllerFunction(-speed, true); // create the controller (uses FrameTime for source by default) controller = CreateController(val, func); } return(controller); }
/// <summary> /// Creates a very flexible time-based texture transformation which can alter the scale, position or /// rotation of a texture based on a wave function. /// </summary> /// <param name="layer">The texture unit to effect.</param> /// <param name="type">The type of transform, either translate (scroll), scale (stretch) or rotate (spin).</param> /// <param name="waveType">The shape of the wave, see WaveformType enum for details.</param> /// <param name="baseVal">The base value of the output.</param> /// <param name="frequency">The speed of the wave in cycles per second.</param> /// <param name="phase">The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.</param> /// <param name="amplitude">Scales the output so that instead of lying within 0..1 it lies within 0..(1 * amplitude) for exaggerated effects</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller <Real> CreateTextureWaveTransformer(TextureUnitState layer, TextureTransform type, WaveformType waveType, Real baseVal, Real frequency, Real phase, Real amplitude) { IControllerValue <Real> val = null; IControllerFunction <Real> function = null; // determine which type of controller value this layer needs switch (type) { case TextureTransform.TranslateU: val = new TexCoordModifierControllerValue(layer, true, false); break; case TextureTransform.TranslateV: val = new TexCoordModifierControllerValue(layer, false, true); break; case TextureTransform.ScaleU: val = new TexCoordModifierControllerValue(layer, false, false, true, false, false); break; case TextureTransform.ScaleV: val = new TexCoordModifierControllerValue(layer, false, false, false, true, false); break; case TextureTransform.Rotate: val = new TexCoordModifierControllerValue(layer, false, false, false, false, true); break; } // switch // create a new waveform controller function function = new WaveformControllerFunction(waveType, baseVal, frequency, phase, amplitude, true); // finally, create the controller using frame time as the source value return(CreateController(this.frameTimeController, val, function)); }
public Controller <Real> CreateFrameTimePassthroughController(IControllerValue <Real> dest) { return(CreateController(this.frameTimeController, dest, this.passthroughFunction)); }
public IController updateController(IControllerValue c) { throw new System.NotImplementedException(); }
/// <summary> /// Overloaded method. Creates a new controller, using a reference to a FrameTimeControllerValue as /// the source. /// </summary> /// <param name="destination">Controller value to use as the destination.</param> /// <param name="function">Controller funcion that will use the source value to set the destination.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller <Real> CreateController(IControllerValue <Real> destination, IControllerFunction <Real> function) { // call the overloaded method passing in our precreated frame time controller value as the source return(CreateController(this.frameTimeController, destination, function)); }
public Controller<Real> CreateFrameTimePassthroughController( IControllerValue<Real> dest ) { return CreateController( this.frameTimeController, dest, this.passthroughFunction ); }
public Controller<float> CreateFrameTimePassthroughController( IControllerValue<float> dest ) { return CreateController( frameTimeController, dest, passthroughFunction ); }
public IController updateController(IControllerValue c) { this.main = ((MenuControllerValue)c).main; this.UIview = ((MenuControllerValue)c).view; return(this); }
protected override void CreateScene() { // set some ambient light scene.AmbientLight = new ColorEx(1, 0.1f, 0.1f, 0.1f); // set a basic skybox scene.SetSkyBox(true, "Skybox/Space", 5000.0f); // create the ogre head Entity ogre = scene.CreateEntity("OgreHead", "ogrehead.mesh"); // attach the ogre to the scene scene.RootSceneNode.AttachObject(ogre); // create nodes for the billboard sets redYellowLightsNode = scene.RootSceneNode.CreateChildSceneNode(); greenBlueLightsNode = scene.RootSceneNode.CreateChildSceneNode(); // create a billboard set for creating billboards redYellowLights = scene.CreateBillboardSet("RedYellowLights", 20); redYellowLights.MaterialName = "Particles/Flare"; redYellowLightsNode.AttachObject(redYellowLights); greenBlueLights = scene.CreateBillboardSet("GreenBlueLights", 20); greenBlueLights.MaterialName = "Particles/Flare"; greenBlueLightsNode.AttachObject(greenBlueLights); // red light billboard in off set Vector3 redLightPos = new Vector3(78, -8, -70); redLightBoard = redYellowLights.CreateBillboard(redLightPos, ColorEx.Black); // yellow light billboard in off set Vector3 yellowLightPos = new Vector3(-4.5f, 30, -80); yellowLightBoard = redYellowLights.CreateBillboard(yellowLightPos, ColorEx.Black); // blue light billboard in off set Vector3 blueLightPos = new Vector3(-90, -8, -70); blueLightBoard = greenBlueLights.CreateBillboard(blueLightPos, ColorEx.Black); // green light billboard in off set Vector3 greenLightPos = new Vector3(50, 70, 80); greenLightBoard = greenBlueLights.CreateBillboard(greenLightPos, ColorEx.Black); // red light in off state redLight = scene.CreateLight("RedLight"); redLight.Position = redLightPos; redLight.Type = LightType.Point; redLight.Diffuse = ColorEx.Black; redYellowLightsNode.AttachObject(redLight); // yellow light in off state yellowLight = scene.CreateLight("YellowLight"); yellowLight.Type = LightType.Point; yellowLight.Position = yellowLightPos; yellowLight.Diffuse = ColorEx.Black; redYellowLightsNode.AttachObject(yellowLight); // green light in off state greenLight = scene.CreateLight("GreenLight"); greenLight.Type = LightType.Point; greenLight.Position = greenLightPos; greenLight.Diffuse = ColorEx.Black; greenBlueLightsNode.AttachObject(greenLight); // blue light in off state blueLight = scene.CreateLight("BlueLight"); blueLight.Type = LightType.Point; blueLight.Position = blueLightPos; blueLight.Diffuse = ColorEx.Black; greenBlueLightsNode.AttachObject(blueLight); // create controller function redLightFlasher = new LightFlasherControllerValue(redLight, redLightBoard, ColorEx.Red); yellowLightFlasher = new LightFlasherControllerValue(yellowLight, yellowLightBoard, ColorEx.Yellow); greenLightFlasher = new LightFlasherControllerValue(greenLight, greenLightBoard, ColorEx.Green); blueLightFlasher = new LightFlasherControllerValue(blueLight, blueLightBoard, ColorEx.Blue); // set up the controller value and function for flashing redLightFunc = new WaveformControllerFunction(WaveformType.Sine, 0, 0.5f, 0, 1); yellowLightFunc = new WaveformControllerFunction(WaveformType.Triangle, 0, 0.25f, 0, 1); greenLightFunc = new WaveformControllerFunction(WaveformType.Sine, 0, 0.25f, 0.5f, 1); blueLightFunc = new WaveformControllerFunction(WaveformType.Sine, 0, 0.75f, 0.5f, 1); // set up the controllers ControllerManager.Instance.CreateController(redLightFlasher, redLightFunc); ControllerManager.Instance.CreateController(yellowLightFlasher, yellowLightFunc); ControllerManager.Instance.CreateController(greenLightFlasher, greenLightFunc); ControllerManager.Instance.CreateController(blueLightFlasher, blueLightFunc); }
public Controller <float> CreateFrameTimePassthroughController(IControllerValue <float> dest) { return(CreateController(frameTimeController, dest, passthroughFunction)); }
public IController updateController(IControllerValue c) { this.colYMin = ((PipeControllerValue)c).colYMin; this.colYMax = ((PipeControllerValue)c).colYMax; return(this); }
public IController updateController(IControllerValue c) { this.aiActive = ((BirdControllerValue)c).aiActive; this.weights = ((BirdControllerValue)c).weights; return(this); }
public void sceneLoaded() { IView view; InputHandler inputHandler = scripts.GetComponent <InputHandler>(); uIHandler = scripts.GetComponent <UIHandler>(); inputHandler.main = this; switch (loadIndex) { case 0: // MainMenu loaded viewController = null; break; case 1: // MainMenu_Custom loaded view = scripts.GetComponent <UICustomMenuView>(); // get view from _SCRIPTS_ GameObject viewController = (MenuController)scripts.GetComponent <MenuController>().updateController( factory.getMenuValues(this, view) ); break; case 2: // GameScene Normalplay loaded view = scripts.GetComponent <UIGameView>(); // get view from _SCRIPTS_ GameObject IControllerValue pVal = new PipeControllerValue(-2f, 2f); // FACTORY viewController = (GameController)scripts.GetComponent <GameController>().updateController( factory.getGameValues(this, view, (PipeControllerValue)pVal, false, 1) ); break; case 3: // GameScene AIplay loaded IControllerValue pVal2 = null; Weights w1 = null; int scorePoint = 0; if (viewData.ContainsKey("difficulty")) { Difficulties temp = (Difficulties)viewData["difficulty"]; pVal2 = new PipeControllerValue(temp.yMin, temp.yMax); scorePoint = temp.scorePoint; } else { Debug.LogError("Difficulties not set."); } if (viewData.ContainsKey("weights")) { w1 = (Weights)viewData["weights"]; } view = scripts.GetComponent <UIGameView>(); // get view from _SCRIPTS_ GameObject viewController = (GameController)scripts.GetComponent <GameController>().updateController( factory.getGameValues(this, view, (PipeControllerValue)pVal2, true, scorePoint, w1) ); break; case 4: // Edit Model loaded Entity e = null; if (viewData.ContainsKey("entity")) { e = (Entity)viewData["entity"]; } else { Debug.LogError("Difficulties not set."); } view = scripts.GetComponent <UIEditView>(); // get view from _SCRIPTS_ GameObject viewController = (EditController)scripts.GetComponent <EditController>().updateController( factory.getEditValues(this, view, e) ); break; default: break; } viewData.Clear(); }
/// <summary> /// Overloaded method. Creates a new controller, using a reference to a FrameTimeControllerValue as /// the source. /// </summary> /// <param name="destination">Controller value to use as the destination.</param> /// <param name="function">Controller funcion that will use the source value to set the destination.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller<Real> CreateController( IControllerValue<Real> destination, IControllerFunction<Real> function ) { // call the overloaded method passing in our precreated frame time controller value as the source return CreateController( this.frameTimeController, destination, function ); }
/// <summary> /// Factory method for creating an instance of a controller based on the input provided. /// </summary> /// <param name="source">Controller value to use as the source.</param> /// <param name="destination">Controller value to use as the destination.</param> /// <param name="function">Controller funcion that will use the source value to set the destination.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller<Real> CreateController( IControllerValue<Real> source, IControllerValue<Real> destination, IControllerFunction<Real> function ) { // create a new controller object var controller = new Controller<Real>( source, destination, function ); // add the new controller to our list this.controllers.Add( controller ); return controller; }
/// <summary> /// Factory method for creating an instance of a controller based on the input provided. /// </summary> /// <param name="source">Controller value to use as the source.</param> /// <param name="destination">Controller value to use as the destination.</param> /// <param name="function">Controller funcion that will use the source value to set the destination.</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller<float> CreateController( IControllerValue<float> source, IControllerValue<float> destination, IControllerFunction<float> function ) { // create a new controller object Controller<float> controller = new Controller<float>( source, destination, function ); // add the new controller to our list controllers.Add( controller ); return controller; }