public virtual (GainType, float) ApplyRedirection()
    {
        float    degree = 0;
        GainType type   = GainType.Undefined;

        // if (user.DeltaPosition.magnitude > MOVEMENT_THRESHOLD && user.DeltaPosition.magnitude >= Mathf.Abs(user.DeltaRotation)) // Translation
        // {
        //     degree = user.DeltaPosition.magnitude * (MAX_TRANSLATION_GAIN);
        //     type = GainType.Translation;
        // }
        if (virtualUser.DeltaPosition.magnitude > 0.2f && virtualUser.DeltaPosition.magnitude >= Mathf.Abs(virtualUser.DeltaRotation)) // Curvature
        {
            degree = Mathf.Rad2Deg * virtualUser.DeltaPosition.magnitude * (HODGSON_MAX_CURVATURE_GAIN);
            type   = GainType.Curvature;
        }
        else if (Mathf.Abs(virtualUser.DeltaRotation) > ROTATION_THRESHOLD && virtualUser.DeltaPosition.magnitude < Mathf.Abs(virtualUser.DeltaRotation)) // Rotation
        {
            degree = virtualUser.DeltaRotation * (MIN_ROTATION_GAIN);
            type   = GainType.Rotation;
        }
        else
        {
            type = GainType.Undefined;
        }

        return(type, degree);
    }
Example #2
0
 public Ailment(string fullName, string shortName, Color color)
 {
     this.fullName  = fullName;
     this.shortName = shortName;
     this.color     = color;
     gainType       = GainType.Stacking;
 }
Example #3
0
 public Potion(int id, string name, int gain, GainType gainType)
 {
     this.id       = id;
     this.name     = name;
     this.gain     = gain;
     this.gainType = gainType;
 }
    //public Redirector(RedirectedUnit redirectedUnit) {
    //    this.redirectedUnit = redirectedUnit;
    //}

    //public void SetReferences(RedirectedUnit redirectedUnit) {
    //    this.redirectedUnit = redirectedUnit;
    //}

    public virtual (GainType, float) ApplyRedirection(Object2D realUser, Vector2 deltaPosition, float deltaRotation)
    {
        float    degree = 0;
        GainType type   = GainType.Undefined;

        return(type, degree);
    }
Example #5
0
        static void AddPotions(ref List <Potion> potions)
        {
            Random rnd        = new Random();
            int    enumLength = Enum.GetValues(typeof(GainType)).Length;

            for (int i = 0; i < 5; i++)
            {
                GainType gain = (GainType)rnd.Next(0, enumLength);
                potions.Add(new Potion(i, gain.ToString(), rnd.Next(1, 5), gain));
            }
        }
Example #6
0
        public static Gain Gain(string name = "", GainType type = GainType.Undefined, IGainProperties gainProperties = null)
        {
            switch (type)
            {
            case GainType.Equipment:
                if (gainProperties.GetType() != typeof(LatentEquipmentGain) && gainProperties.GetType() != typeof(SensibleEquipmentGain))
                {
                    BH.Engine.Reflection.Compute.RecordWarning("The gain properties you have supplied do not match the specified gain type");
                }
                break;

            case GainType.Infiltration:
                if (gainProperties.GetType() != typeof(InfiltrationGain))
                {
                    BH.Engine.Reflection.Compute.RecordWarning("The gain properties you have supplied do not match the specified gain type");
                }
                break;

            case GainType.Lighting:
                if (gainProperties.GetType() != typeof(LightingGain))
                {
                    BH.Engine.Reflection.Compute.RecordWarning("The gain properties you have supplied do not match the specified gain type");
                }
                break;

            case GainType.People:
                if (gainProperties.GetType() != typeof(PeopleGain))
                {
                    BH.Engine.Reflection.Compute.RecordWarning("The gain properties you have supplied do not match the specified gain type");
                }
                break;

            case GainType.Pollutant:
                if (gainProperties.GetType() != typeof(PollutantGain))
                {
                    BH.Engine.Reflection.Compute.RecordWarning("The gain properties you have supplied do not match the specified gain type");
                }
                break;
            }

            return(new Gain
            {
                Name = name,
                Type = type,
                Properties = gainProperties,
            });
        }
    public float GetApplidedGain(GainType type)
    {
        switch (type)
        {
        case Redirector.GainType.Translation:
            return(Mathf.Abs(GetTranslationGain()));

        case Redirector.GainType.Rotation:
            return(Mathf.Abs(GetRotationGain()));

        case Redirector.GainType.Curvature:
            return(Mathf.Abs(GetCurvatureGain()));

        default:
            return(0);
        }
    }
Example #8
0
        public void runMp3Gain(List<String> list, GainType gainType = GainType.Track, double gain = 89)
        {
            StringBuilder sb = new StringBuilder();

            if (gain > 255 || gain < 0)
            {
                throw new ArgumentOutOfRangeException("Gain must be 0-255");
            }

            switch (gainType)
            {
                case GainType.Track:
                    sb.Append(" /r ");
                    break;
                case GainType.Album:
                    sb.Append(" /a ");
                    break;
                case GainType.Constant:
                    sb.Append(String.Format(" /g {0} /c ", gain));
                    break;
            }

            foreach (string s in list)
            {
                if (File.Exists(s))
                {
                    sb.AppendFormat("\"{0}\" ", s);
                }
            }

            System.Diagnostics.Process mp3GainProcess = new Process();

            try
            {
                mp3GainProcess.StartInfo.UseShellExecute = false;
                mp3GainProcess.StartInfo.CreateNoWindow = false; //Change to true to hide the window
                mp3GainProcess.StartInfo.FileName = "mp3gain\\mp3gain.exe";
                mp3GainProcess.StartInfo.Arguments = sb.ToString();
                mp3GainProcess.Start();
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #9
0
    public override (GainType, float) ApplyRedirection(Object2D realUser, Vector2 deltaPosition, float deltaRotation)
    {
        float    degree = 0;
        GainType type   = GainType.Undefined;

        if (deltaPosition.magnitude > 0.01f)
        {
            degree = deltaPosition.magnitude;
            type   = GainType.Translation;
        }
        else if (Mathf.Abs(deltaRotation) > 0.01f)
        {
            degree = deltaRotation;
            type   = GainType.Rotation;
        }
        else
        {
            type = GainType.Undefined;
        }

        return(type, degree);
    }
    IEnumerator ApplyGain()
    {
        yield return(new WaitForSeconds(2.0f)); // just for delay when initializing

        while (true)
        {
            virtualUser = virtualEnvironment.userBody;

            if (virtualUser.DeltaPosition.magnitude > MOVEMENT_THRESHOLD || Mathf.Abs(virtualUser.DeltaRotation) > ROTATION_THRESHOLD)
            {
                var result = ApplyRedirection();

                GainType gainType = result.Item1;
                float    degree   = result.Item2;

                switch (gainType)
                {
                case GainType.Translation:
                    virtualEnvironment.Translate(-virtualUser.Forward * degree * Time.fixedDeltaTime, Space.World);
                    break;

                case GainType.Rotation:
                    virtualEnvironment.RotateAround(virtualUser.Position, degree * Time.fixedDeltaTime);
                    break;

                case GainType.Curvature:
                    virtualEnvironment.RotateAround(virtualUser.Position, degree * Time.fixedDeltaTime);
                    break;

                default:
                    break;
                }
            }

            yield return(new WaitForFixedUpdate());
        }
    }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VolumeEffect"/> class.
 /// </summary>
 /// <param name="gain">Volume gain.</param>
 /// <param name="type">How to interpret the gain value.</param>
 /// <param name="limiter">Gain limiter.</param>
 public VolumeEffect(double gain, GainType type, double limiter)
     : this(gain, type)
 {
     Limiter = limiter;
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VolumeEffect"/> class.
 /// </summary>
 /// <param name="gain">Volume gain.</param>
 /// <param name="type">How to interpret the gain value.</param>
 public VolumeEffect(double gain, GainType type)
     : this(gain)
 {
     Type = type;
 }
Example #13
0
 public MagicalClothes(int gain, GainType gainType, int id, string name, int strength, ClothesType clothesType) : base(id, name, strength, clothesType)
 {
     this.gain     = gain;
     this.gainType = gainType;
 }