/// <summary> /// Opens the selected device controller and prepares for sampling /// </summary> public void Open() { Close(); switch (this.Settings.ControllerType) { case ControllerTypes.Serial: Controller = new SerialController(this.Settings.SerialPortName, this.Settings.BaudRate, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One); break; case ControllerTypes.Test: Controller = new TestController("Test Controller", new Test.LaTestDevice()); break; default: throw new NotImplementedException("Unknown controller"); } grabber = new DataGrabber(Controller, this.Settings.SamplingRate, this.Settings.SamplingChannels, this.Settings.SamplingTime, this.Settings.SamplingMode, this.Settings.SamplingCompression); grabber.OnComplete += grabber_Complete; grabber.OnProgress += grabber_Progress; grabber.OnError += grabber_Error; grabber.OnConsoleMessage += grabber_ConsoleMessage; grabber.Open(); }
public void changeMotionModel(GlobalControl.motionModels newMotionModel) { //Destroy current motion model Destroy (control); //Add new motion model switch (newMotionModel){ case GlobalControl.motionModels.DISCRETE: control = gameObject.AddComponent<MoveDiscrete>(); controller = new PController(control); break; case GlobalControl.motionModels.KINEMATIC: control = gameObject.AddComponent<MoveKinematic>(); controller = new PController(control); break; case GlobalControl.motionModels.DYNAMIC: control = gameObject.AddComponent<MoveDynamic>(); controller = new PDController(control); break; case GlobalControl.motionModels.DIFFERENTIAL: control = gameObject.AddComponent<MoveDifferential>(); controller = new PController(control); break; case GlobalControl.motionModels.CAR: control = gameObject.AddComponent<MoveCar>(); controller = new PController(control); break; } motionModel = newMotionModel; }
private void ControllerUpdate() { AbstractController controller = PlatformUtilities.GetController(); if (controller != null) { List <DataPoint> inputs = new List <DataPoint>(); controller.Update(); if (controller.IsActive()) { inputs.AddRange(controller.GetInputs()); } //Collect all touches //Making fingers for all touches if (inputs.Count > 0) { Transform[] fingers = FingerPool.GetFingerCount(inputs.Count); for (int i = 0; i < inputs.Count; i++) { SetFingerToPoint(fingers[i], inputs[i].Postion); } } else { FingerPool.AllToSleep(); } } }
/// <summary> /// Default constructor. /// </summary> private MainController() { InitializeAppProperties(); SaveMySettingsOnExit = true; Startup += ApplicationDidFinishLaunching; StartupNextInstance += StartupNextInstanceHandler; Shutdown += delegate { if (Preferences.instance().getBoolean("rendezvous.enable")) { try { RendezvousFactory.instance().quit(); } catch (SystemException se) { Logger.warn("No Bonjour support available", se); } } Preferences.instance().setProperty("uses", Preferences.instance().getInteger("uses") + 1); // Shutdown thread pools AbstractController.getTimerPool().shutdownNow(); ThreadPool.instance().shutdown(); }; }
public bool DetectNear(out AbstractController controller, AbstractController.Type owner) { AbstractController target; controller = null; bool find = false; foreach (var detect in detects) { bool active = detect.DetectNear(out target, owner); if (active && !find) { controller = target; } else if (active && (target.transform.position - transform.position).magnitude < (controller.transform.position - transform.position).magnitude) { controller = target; } find |= active; } return(find); }
/// <summary> /// Handles the ControllerCloned event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.CloneControllerEventArgs"/> instance containing the event data.</param> public void Interface_ControllerCloned(Object sender, CloneControllerEventArgs e) { Trace.WriteLine("Cloning controller...", "CORE"); try { AbstractController clone = e.Prototype.DeepCopy(); foreach (AbstractEmitter emitter in this.ParticleEffect.Emitters) { foreach (AbstractController controller in emitter.Controllers) { if (Object.ReferenceEquals(controller, e.Prototype)) { emitter.Controllers.Add(clone); e.AddedController = clone; e.Result = CoreOperationResult.OK; return; } } } e.Result = new CoreOperationResult(new Exception("Could not find controller prototype in effect hierarchy.")); } catch (Exception error) { e.Result = new CoreOperationResult(error); } }
/// <summary> /// Handles the ControllerAdded event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewControllerEventArgs"/> instance containing the event data.</param> public void Interface_ControllerAdded(Object sender, NewControllerEventArgs e) { Trace.WriteLine("Adding controller...", "CORE"); using (new TraceIndenter()) { Trace.WriteLine("Using plugin: " + e.Plugin.Name); } try { foreach (AbstractEmitter emitter in this.ParticleEffect.Emitters) { if (Object.ReferenceEquals(emitter, e.ParentEmitter)) { AbstractController controller = e.Plugin.ConstructInstance(); emitter.Controllers.Add(controller); e.AddedController = controller; e.Result = CoreOperationResult.OK; return; } } e.Result = new CoreOperationResult(new Exception("Could not find the specified Emitter.")); } catch (Exception error) { e.Result = new CoreOperationResult(error); } }
public BaseForm getForm(typeForm type, AbstractController controller, string tableName) { BaseForm res = null; switch (type) { case typeForm.ADD: res = new AddForm(controller, tableName); return(res); case typeForm.READ: res = new ReadForm(controller, tableName); return(res); case typeForm.UPDATE: res = new UpdateForm(controller, tableName); return(res); case typeForm.DELETE: res = new DeleteForm(controller, tableName); return(res); default: return(res); } }
// Use this for initialization void Start() { // Add the corresponding motion model switch (motionModel){ case GlobalControl.motionModels.DISCRETE:{ MoveDiscrete control = (MoveDiscrete)gameObject.AddComponent ("MoveDiscrete"); controller = new PController(control); break; } case GlobalControl.motionModels.KINEMATIC:{ MoveKinematic control = (MoveKinematic)gameObject.AddComponent ("MoveKinematic"); controller = new PController(control); break; } case GlobalControl.motionModels.DYNAMIC:{ MoveDynamic control = (MoveDynamic)gameObject.AddComponent ("MoveDynamic"); controller = new PDController(control); break; } case GlobalControl.motionModels.DIFFERENTIAL:{ MoveDifferential control = (MoveDifferential)gameObject.AddComponent ("MoveDifferential"); controller = new PController(control); controller.setKp(0.1f); controller.setKpw(0.1f); controller.setKd (5f); break; } case GlobalControl.motionModels.CAR:{ MoveCar control = (MoveCar)gameObject.AddComponent ("MoveCar"); controller = new PController(control); break; } } }
/// <summary> /// Handles the DropDownItemClicked event of the uxAddControllerMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.ToolStripItemClickedEventArgs"/> instance containing the event data.</param> private void uxAddControllerMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { try { EmitterTreeNode parentNode = this.uxEffectTree.SelectedNode as EmitterTreeNode; IControllerPlugin plugin = e.ClickedItem.Tag as IControllerPlugin; AbstractEmitter parent = parentNode.Emitter; var args = new NewControllerEventArgs(parent, plugin); this.OnControllerAdded(args); if (args.AddedController != null) { AbstractController controller = args.AddedController; ControllerTreeNode node = new ControllerTreeNode(controller); parentNode.Nodes.Add(node); node.EnsureVisible(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public override void TakeDamageFrom(AbstractController enmy, bool bumpRight, float force) { if (anim.GetBool("Dead") == false) { if (rigid != null) { rigid.velocity = Vector2.zero; Vector2 bumpDir = bumpRight ? Vector2.right : Vector2.left; rigid.AddForce(bumpDir * force); } life--; if (life <= 0) { audioSource.PlayOneShot(deathSound); anim.SetBool("Dead", true); enabled = false; wkCtrlr.enabled = false; GameObject empty = new GameObject(); empty.transform.position = transform.position; spriteRenderer.transform.SetParent(empty.transform, true); gameObject.SetActive(false); Destroy(gameObject); } else { audioSource.PlayOneShot(hurtSound); enabled = true; wkCtrlr.enabled = false; } anim.SetTrigger("Hurt"); } }
// Use this for initialization void OnEnable() { // Add the corresponding motion model GlobalMove globalMove = gameObject.AddComponent<GlobalMove> (); motionModel = globalMove.motionModel; switch (motionModel){ case GlobalControl.motionModels.DISCRETE:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.DISCRETE); controller = new PController(control); break; } case GlobalControl.motionModels.KINEMATIC:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.KINEMATIC); controller = new PController(control); break; } case GlobalControl.motionModels.DYNAMIC:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.DYNAMIC); controller = new PDController(control); break; } case GlobalControl.motionModels.DIFFERENTIAL:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.DIFFERENTIAL); controller = new PController(control); break; } case GlobalControl.motionModels.CAR:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.CAR); controller = new PController(control); break; } } }
/// <summary> /// Steppable Awake method. Is called automatically by UnityEngine when the steppable GameObject is instantiated /// </summary> public virtual void Awake() { if (controller == null) { _controller = GameObject.FindObjectOfType <AbstractController>(); } }
public void changeMotionModel(GlobalControl.motionModels newMotionModel) { GlobalMove globalMove = gameObject.GetComponent<GlobalMove> (); switch (newMotionModel){ case GlobalControl.motionModels.DISCRETE:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.DISCRETE); controller = new PController(control); break; } case GlobalControl.motionModels.KINEMATIC:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.KINEMATIC); controller = new PController(control); break; } case GlobalControl.motionModels.DYNAMIC:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.DYNAMIC); controller = new PDController(control); break; } case GlobalControl.motionModels.DIFFERENTIAL:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.DIFFERENTIAL); controller = new PController(control); break; } case GlobalControl.motionModels.CAR:{ MonoBehaviour control = globalMove.changeMotionModel(GlobalControl.motionModels.CAR); controller = new PController(control); break; } } motionModel = newMotionModel; }
public TaskContext ShowWizard(AbstractController controller, out string message) { message = string.Empty; if (_action == Enumerators.Action.None) { message = PluginResources.WizardMessage_NoActionSelected; return(null); } var success = CreateWizardContext(controller, out message); if (!success) { return(null); } _isCancelled = false; _wizardWindow = new WizardWindow(); _wizardWindow.Loaded += WizardWindowLoaded; _wizardWindow.ShowDialog(); if (!_isCancelled && _taskContext.Completed) { if (_action == Enumerators.Action.Import || _action == Enumerators.Action.ImportBackTranslation) { _controllers.ProjectsController.RefreshProjects(); } return(_taskContext); } return(null); }
private void Configure(InputMethod forceMethod) { KeyMap kMap; List <ConsoleController> controllers = new List <ConsoleController>(); for (int i = 0; i < _controllerNames.Length; i++) { kMap = MakeMap(_controllerNames[i]); ConsoleController c = new ConsoleController(kMap, _controllerNames[i], i); controllers.Add(c); _joyList.Add(c); } if (controllers.Count > 0) { GamepadSync.Initialize(controllers); } _joyList.Add(new KeyboardController(_rawKeyMaps["Keyboard"], _joyList.Count)); if (_joyList.Count > 0) { _joy = new CompositeController(_joyList); } else { _joy = new NullController(0); } }
public override void TakeDamageFrom(AbstractController enmy, bool bumpRight, float force) { if (isActiveAndEnabled) { rigid.velocity = Vector2.zero; Vector2 bumpDir = bumpRight ? Vector2.right : Vector2.left; rigid.AddForce(bumpDir * force); Item.Type dropType = Item.Type.NONE; for (int i = (int)Item.Type.copperCoin; i <= (int)Item.Type.goldCoin; ++i) { Item.Type type = (Item.Type)i; if (Has(type)) { dropType = type; } } if (dropType != Item.Type.NONE) { DropAllItemsOfType(dropType); audioSource.PlayOneShot(hurtSound); } else { anim.SetBool("Dead", true); audioSource.PlayOneShot(deathSound); enabled = false; } anim.SetTrigger("Hurt"); } }
// Use this for initialization void OnEnable() { GlobalMove m = gameObject.GetComponent<GlobalMove> (); switch (m.motionModel){ case GlobalControl.motionModels.DISCRETE: control = gameObject.GetComponent <MoveDiscrete>(); controller = new PController(control); break; case GlobalControl.motionModels.KINEMATIC: control = gameObject.GetComponent <MoveKinematic>(); controller = new PController(control); break; case GlobalControl.motionModels.DYNAMIC: control = gameObject.GetComponent <MoveDynamic>(); controller = new PDController(control); break; case GlobalControl.motionModels.DIFFERENTIAL: control = gameObject.GetComponent <MoveDifferential>(); controller = new PController(control); break; case GlobalControl.motionModels.CAR: control = gameObject.GetComponent <MoveCar>(); controller = new PController(control); break; } }
/// <summary> /// Copies the properties of this instance into the specified existing instance. /// </summary> /// <param name="existingInstance">An existing controller instance.</param> protected override AbstractController DeepCopy(AbstractController existingInstance) { var value = (existingInstance as CooldownController) ?? new CooldownController(); value.CooldownPeriod = this.CooldownPeriod; return value; }
// ======================================== // constructor // ======================================== public AbstractMemoContentUIProvider( AbstractController owner, bool supportDetailForm ) : base(supportDetailForm) { _owner = owner; _cutInNewMemo = new Lazy <ToolStripMenuItem>(() => CreateCutInNewMemo()); }
public ReadForm(AbstractController controller, string nameTable) : base(controller, nameTable) { form.AutoSize = true; form.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.title = "Form Read Data"; this.SaveText = "Refresh"; this.CancelText = "Close"; }
/// <summary> /// Copies the properties of this instance into the specified existing instance. /// </summary> /// <param name="existingInstance">An existing controller instance.</param> protected override AbstractController DeepCopy(AbstractController existingInstance) { var value = (existingInstance as TriggerOffsetController) ?? new TriggerOffsetController(); value.TriggerOffset = this.TriggerOffset; return value; }
private void OnEnemyDeath(AbstractController controller) { var entity = _entitiesAlives.First(item => item == controller); entity.Destroy(); _entitiesAlives.Remove(entity); }
/// <summary> /// Copies the properties of this instance into the specified existing instance. /// </summary> /// <param name="existingInstance">An existing controller instance.</param> protected override AbstractController DeepCopy(AbstractController existingInstance) { var value = (existingInstance as FrustumCullController) ?? new FrustumCullController(); value.ViewFrustum = this.ViewFrustum; return value; }
void Awake() { rigidBody = GetComponent <Rigidbody2D>(); controller = GetComponent <AbstractController>(); animator = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); trailRenderer = GetComponent <TrailRenderer>(); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is int) { double toConvert = (int)value; return(AbstractController.mapValues(toConvert, 4300, 5000, 0, 100)); } return(0); }
public HomeForm() { InitializeComponent(); controller = new SQLServerController(cnnString, nameDB); List <string> tablenames; tablenames = controller.getAllTableName(nameDB); this.tableDropdown.Items = tablenames.ToArray(); }
// Clean-up code public virtual void Dispose() { robot.IsNotReserved = true; controller.IsNotReserved = true; robot.Status = RemoteDevice.StatusE.DISCONNECTED; robot.disconnect(); robot = null; controller = null; handlerThread.Abort(); }
protected RobotDriver(RobotModel robot, AbstractController controller) { this.robot = robot; this.controller = controller; this.robot.IsNotReserved = false; this.controller.IsNotReserved = false; handlerThread = new Thread(run); handlerThread.Start(); }
public ControllerTreeNode(AbstractController controller) { if (controller == null) throw new ArgumentNullException("controller"); this.Controller = controller; this.Text = controller.GetType().Name; this.Tag = controller; }
public override void TakeDamageFrom(AbstractController enmy, bool bumpRight, float force) { if (loaded) { magpie.Release(handTransform.position, transform.localScale); audioSource.PlayOneShot(releaseSound); } magpie.Flee(); base.TakeDamageFrom(enmy, bumpRight, force); }
protected void Start() { Transform canvas = GameObject.Find("Canvas").transform; Transform scoreText = canvas.Find("Scores"); _fin = canvas.transform.FindChild("Fin").GetComponent <Text>(); _restartMenu = canvas.transform.FindChild("RestartMenu").gameObject; _pauseScreen = canvas.transform.FindChild("PauseScreen"); _restartYes = canvas.transform.FindChild("RestartMenu/RestartYes").GetComponent <FadeEffect>(); _restartNo = canvas.transform.FindChild("RestartMenu/RestartNo").GetComponent <FadeEffect>(); _controller1 = DadaInput.GetJoystick(0); _camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraFollow>(); _teams = DadaGame.Teams; //********** FOR DEBUG ONLY!! ************** if (_teams == null || _teams.Count == 0) { for (int i = 0; i < (int)testPlayers; i++) { DadaGame.RegisterPlayer(CreateDebugPlayers(i)); } _teams = DadaGame.Teams; } //find all respawn points _spawnPoints = Object.FindObjectsOfType <SpawnPoint>(); //shuffle the order of spawnpoints, so the players will spawn to different places ShuffleSpawnPoints(); //find the scores UI and give them the same color of the player _scoreThing = new List <GameObject>(); for (int i = 0; i < scoreText.childCount; i++) { //there is no team for this score: hide the text if (i >= _teams.Count) { scoreText.GetChild(i).gameObject.SetActive(false); } else { _scoreThing.Add(scoreText.GetChild(i).gameObject); //GameObject frame = scoreText.GetChild(i).FindChild("Frame").gameObject; //frame.GetComponent<Image>().color = _teams[i].TeamColor; scoreText.GetChild(i).GetComponent <UIScore>().ScoresBg.GetComponent <Image>().color = _teams[DadaGame.Players[i].InTeam.Number].TeamColor; } } InitLevel(); }
// Use this for initialization void Start() { control = (MoveKinematic)gameObject.AddComponent ("MoveKinematic"); controller = new PController (control); if (drawLines) { lines = gameObject.AddComponent<LineRenderer> (); lines.SetWidth (0.1f, 0.1f); lines.material = new Material(Shader.Find("Unlit/Texture")); lines.castShadows = false; lines.receiveShadows = false; lines.SetColors (Color.white, Color.white); } }
//assign a controller to this view. Create a persistent instance of the player public void SetController(AbstractController c) { _controller = c; _player = new Player(c); AssemblePlayer(); //Color the screen panel with the player's color Image background = GetComponent <Image>(); Color newColor = _player.InTeam.TeamColor; newColor.a = 0.5f; background.color = newColor; }
public ControllerTreeNode(AbstractController controller) { if (controller == null) { throw new ArgumentNullException("controller"); } this.Controller = controller; this.Text = controller.GetType().Name; this.Tag = controller; }
private void bindDevice() { if (_DeviceControl == null) { _DeviceControl = new InventorController(); } Device_1.IsChecked = true; if (!_DeviceControl.isConstructed) { MessageBox.Show("Nie udało się zainicjalizować kontrolera"); this.Close(); } }
// Allows OverlordBot to listen for a specific word to start listening. Currently not used although the setup has all been done. // This is due to wierd state transition errors that I cannot be bothered to debug. Possible benefit is less calls to Speech endpoint but // not sure if that is good enough or not to keep investigating. //private readonly KeywordRecognitionModel _wakeWord; public SpeechRecognitionListener(BufferedWaveProvider bufferedWaveProvider, ConcurrentQueue <byte[]> responseQueue, RadioInformation radioInfo) { radioInfo.TransmissionQueue = responseQueue; _botType = radioInfo.botType; _frequency = radioInfo.freq; _callsign = radioInfo.callsign; _logClientId = radioInfo.name; switch (radioInfo.botType) { case "ATC": Controller = new AtcController { Callsign = radioInfo.callsign, Voice = radioInfo.voice, Radio = radioInfo }; break; case "AWACS": Controller = new AwacsController { Callsign = radioInfo.callsign, Voice = radioInfo.voice, Radio = radioInfo }; break; default: Controller = new MuteController { Callsign = radioInfo.callsign, Voice = null, Radio = null }; break; } var encoder = OpusEncoder.Create(AudioManager.InputSampleRate, 1, Application.Voip); encoder.ForwardErrorCorrection = false; encoder.FrameByteCount(AudioManager.SegmentFrames); var streamReader = new BufferedWaveProviderStreamReader(bufferedWaveProvider); _audioConfig = AudioConfig.FromStreamInput(streamReader, AudioStreamFormat.GetWaveFormatPCM(16000, 16, 1)); //_wakeWord = KeywordRecognitionModel.FromFile($"Overlord/WakeWords/{callsign}.table"); }
private IEnumerator StartNewRoundEnum() { ClearRound(false); _player = _iRoundBehaviour.SpawnPlayer(); IndexRound = 0; yield return(_iUIBehaviour.ShowRestart()); yield return(_iUIBehaviour.ShowCurrentLvlAnimEnum()); _entitiesAlives = _iRoundBehaviour.SpawnLvl(IndexRound); yield return(null); }
public BaseForm(AbstractController controller, string nameTable) { this.form = new Form(); form.Text = "Demo SEP Framework"; form.Icon = Properties.Resources.icon; this.nameTable = nameTable; this.controllerData = controller; this.save = new Bunifu.Framework.UI.BunifuFlatButton(); this.cancel = new Bunifu.Framework.UI.BunifuFlatButton(); this.save.Click += Save_Click; this.cancel.Click += Cancel_Click; }
public Hit(Mob controller, AbstractController origin, float damage, Abstract last) : base(controller) { _last = last; timer = damage / 10; float y = _controller.rigidbody.velocity.y; _controller.rigidbody.velocity = new Vector3(0, y, 0); Vector3 direction = _controller.transform.position - origin.transform.position; direction.y = 0; direction.Normalize(); _controller.rigidbody.AddForce(direction * damage / 2, ForceMode.Impulse); }
/// <summary> /// Gets the service manager. /// </summary> /// <param name="serviceName">Name of the service.</param> /// <returns></returns> public AbstractController GetServiceManager(string serviceName, string siteURL) { //Initializing Factory objects. switch (serviceName.ToString().ToUpper()) { case REPORT_SERVICE: objServiceManager = new ReportServiceManager(siteURL); break; case REPORTSERVICE: objServiceManager = new ReportServiceManager(siteURL); break; case EVENTSERVICE: objServiceManager = new EventServiceManager(siteURL); break; default: objServiceManager = new ReportServiceManager(siteURL); break; } return objServiceManager; }
/// <summary> /// Gets the service manager. /// </summary> /// <param name="serviceName">Name of the service.</param> /// <returns></returns> public AbstractController GetServiceManager(string serviceName) { //Initializing Factory objects. switch (serviceName.ToString().ToUpper()) { case REPORT_SERVICE: objServiceManager = new ReportServiceManager(); break; case REPORTSERVICE: objServiceManager = new ReportServiceManager(); break; case RESOURCEMANAGER: objServiceManager = new ResourceServiceManager(); break; case MOSSSERVICE: objServiceManager = new MOSSServiceManager(); break; case QUERYSERVICE: objServiceManager = new QueryBuilderManager(); break; case EVENTSERVICE: objServiceManager = new EventServiceManager(); break; default: objServiceManager = new MOSSServiceManager(); break; } return objServiceManager; }
public SimpleDefaultMainAction(AbstractController controller, AsyncController.AsyncDelegate main) : base(controller) { _background = main; }
// Use this for initialization void OnEnable() { switch (motionModel){ case GlobalControl.motionModels.DISCRETE: control = (MoveDiscrete)gameObject.AddComponent (typeof(MoveDiscrete)); controller = new PController(control); break; case GlobalControl.motionModels.KINEMATIC: control = (MoveKinematic)gameObject.AddComponent (typeof(MoveKinematic)); controller = new PController(control); break; case GlobalControl.motionModels.DYNAMIC: control = (MoveDynamic)gameObject.AddComponent (typeof(MoveDynamic)); controller = new PDController(control); break; case GlobalControl.motionModels.DIFFERENTIAL: control = (MoveDifferential)gameObject.AddComponent (typeof(MoveDifferential)); controller = new PController(control); break; case GlobalControl.motionModels.CAR: control = (MoveCar)gameObject.AddComponent (typeof(MoveCar)); controller = new PController(control); break; } if (drawLines) { lines = gameObject.AddComponent<LineRenderer> (); lines.SetWidth (0.1f, 0.1f); lines.material = new Material(Shader.Find("Unlit/Texture")); lines.castShadows = false; lines.receiveShadows = false; lines.SetColors (Color.white, Color.white); } }
// Use this for initialization void Start() { currentView = View.StartTurn; GUILabelHeight = 22f; GUIAreaHeight = Screen.height / 3; GUIAreaWidth = 7 * Screen.width / 12; GUIAreaLeft = 0f; GUIAreaTop = 0f; GUIArea = new Rect(GUIAreaLeft, GUIAreaTop, GUIAreaWidth, GUIAreaHeight); unitInfoAreaHeight = GUILabelHeight * 4.0f; unitInfoAreaWidth = GUIAreaWidth * 0.80f; unitInfoAreaLeft = GUIAreaLeft; unitInfoAreaTop = GUIAreaTop; unitInfoArea = new Rect(unitInfoAreaLeft, unitInfoAreaTop, unitInfoAreaWidth, unitInfoAreaHeight); buttonHeight = 30f; buttonWidth = GUIAreaWidth * 0.20f; buttonTop = GUIAreaTop + GUIAreaHeight - buttonHeight; ground = GameObject.FindWithTag("Ground"); playerController = this.GetComponent<PlayerController>(); turnScheduler = GameObject.FindWithTag("BattleManager").GetComponent<SimpleTurnScheduler>(); }
/// <summary> /// Initializes a new instance of the <see cref="ControllerEventArgs"/> class. /// </summary> /// <param name="modifier">The controller.</param> public ControllerEventArgs(AbstractController controller) : base() { this.Controller = controller; }
/// <summary> /// Copies the properties of this instance into the specified existing instance. /// </summary> /// <param name="existingInstance">An existing controller instance.</param> protected override AbstractController DeepCopy(AbstractController existingInstance) { var value = (existingInstance as TimedReleaseQuantityController) ?? new TimedReleaseQuantityController(); return value; }
/// <summary> /// Initializes a new instance of the <see cref="CloneControllerEventArgs"/> class. /// </summary> /// <param name="prototype">The prototype.</param> public CloneControllerEventArgs(AbstractController prototype) : base() { this.Prototype = prototype; }