/// <summary> /// Registers a new KeyInput Listener /// </summary> /// <param name="keyInput">The new KeyInput</param> public void RegisterKeyInput(IKeyInput keyInput) { if (!handlingKeyInputs.Contains(keyInput)) { handlingKeyInputs.Add(keyInput); } }
public JoystickControl() { if (init.Instance.Result < 0) { devices = null; } else { devices = new IKeyInput[SDL.SDL_NumJoysticks()]; } }
/// <summary> /// 前回のupdateのときに押されていなくて、今回のupdateでも押されていない。 /// </summary> /// <remarks> /// ひとつのdeviceでもFreeであればtrue /// </remarks> /// <returns></returns> public bool IsFree(int nKey) { foreach (KeyInfo k in keylist[nKey]) { IKeyInput kb = aDevice[k.deviceNo_]; if (kb.IsFree(k.keyNo_)) { return(true); } } return(false); }
private void EventKeyInput_KeyInput(IKeyInput sender, Keys key) { Player.Move(key); }
/// <summary> /// /// </summary> /// <param name="device"></param> public void RemoveDevice(IKeyInput device) { /// デバイスの削除 aDevice.RemoveAll(delegate(IKeyInput b) { return(b == device); }); }
/// <summary> /// キーデバイスの登録。 /// </summary> /// <param name="device"></param> /// <remarks> /// キーデバイスとは、KeyInputBaseの派生クラスのインスタンス。 /// 具体的にはKeyInput,JoyStick,MidiInputのインスタンスが /// 挙げられる。入力したいキーデバイスをまず登録する。 /// そしてInputを呼び出すことによって、それらのGetStateが呼び出される。 /// </remarks> public void AddDevice(IKeyInput device) { /// デバイスの登録 aDevice.Add(device); }
public KeyBoardInputControl(KeyBoardSettings settings, IKeyInput input) { this.input = input; controlKeys = settings.ControlTools; }
/// <summary> /// attachしたいJoyStickのナンバーを指定してやる。 /// </summary> /// <param name="nDeviceNo">0~countJoyStick-1までの数</param> /// <remarks> /// 不正な値を渡した場合は、NullDeviceが生成される /// (エラーにはならない) /// </remarks> public JoyStick(int nDeviceNo) { input = control.Instance.getDevice(nDeviceNo); }
private void Setup(IKeyInput InputEvents) { Model = GetComponent <CubismModel>(); CollectParameters(); SetupTransformss(); var Blink = new ActionBlink(Parameters["ParamEyeLOpen"], Parameters["ParamEyeROpen"]); var Breath = new ActionBreath(Parameters["ParamBreath"]); var LipSync = new ActionLipSync(gameObject.AddComponent <AudioSource>(), Parameters["ParamMouthOpenY"]); var TieParams = new ParameterList(); for (int i = 1; i <= 7; i++) { string Name = string.Format("Param_Angle_Rotation_{0}_D_BODY_06", i); TieParams.Add(Parameters[Name]); } var Ties = new ActionPhysics(TieParams, 5.0f, 0.3f); var LeftHairParams = new ParameterList(); var RightHairParams = new ParameterList(); for (var i = 1; i <= 9; i++) { LeftHairParams.Add(Parameters[string.Format("Param_Angle_Rotation_{0}_D_HAIR_BACK_00", i)]); RightHairParams.Add(Parameters[string.Format("Param_Angle_Rotation_{0}_D_HAIR_BACK_10", i)]); } var LeftHair = new ActionPhysics(LeftHairParams, 7.0f, 0.2f); var RightHair = new ActionPhysics(RightHairParams, 7.0f, 0.2f); var FrontHairParams = new ParameterList(); FrontHairParams.Add(Parameters["ParamHairFront"]); FrontHairParams.Add(Parameters["ParamHairFront2"]); var FrontHair = new ActionPhysics(FrontHairParams, 0.3f, 0.1f); var BackHairParams = new ParameterList(); BackHairParams.Add(Parameters["ParamHairBack"]); BackHairParams.Add(Parameters["ParamHairBackL8"]); BackHairParams.Add(Parameters["ParamHairBackR6"]); var BackHair = new ActionPhysics(BackHairParams, 0.3f, 0.1f); var Wink = new ActionWink(Parameters["ParamEyeLOpen"]); Wink.OnComplete .Subscribe((_) => Blink.IsActive = true) .AddTo(gameObject); InputEvents.Wink .Subscribe((_) => { Blink.IsActive = false; Wink.IsActive = true; }) .AddTo(gameObject); List <Transform> Transes = new List <Transform>(); foreach (var Tr in Transforms.Values) { Transes.Add(Tr); } var Getdown = new ActionPromise(Transes); InputEvents.Promise .Subscribe((_) => Getdown.IsActive = !Getdown.IsActive) .AddTo(gameObject); List <CubismParameter> EyesParams = new List <CubismParameter>(); EyesParams.Add(Parameters["ParamEyeLOpen"]); EyesParams.Add(Parameters["ParamEyeROpen"]); List <CubismParameter> PositiveParams = new List <CubismParameter>(); PositiveParams.Add(Parameters["ParamEyeLSmile"]); PositiveParams.Add(Parameters["ParamEyeRSmile"]); PositiveParams.Add(Parameters["ParamMouthOpenY"]); PositiveParams.Add(Parameters["ParamMouthForm"]); PositiveParams.Add(Parameters["ParamEyeLSmile"]); List <CubismParameter> NegativeParams = new List <CubismParameter>(); NegativeParams.Add(Parameters["ParamBrowLY"]); NegativeParams.Add(Parameters["ParamBrowRY"]); var Smile = new ActionSmile(Parameters["ParamAngleZ"], Parameters["ParamBodyAngleZ"], EyesParams, PositiveParams, NegativeParams); InputEvents.Smile .Subscribe((_) => { Smile.IsActive = true; Blink.IsActive = false; }) .AddTo(gameObject); Smile.OnComplete .Subscribe((_) => Blink.IsActive = true) .AddTo(gameObject); var OddEye = new ActionOddEye(Transforms["D_EYE_BALL_01"].GetComponent <MeshRenderer>().material); InputEvents.OddEye .Subscribe((_) => OddEye.Toggle()) .AddTo(gameObject); AddAction(Blink); AddAction(Breath); AddAction(LipSync); AddAction(Ties); AddAction(LeftHair); AddAction(RightHair); AddAction(FrontHair); AddAction(BackHair); AddAction(Wink); AddAction(Getdown); AddAction(Smile); AddAction(OddEye); }
/// <summary> /// /// </summary> /// <param name="device"></param> public void RemoveDevice(IKeyInput device) { /// デバイスの削除 aDevice.RemoveAll(delegate(IKeyInput b) { return b == device; }); }
public void RegisterKeyInput(IKeyInput target) { keyInput = target; }