コード例 #1
0
        static void Main(string[] args)
        {
            ICompressionMechanism p = new Pump();

            IIndicator GreenLED = new LED("Green");
            IIndicator RedLED   = new LED("Red");
            IIndicator VMotor   = new VibrationMotor();

            var            compressionStockingstocking = new StockingCtrl(new StubCompressionCtrl(p, 5, 2, GreenLED, RedLED, VMotor));
            ConsoleKeyInfo consoleKeyInfo;

            Console.WriteLine("Compression Stocking Control User Interface");
            Console.WriteLine("A:   Compress");
            Console.WriteLine("Z:   Decompress");
            Console.WriteLine("ESC: Terminate application");

            do
            {
                consoleKeyInfo = Console.ReadKey(true); // true = do not echo character
                if (consoleKeyInfo.Key == ConsoleKey.A)
                {
                    compressionStockingstocking.StartBtnPushed();
                }
                if (consoleKeyInfo.Key == ConsoleKey.Z)
                {
                    compressionStockingstocking.StopBtnPushed();
                }
            } while (consoleKeyInfo.Key != ConsoleKey.Escape);
        }
コード例 #2
0
ファイル: PatternTester.cs プロジェクト: Zeludon/FEZ
 public static bool Test(IList<VibrationMotor> input, VibrationMotor[] pattern)
 {
   int count = input.Count;
   bool flag = false;
   int num = 0;
   for (int index = 0; index + num < pattern.Length && index < count; ++index)
   {
     while (pattern[pattern.Length - index - 1 - num] == VibrationMotor.None)
     {
       ++num;
       if (index + num >= pattern.Length)
         break;
     }
     if (input[count - index - 1] == pattern[pattern.Length - index - 1 - num])
     {
       if (index == pattern.Length - 1 - num)
       {
         flag = true;
         input.Clear();
         break;
       }
     }
     else
       break;
   }
   return flag;
 }
コード例 #3
0
    public virtual void Vibrate(VibrationMotor motor, double amount, float duration, EasingType easingType)
    {
        var motorState = new VibrationMotorState(amount, duration, easingType);

        switch (motor)
        {
        case VibrationMotor.LeftLow: leftMotor = motorState; break;

        case VibrationMotor.RightHigh: rightMotor = motorState; break;
        }
    }
コード例 #4
0
ファイル: GamepadState.cs プロジェクト: conankzhang/fez
        public void Vibrate(VibrationMotor motor, double amount, TimeSpan duration, EasingType easingType)
        {
            GamepadState.VibrationMotorState vibrationMotorState = new GamepadState.VibrationMotorState(amount, duration, easingType);
            switch (motor)
            {
            case VibrationMotor.LeftLow:
                this.leftMotor = vibrationMotorState;
                break;

            case VibrationMotor.RightHigh:
                this.rightMotor = vibrationMotorState;
                break;
            }
        }
コード例 #5
0
ファイル: RumblerHost.cs プロジェクト: conankzhang/fez
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Paused || this.GameState.Loading || (this.GameState.InMap || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)))
            {
                return;
            }
            this.SinceChanged += gameTime.ElapsedGameTime;
            if (this.SinceChanged >= this.CurrentDuration)
            {
                ++this.CurrentIndex;
                if (this.CurrentIndex >= this.ArtObject.ActorSettings.VibrationPattern.Length || this.CurrentIndex < 0)
                {
                    this.CurrentIndex = 0;
                }
                this.SinceChanged -= this.CurrentDuration;
                this.CurrentSignal = this.ArtObject.ActorSettings.VibrationPattern.Length != 0 ? this.ArtObject.ActorSettings.VibrationPattern[this.CurrentIndex] : VibrationMotor.None;
            }
            float num = FezMath.Saturate(1f - FezMath.Saturate((FezMath.Abs((this.PlayerManager.Center - this.ArtObject.Position) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint)) - new Vector3(0.5f, 2f, 0.5f)) / 3f).Length());

            if (this.CurrentSignal == VibrationMotor.None)
            {
                this.eForkRumble.VolumeFactor      *= Math.Max((float)(1.0 - Math.Pow(this.SinceChanged.TotalSeconds / this.CurrentDuration.TotalSeconds, 4.0)), 0.75f);
                this.SoundManager.MusicVolumeFactor = (float)(1.0 - (double)num * 0.600000023841858 - (double)this.eForkRumble.VolumeFactor * 0.200000002980232);
            }
            else
            {
                this.eForkRumble.VolumeFactor       = num;
                this.eForkRumble.Pan                = this.CurrentSignal == VibrationMotor.RightHigh ? 1f : -1f;
                this.SoundManager.MusicVolumeFactor = (float)(1.0 - (double)num * 0.800000011920929);
                if ((double)num != 1.0)
                {
                    num *= 0.5f;
                }
                if (this.CurrentSignal == VibrationMotor.LeftLow)
                {
                    num *= 0.5f;
                }
                if ((double)num > 0.0)
                {
                    this.InputManager.ActiveGamepad.Vibrate(this.CurrentSignal, (double)num, this.CurrentDuration - this.SinceChanged, EasingType.None);
                }
                else
                {
                    this.Input.Clear();
                }
            }
        }
    /******************************************************************************************************************************************************************/

    public void SetVibrationMotor()
    {
        myVibrationMotorScript = transform.GetComponent <VibrationMotor>();

        /*****************************
        * Vibration Motor Force Example
        *****************************/
        //convert String to IntPtr
        IntPtr type = ConverterClass.ConvertStringToByteToIntPtr(myVibrationMotorScript.Type);
        //Convert float[3] to intptr
        IntPtr position = ConverterClass.ConvertFloat3ToIntPtr(myVibrationMotorScript.positionEffect);
        //Convert float[3] to intptr
        IntPtr direction = ConverterClass.ConvertFloat3ToIntPtr(myVibrationMotorScript.directionEffect);

        //Set the effect
        PluginImport.SetEffect(type, myVibrationMotorScript.effect_index, myVibrationMotorScript.gain, myVibrationMotorScript.magnitude, myVibrationMotorScript.duration, myVibrationMotorScript.frequency, position, direction);
        PluginImport.StartEffect(myVibrationMotorScript.effect_index);
    }
コード例 #7
0
        private void AddSensors()
        {
            irSensor = new PassiveInfraRedSensor()
            {
                Name = "Motion Sensor", Port = "D2"
            };
            Sensors.Add(irSensor);

            blinky = new Led()
            {
                Name = "Blinky", Port = "D5"
            };
            Sensors.Add(blinky);

            buzzer = new VibrationMotor()
            {
                Name = "Vibration Motor", Port = "D6"
            };
            Sensors.Add(buzzer);
        }
コード例 #8
0
ファイル: GamepadsManager.cs プロジェクト: Collegiennes/pico
 public override void Vibrate(VibrationMotor motor, double amount, float duration, EasingType easingType)
 {
     throw new NotSupportedException();
 }
コード例 #9
0
    /******************************************************************************************************************************************************************/
    public void SetVibrationMotor()
    {
        myVibrationMotorScript = transform.GetComponent<VibrationMotor>();

        /*****************************
        * Vibration Motor Force Example
        *****************************/
        //convert String to IntPtr
        IntPtr type = ConverterClass.ConvertStringToByteToIntPtr(myVibrationMotorScript.Type);
        //Convert float[3] to intptr
        IntPtr position = ConverterClass.ConvertFloat3ToIntPtr(myVibrationMotorScript.positionEffect);
        //Convert float[3] to intptr
        IntPtr direction = ConverterClass.ConvertFloat3ToIntPtr(myVibrationMotorScript.directionEffect);

        //Set the effect
        PluginImport.SetEffect(type,myVibrationMotorScript.effect_index, myVibrationMotorScript.gain, myVibrationMotorScript.magnitude, myVibrationMotorScript.duration, myVibrationMotorScript.frequency, position, direction);
        PluginImport.StartEffect(myVibrationMotorScript.effect_index);
    }
コード例 #10
0
 public void Vibrate(VibrationMotor motor, double amount, TimeSpan duration)
 {
     Vibrate(motor, amount, duration, EasingType.Linear);
 }
コード例 #11
0
 public virtual void Vibrate(VibrationMotor motor, double amount, float duration, EasingType easingType)
 {
     var motorState = new VibrationMotorState(amount, duration, easingType);
     switch (motor)
     {
         case VibrationMotor.LeftLow: leftMotor = motorState; break;
         case VibrationMotor.RightHigh: rightMotor = motorState; break;
     }
 }
コード例 #12
0
 public void Vibrate(VibrationMotor motor, double amount, float duration)
 {
     Vibrate(motor, amount, duration, EasingType.Step);
 }
コード例 #13
0
ファイル: Gamepads.cs プロジェクト: zulis/Cubica
 public void Vibrate(VibrationMotor motor, double amount, TimeSpan duration)
 {
     Vibrate(motor, amount, duration, EasingType.Linear);
 }
コード例 #14
0
 public override void Vibrate(VibrationMotor motor, double amount, float duration, EasingType easingType)
 {
     throw new NotSupportedException();
 }
コード例 #15
0
ファイル: RumblerHost.cs プロジェクト: tanis2000/FEZ
 public override void Update(GameTime gameTime)
 {
   if (this.GameState.Paused || this.GameState.Loading || (this.GameState.InMap || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)))
     return;
   this.SinceChanged += gameTime.ElapsedGameTime;
   if (this.SinceChanged >= this.CurrentDuration)
   {
     ++this.CurrentIndex;
     if (this.CurrentIndex >= this.ArtObject.ActorSettings.VibrationPattern.Length || this.CurrentIndex < 0)
       this.CurrentIndex = 0;
     this.SinceChanged -= this.CurrentDuration;
     this.CurrentSignal = this.ArtObject.ActorSettings.VibrationPattern.Length != 0 ? this.ArtObject.ActorSettings.VibrationPattern[this.CurrentIndex] : VibrationMotor.None;
   }
   float num = FezMath.Saturate(1f - FezMath.Saturate((FezMath.Abs((this.PlayerManager.Center - this.ArtObject.Position) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint)) - new Vector3(0.5f, 2f, 0.5f)) / 3f).Length());
   if (this.CurrentSignal == VibrationMotor.None)
   {
     this.eForkRumble.VolumeFactor *= Math.Max((float) (1.0 - Math.Pow(this.SinceChanged.TotalSeconds / this.CurrentDuration.TotalSeconds, 4.0)), 0.75f);
     this.SoundManager.MusicVolumeFactor = (float) (1.0 - (double) num * 0.600000023841858 - (double) this.eForkRumble.VolumeFactor * 0.200000002980232);
   }
   else
   {
     this.eForkRumble.VolumeFactor = num;
     this.eForkRumble.Pan = this.CurrentSignal == VibrationMotor.RightHigh ? 1f : -1f;
     this.SoundManager.MusicVolumeFactor = (float) (1.0 - (double) num * 0.800000011920929);
     if ((double) num != 1.0)
       num *= 0.5f;
     if (this.CurrentSignal == VibrationMotor.LeftLow)
       num *= 0.5f;
     if ((double) num > 0.0)
       this.InputManager.ActiveGamepad.Vibrate(this.CurrentSignal, (double) num, this.CurrentDuration - this.SinceChanged, EasingType.None);
     else
       this.Input.Clear();
   }
 }
コード例 #16
0
ファイル: GamepadState.cs プロジェクト: tanis2000/FEZ
 public void Vibrate(VibrationMotor motor, double amount, TimeSpan duration, EasingType easingType)
 {
   GamepadState.VibrationMotorState vibrationMotorState = new GamepadState.VibrationMotorState(amount, duration, easingType);
   switch (motor)
   {
     case VibrationMotor.LeftLow:
       this.leftMotor = vibrationMotorState;
       break;
     case VibrationMotor.RightHigh:
       this.rightMotor = vibrationMotorState;
       break;
   }
 }
コード例 #17
0
 public void Vibrate(VibrationMotor motor, double amount, float duration)
 {
     Vibrate(motor, amount, duration, EasingType.Step);
 }