public void OnImportsSatisfied() { PinDictionary = new PinDictionary(FIOFactory); FInput = new GenericInput(FPluginHost, new InputAttribute("Input")); FInput.Pin.Order = 0; FType.Changed += OnSavedTypeChanged; }
public void OnImportsSatisfied() { var attr = new InputAttribute("Input"); attr.Order = 0; FInput = new GenericInput(FPluginHost, attr); }
public bool getButtonUp(Button inputButton) { //se è un bottone ritorna il valore dell'input standard, se è un asse, controlla i valori del frame attuale e di quello precedente //anche in base all'asse negativo o positivo GenericInput actualInput = getUsedButton(inputButton); if (actualInput.button != Button.Default) { return(Input.GetButtonUp(actualInput.button.ToString())); } else if (actualInput.axis != Axis.Default) { if (actualInput.axisDirection == AxisDirection.Positive || actualInput.axisDirection == AxisDirection.Default) { if (actualInput.axisValue < 0.5f && actualInput.axisValueOld >= 0.5f) { return(true); } } else if (actualInput.axisDirection == AxisDirection.Negative) { if (actualInput.axisValue > -0.5f && actualInput.axisValueOld <= -0.5f) { return(true); } } } return(false); }
public bool getButton(Button inputButton) { //se è un bottone ritorna il valore dell'input standard, se è un asse, controlla i valori del frame attuale GenericInput actualInput = getUsedButton(inputButton); if (actualInput.button != Button.Default) { return(Input.GetButton(actualInput.button.ToString())); } else if (actualInput.axis != Axis.Default) { if (actualInput.axisDirection == AxisDirection.Positive || actualInput.axisDirection == AxisDirection.Default) { if (actualInput.axisValue > 0.5f) { return(true); } } else if (actualInput.axisDirection == AxisDirection.Negative) { if (actualInput.axisValue < -0.5f) { return(true); } } } return(false); }
public void OnImportsSatisfied() { FPinCount.Changed += spread => { if (FPinCount[0] == 0) { return; } var prev = _objs.Take(Math.Min(_objs.Length, FPinCount[0])).ToArray(); _objs = new GenericInput[FPinCount[0]]; _objs.Fill(prev); for (int i = 0; i < _objs.Length; i++) { if (_objs[i] == null) { _objs[i] = new GenericInput(Host, new InputAttribute("Input " + i) { Order = i + 10 }, Hde.MainLoop); } } }; }
public ControllableBehavior(Entity parent, GenericInput input) : base(parent) { _input = input; _ready = false; _onHoldP = _onHoldN = false; }
private void AddDeviceToDeviceList(GenericInput inputDevice) { bool foundReplacement = false; for (int i = 0; i < devices.Count; i++) { if (devices[i].DeviceInstanceId == inputDevice.DeviceInstanceId) { inputDevice.CopyMappingFrom(devices[i]); devices[i] = inputDevice; foundReplacement = true; break; } } if (!foundReplacement) { devices.Add(inputDevice); ComboBoxItem newItem = new ComboBoxItem(); newItem.Content = inputDevice.DeviceName; comboBoxDevices.Items.Add(newItem); } }
protected virtual void Start() { _anim = gameObject.GetComponent <Animator>(); Keys = gameObject.GetComponent <GenericInput>(); Stats = gameObject.GetComponent <GenericStats>(); Movement = gameObject.GetComponent <GenericMovement>(); }
private void ChangeInputDevice() { object comboBoxContent = ((ComboBoxItem)comboBoxDevices.SelectedValue).Content; if (comboBoxContent != null) { RemoveSelectedButNotPresentDevice(); SetMappingEnabledState(true); String selectedDeviceName = comboBoxContent.ToString(); for (int i = 0; i < devices.Count; i++) { if (devices[i].DeviceName == selectedDeviceName) { selectedDevice = devices[i]; } } if (selectedDevice != null) { TakeOverMapping(selectedDevice.Mapping); isSelectedDevicePresent = true; UpdateCurrentDeviceDescription(); } } }
private void ChangeInputDevice() { String comboBoxContent = (String)comboBoxDevices.Items[comboBoxDevices.SelectedIndex]; if (comboBoxDevices.SelectedIndex != 0 && (String)comboBoxDevices.Items[0] == "-- No device selected --") { comboBoxDevices.Items.Remove(0); } if (comboBoxContent != "-- No device selected --" && comboBoxContent != null) { RemoveSelectedButNotPresentDevice(); SetMappingEnabledState(true); String selectedDeviceName = comboBoxContent.ToString(); for (int i = 0; i < devices.Count; i++) { if (devices[i].DeviceName == selectedDeviceName) { selectedDevice = devices[i]; } } if (selectedDevice != null) { TakeOverMapping(selectedDevice.Mapping); isSelectedDevicePresent = true; UpdateCurrentDeviceDescription(); } } }
public float getAxisRaw(Button inputButton) { GenericInput actualInput = getUsedButton(inputButton); if (actualInput.axis != Axis.Default) { if (inputButton == Button.Horizontal) { return(Input.GetAxisRaw("Horizontal")); } if (inputButton == Button.Vertical) { return(Input.GetAxisRaw("Vertical")); } return(Input.GetAxisRaw(actualInput.axis.ToString())); } else if (actualInput.button != Button.Default) { if (Input.GetButton(actualInput.button.ToString())) { return(1.0f); } else { return(0.0f); } } return(0.0f); }
public static InputConfig CreateConfigFor(GenericInput input) { if (input is ButtonBasedInput) return new ButtonBasedInputConfig(); //return new ButtonBasedInputConfig(); throw new Exception("No suitable input config class found"); }
void Awake() { Movement = new MovementInput(PlayerSpecificAxisName("Horizontal"), PlayerSpecificAxisName("Vertical")); Jump = new GenericInput(PlayerSpecificAxisName("Jump")); Action_1 = new GenericInput(PlayerSpecificAxisName("Action_1")); //Left Action Action_2 = new GenericInput(PlayerSpecificAxisName("Action_2")); //Top Action Action_3 = new GenericInput(PlayerSpecificAxisName("Action_3")); //Right Action }
protected override void PreInitialize() { pd = new PinDictionary(FIOFactory); FInput = new GenericInput(FPluginHost, new InputAttribute("Input")); FInput.Pin.Order = 0; FTypeRef = new GenericInput(FPluginHost, new InputAttribute("Type Reference Object")); FTypeRef.Pin.Order = 1; ConfigPinCopy = FType; }
protected override void PreInitialize() { ConfigPinCopy = FCount; var attr = new InputAttribute("Input"); attr.Order = 0; FInput = new GenericInput(FPluginHost, attr); pd = new PinDictionary(FIOFactory); }
protected virtual void Awake() { InputField = gameObject.GetComponent <GenericInput>(); HPbarIcon = Resources.Load("hpbarbig"); HpBar = Instantiate(HPbarIcon, null, true) as GameObject; HpBar.transform.localPosition = HpBarPos; HpBar.GetComponent <HpHud>().Target = gameObject; OnControl = true; }
public object OnSyncWasRequested(GenericInput input) { return(base.ExecuteFunction("OnSyncWasRequested", delegate() { string message = WebHook.ProcessWebHook(this.IFoundation, input.key, "sync", input.type, ""); return this.Http200(message, ""); })); }
/// <summary> /// Creates the Component List. /// </summary> public ComponentList() { _components = new List <Component>(); _input = MultipleInput.GetInstance(); ComponentHeight = null; _timeout = 0; _arrow = GameContent.LoadContent <Texture2D>("Images/arrow"); _selectSfx = GameContent.LoadContent <SoundEffect>("Sfx/select"); }
public static InputConfig CreateConfigFor(GenericInput input) { if (input is WiiMoteInput) return new AxisDitheredInputConfig(((WiiMoteInput)input).AxisMappingNames); else if (input is ButtonBasedInput) return new ButtonBasedInputConfig(); //return new ButtonBasedInputConfig(); else if (input is SpeechInput) return new SpeechBasedInputConfig(); throw new Exception("No suitable input config class found"); }
// Start is called before the first frame update protected virtual void Start() { Keys = gameObject.GetComponent <GenericInput>(); Stats = gameObject.GetComponent <GenericStats>(); Anim = gameObject.GetComponent <GenericAnimator>(); _rb = gameObject.GetComponent <Rigidbody>(); ItemD = gameObject.GetComponentInChildren <GrabDetector>(); GlobalOrientation = GameObject.Find("GlobalOri").transform; Keys.ActivateGrav = true; Stats.Friction = 1; Stats.GravScale = 1; }
private void HandleNewDevice(String deviceId, GenericInput inputDevice) { AddDeviceToDeviceList(inputDevice); if (selectedDevice != null && selectedDevice.DeviceInstanceId == inputDevice.DeviceInstanceId) { inputDevice.CopyMappingFrom(selectedDevice); selectedDevice = inputDevice; isSelectedDevicePresent = true; UpdateCurrentDeviceDescription(); } }
/// <summary> /// Reenumerates all of the available input devices. /// </summary> /// <remarks> /// The constructor calls this method, so you should only call this method if you plugged/unplugged /// any input devices after calling the constructor /// </remarks> public void Reenumerate() { if (!updating) { availableDevices.Clear(); available6DOFDevices.Clear(); #if !XBOX // Add all of the non-6DOF input devices if available MouseInput mouseInput = MouseInput.Instance; if (mouseInput.IsAvailable) { availableDevices.Add(mouseInput.Identifier, mouseInput); } KeyboardInput keyboardInput = KeyboardInput.Instance; if (keyboardInput.IsAvailable) { availableDevices.Add(keyboardInput.Identifier, keyboardInput); } GenericInput genericInput = GenericInput.Instance; if (genericInput.IsAvailable) { available6DOFDevices.Add(genericInput.Identifier, genericInput); } #endif foreach (InputDevice device in additionalDevices.Values) { if (device.IsAvailable) { availableDevices.Add(device.Identifier, device); } } foreach (InputDevice_6DOF device in additional6DOFDevices.Values) { if (device.IsAvailable) { available6DOFDevices.Add(device.Identifier, device); } } } else { enumerateLater = true; } }
public void Awake() { if (genericInput == null) { genericInput = GetComponent <GenericInput>(); if (genericInput == null) { throw new Exception("ComponentNotAdded"); } } genericInput.SetInputField(); genericInput.AddListener(OnType); originalText = genericInput.GetText(); SetEndMethod(); }
public void OnImportsSatisfied() { _input = new GenericInput(FPluginHost, new InputAttribute("Input"), Hde.MainLoop); _pg = new ConfigurableTypePinGroup(FPluginHost, FIOFactory, Hde.MainLoop, "Output", 100); _pg.OnTypeChangeEnd += (sender, args) => { if (_pgready) { return; } _pgready = true; _output = _pg.AddOutput(new OutputAttribute("Output")); }; }
private GenericInput GetDeviceById(String deviceId) { GenericInput input = null; for (int i = 0; i < devices.Count; i++) { if (devices[i].DeviceInstanceId == deviceId) { input = devices[i]; break; } } return(input); }
public static InputConfig CreateConfigFor(GenericInput input) { //if (input is WiiMoteInput) // return new AxisDitheredInputConfig(((WiiMoteInput)input).AxisMappingNames); //else if (input is ButtonBasedInput) { return(new ButtonBasedInputConfig()); } //return new ButtonBasedInputConfig(); //else if (input is SpeechInput) // return new SpeechBasedInputConfig(); throw new Exception("No suitable input config class found"); }
public Player(Level level, Vector2 position, Color color, GenericInput inputMethod, string name) { Sprite = new Sprite("Sprites/mage", new Point(64, 64), 100); Sprite.Origin = new Vector2(32, 32); Position = position + Origin; Name = name; Health = 5; _font = GameContent.LoadContent <SpriteFont>("Fonts/SmallFont"); _nameSize = (Name != null) ? _font.MeasureString(Name) / 2 : Vector2.Zero; _healthSize = _font.MeasureString(Health.ToString()) / 2; _textDiff = Vector2.UnitY * (Size.Y / 2); Color = color; Sprite.Animations.Add(new Animation("walking_down", 2, 0, 8)); Sprite.Animations.Add(new Animation("walking_up", 0, 0, 8)); Sprite.Animations.Add(new Animation("walking_right", 3, 0, 8)); Sprite.Animations.Add(new Animation("walking_left", 1, 0, 8)); Sprite.Animations.Add(new Animation("fireball_down", 6, 0, 6)); Sprite.Animations.Add(new Animation("fireball_up", 4, 0, 6)); Sprite.Animations.Add(new Animation("fireball_right", 7, 0, 6)); Sprite.Animations.Add(new Animation("fireball_left", 5, 0, 6)); Sprite.Animations.Add(new Animation("dying", 8, 0, 5)); Sprite.Animations.Add(new Animation("dead", 8, 5, 5)); _currentDirection = Direction.Down; _level = level; Dead = false; //Player didn't set movement speed if (MovementSpeed < 0.0001f) { MovementSpeed = 0.2f; } _deathSfx = GameContent.LoadContent <SoundEffect>("SFX/Death"); _hitSfx = GameContent.LoadContent <SoundEffect>("SFX/Explosion"); Behaviors.Add(new ControllableBehavior(this, inputMethod)); Sprite.ChangeAnimation(0); }
protected override void PreInitialize() { ConfigPinCopy = FType; FRefType = new GenericInput(FPluginHost, new InputAttribute("Reference Type") { Order = 1 }); Pd = new PinDictionary(FIOFactory); foreach (var pin in FPluginHost.GetPins()) { if (pin.Name != "Descriptive Name") { continue; } pin.SetSlice(0, ""); break; } }
private void RemoveDeviceFromDeviceList(String deviceId) { GenericInput inputDevice = GetDeviceById(deviceId); if (inputDevice != null) { devices.Remove(inputDevice); for (int i = 0; i < comboBoxDevices.Items.Count; i++) { if ((String)(comboBoxDevices.Items[i]) == inputDevice.DeviceName) { comboBoxDevices.Items.RemoveAt(i); break; } } } }
protected virtual void HandleShot(vShooterWeapon weapon, GenericInput weaponInput, bool secundaryShot = false) { if (weapon.chargeWeapon) { if (weapon.ammoCount > 0 && weapon.powerCharge < 1 && weaponInput.GetButton()) { weapon.powerCharge += Time.deltaTime * weapon.chargeSpeed; } else if ((weapon.powerCharge >= 1 && weapon.autoShotOnFinishCharge) || weaponInput.GetButtonUp() || (!weaponInput.GetButton() && isAiming && weapon.powerCharge > 0)) { if (shooterManager.hipfireShot) { aimTimming = 3f; } shooterManager.Shoot(aimPosition, !isAiming, secundaryShot); weapon.powerCharge = 0; } animator.SetFloat("PowerCharger", weapon.powerCharge); } else if (weapon.automaticWeapon ? weaponInput.GetButton() : weaponInput.GetButtonDown()) { if (shooterManager.hipfireShot) { aimTimming = 3f; } shooterManager.Shoot(aimPosition, !isAiming, secundaryShot); } else if (weaponInput.GetButtonDown()) { if (allowAttack == false) { if (shooterManager.hipfireShot) { aimTimming = 1f; } shooterManager.Shoot(aimPosition, !isAiming, secundaryShot); allowAttack = true; } } else { allowAttack = false; } }
public void Start() { //Bool und float input arrays zu einem array verbinden GenericInput[] inputs = new GenericInput[boolInputs.Length + floatInputs.Length]; Array.Copy(boolInputs, inputs, boolInputs.Length); Array.Copy(floatInputs, 0, inputs, boolInputs.Length, floatInputs.Length); //Keybindings mit UnityEvents verbinden, über "Action" als Key foreach (GenericInput genericInput in inputs) { foreach (InputSource.ActionKeybindingPair actionKeybindingPair in InputSource.ActionKeybindingPairs) { if (genericInput.ActionName == actionKeybindingPair.ActionName) { genericInput.Keybinding = actionKeybindingPair.Keybinding; } } } }
private void ObjectSelectionChanged(object sender, SelectionChangedEventArgs e) { if ((e.Source as ComboBox).SelectedIndex == -1) { return; } var basicObject = (e.Source as ComboBox).SelectedItem as BasicObject; List <Packet> packets = basicObject switch { Booster _ => new List <Packet>(), GenericInput _ => new List <Packet>() { new SignOfLifeTimer() }, GenericOutput _ => new List <Packet>() { new SignOfLifeTimer(), new SetOutput() }, IRDetection _ => new List <Packet>(), LevelCrossing _ => new List <Packet>() { new SignOfLifeTimer(), new SetLevelCrossing() }, objects.Objects.Points _ => new List <Packet>() { new SignOfLifeTimer(), new ThrowPoints() }, SemaphoreWing _ => new List <Packet>(), SignalBoard _ => new List <Packet>(), Turntable _ => new List <Packet>(), _ => new List <Packet>(), }; packets.Insert(0, new RequestStatus()); (DataContext as ClientViewModel).Packets.Clear(); (DataContext as ClientViewModel).Packets.AddRange(packets); var packetsList = this.FindControl <ComboBox>("PacketsList"); packetsList.SelectedIndex = 0; }
public NewInputDeviceEventArgs(String deviceId, String deviceName, GenericInput input) : base(deviceId) { this.deviceName = deviceName; this.input = input; }