コード例 #1
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            X.Read(reader);
            Y.Read(reader);
            Z.Read(reader);
            Magnitude.Read(reader);
            SeparateAxis = reader.ReadBoolean();
            if (IsReadInWorldSpace(reader.Version))
            {
                InWorldSpace = reader.ReadBoolean();
            }
            if (IsReadMultiplyDragByParticleSize(reader.Version))
            {
                MultiplyDragByParticleSize     = reader.ReadBoolean();
                MultiplyDragByParticleVelocity = reader.ReadBoolean();
            }
            reader.AlignStream(AlignType.Align4);

            Dampen = reader.ReadSingle();
            if (IsReadDrag(reader.Version))
            {
                Drag.Read(reader);
            }
        }
コード例 #2
0
        private string ExponentToString(Magnitude magnitude)
        {
            int exponent = this[magnitude];

            return((exponent == 0) ? String.Empty :
                   ((exponent == 1) ? s_symbol[(int)magnitude] : s_symbol[(int)magnitude] + /* "^" + */ exponent.ToString()));
        }
コード例 #3
0
        public void ShakeForDuration(Magnitude _magnitude = Magnitude.Small, float duration = 5.0f, EndingMagnitude endingMagnitude = EndingMagnitude.Fourth)
        {
            isShakeForever = false;
            int numberOfShakes = (int)(duration / durationPerShake);

            ScheduleShake(_magnitude, endingMagnitude, numberOfShakes);
        }
コード例 #4
0
        private List <Run> GetMagnitude(List <ModDetails> modsDetails, int modInfoIndex, string modId)
        {
            List <Magnitude> modMagnitudes = modsDetails[modInfoIndex].Magnitudes.FindAll(x => x.Hash == modId);;

            List <Run> rs = new List <Run>();

            rs.Add(new Run {
                Text = "MAGNITUDE: ", Foreground = Brushes.White, FontSize = 11
            });

            string modMagnitudeStr = "";

            for (int k = 0; k < modMagnitudes.Count; k++)
            {
                if (k > 0)
                {
                    modMagnitudeStr += " to ";
                }

                Magnitude modMagnitude = modMagnitudes[k];
                if (modMagnitude.Min != modMagnitude.Max)
                {
                    modMagnitudeStr += modMagnitude.Min.ToString() + "-" + modMagnitude.Max.ToString();
                }
                else
                {
                    modMagnitudeStr += modMagnitude.Min.ToString();
                }
            }
            rs.Add(new Run {
                Text = "[" + modMagnitudeStr + "]", Foreground = Brushes.Gold
            });
            return(rs);
        }
コード例 #5
0
ファイル: Vector.cs プロジェクト: yusufbs/Codility
        public Vector(double x, double y, string name)
        {
            this.name = name;
            this.x    = x;
            this.y    = y;

            isNomrmalised = Magnitude.CompareTo(1) == 0;
        }
コード例 #6
0
        public void DoService(RequestDto requestDto)
        {
            Magnitude fromMagnitude = GetMagnitude(requestDto.FromUnit);
            Magnitude toMagnitude   = GetMagnitude(requestDto.ToUnit);

            CheckValid(fromMagnitude, requestDto.EnteredValue);
            Convert(fromMagnitude, toMagnitude, requestDto);
        }
コード例 #7
0
ファイル: FileUtil.cs プロジェクト: leandroltavares/GreenUtil
        /// <summary>
        /// Obtém o tamanho de arquivo em na magnitude informada
        /// </summary>
        /// <param name="filePath">Caminho do arquivo</param>
        /// <param name="magnitude">Magnitude informada</param>
        /// <returns></returns>
        public static decimal GetFileSize(string filePath, Magnitude magnitude = Magnitude.MB)
        {
            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            return((decimal) new FileInfo(filePath).Length / (1 << ((int)magnitude * 10)));
        }
コード例 #8
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(Orientation != null ? Orientation.ToStepValue() : "$");
            parameters.Add(Magnitude != null ? Magnitude.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
コード例 #9
0
        public override int GetHashCode()
        {
            int hashCode = -228455935;

            hashCode = hashCode * -1521134295 + Seed.GetHashCode();
            hashCode = hashCode * -1521134295 + Magnitude.GetHashCode();
            hashCode = hashCode * -1521134295 + Hardness.GetHashCode();
            hashCode = hashCode * -1521134295 + Bias.GetHashCode();
            return(hashCode);
        }
コード例 #10
0
        public override string ToString()
        {
            string quantityString = Magnitude.ToString("R", System.Globalization.CultureInfo.InvariantCulture) + " " + Units;

            if (!string.IsNullOrEmpty(this.MagnitudeStatus) && this.MagnitudeStatus != "=")
            {
                return(this.MagnitudeStatus + " " + quantityString);
            }

            return(quantityString);
        }
コード例 #11
0
 protected override void Update()
 {
     if (_isDirty && isActiveAndEnabled)
     {
         _isDirty = false;
         _ballSpriteRenderer.sprite = BallType.GetSprite();
         Hitpoints    = Magnitude.GetHitpoints();
         MaxHitpoints = Magnitude.GetHitpoints(); PowerGemSprite.SetActive(HasPowerGem);
         DamageSprite.SetActive(Magnitude != BallMagnitude.Standard);
         gameObject.transform.localScale = _baseScale * Magnitude.GetScale();
     }
 }
コード例 #12
0
ファイル: Vector2D.cs プロジェクト: urbrioche/DecimalMath
 /// <summary>
 /// Gets whether or not this is a unit vector, i.e. has a magnitude of 1.
 /// </summary>
 /// <param name="decimals">Optional precision at which to make the comparison.</param>
 public bool IsUnitVector(int decimals = -1)
 {
     // TODO: Change name to GetIsUnitVector
     if (decimals >= 0)
     {
         return(Magnitude.RoundFromZero(decimals) == 1m);
     }
     else
     {
         return(Magnitude == 1m);
     }
 }
コード例 #13
0
 public void Encode(ASTMagnitude node)
 {
     if (node.Exponent == -1)
     {
         m_stack.Push(m_senselessExpr);
     }
     else
     {
         Magnitude m = (Magnitude)node.Exponent;
         m_stack.Push(new SenseExpr(new Dimension(m), String.Format("Dimension.{0}", m.ToString())));
     }
 }
コード例 #14
0
 /// <summary>Serves as the default hash function. </summary>
 /// <returns>A hash code for the current object.</returns>
 /// <filterpriority>2</filterpriority>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Symbol != null ? Symbol.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Type;
         hashCode = (hashCode * 397) ^ (int)Direction;
         hashCode = (hashCode * 397) ^ Magnitude.GetHashCode();
         hashCode = (hashCode * 397) ^ Confidence.GetHashCode();
         hashCode = (hashCode * 397) ^ Period.GetHashCode();
         return(hashCode);
     }
 }
コード例 #15
0
        public override int GetHashCode()
        {
            var hashCode = -2145328967;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(PowerFullName);

            hashCode = hashCode * -1521134295 + UniqueId.GetHashCode();
            hashCode = hashCode * -1521134295 + EffectClass.GetHashCode();
            hashCode = hashCode * -1521134295 + EffectType.GetHashCode();
            hashCode = hashCode * -1521134295 + DamageType.GetHashCode();
            hashCode = hashCode * -1521134295 + MezmorizeType.GetHashCode();
            hashCode = hashCode * -1521134295 + EffectModifiers.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Summon);

            hashCode = hashCode * -1521134295 + DelayedTime.GetHashCode();
            hashCode = hashCode * -1521134295 + Ticks.GetHashCode();
            hashCode = hashCode * -1521134295 + Stacking.GetHashCode();
            hashCode = hashCode * -1521134295 + BaseProbability.GetHashCode();
            hashCode = hashCode * -1521134295 + Suppression.GetHashCode();
            hashCode = hashCode * -1521134295 + Buffable.GetHashCode();
            hashCode = hashCode * -1521134295 + Resistible.GetHashCode();
            hashCode = hashCode * -1521134295 + SpecialCase.GetHashCode();
            hashCode = hashCode * -1521134295 + VariableModifiedOverride.GetHashCode();
            hashCode = hashCode * -1521134295 + PlayerVersusMode.GetHashCode();
            hashCode = hashCode * -1521134295 + ToWho.GetHashCode();
            hashCode = hashCode * -1521134295 + DisplayPercentageOverride.GetHashCode();
            hashCode = hashCode * -1521134295 + Scale.GetHashCode();
            hashCode = hashCode * -1521134295 + Magnitude.GetHashCode();
            hashCode = hashCode * -1521134295 + Duration.GetHashCode();
            hashCode = hashCode * -1521134295 + AttribType.GetHashCode();
            hashCode = hashCode * -1521134295 + Aspect.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ModifierTable);

            hashCode = hashCode * -1521134295 + NearGround.GetHashCode();
            hashCode = hashCode * -1521134295 + CancelOnMiss.GetHashCode();
            hashCode = hashCode * -1521134295 + RequiresToHitCheck.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(UidClassName);

            hashCode = hashCode * -1521134295 + IdClassName.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(MagnitudeExpression);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Reward);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(EffectId);

            hashCode = hashCode * -1521134295 + IgnoreEnhancementDiversification.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Override);

            hashCode = hashCode * -1521134295 + ProcsPerMinute.GetHashCode();
            return(hashCode);
        }
コード例 #16
0
        private void ScheduleShake(Magnitude _magnitude = Magnitude.Medium, EndingMagnitude endingMagnitude = EndingMagnitude.Fourth, int numberOfShakes = 1)
        {
            if (camera != null)
            {
                remainingShakes = numberOfShakes;
                magnitude       = (float)_magnitude * 0.005f;

                int   numberOfDegradationsPerSingleShake = 2;
                float endingMagnitudeFloat    = (float)((float)endingMagnitude * 0.005f) * magnitude;
                float totalMagnitudeToDegrade = magnitude - endingMagnitudeFloat;
                degradationPerShake = totalMagnitudeToDegrade / ((numberOfDegradationsPerSingleShake * remainingShakes) - 1);

                PerformSingleShake();
            }
        }
コード例 #17
0
        public override YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(container);

            node.Add("x", X.ExportYAML(container));
            node.Add("y", Y.ExportYAML(container));
            node.Add("z", Z.ExportYAML(container));
            node.Add("magnitude", Magnitude.ExportYAML(container));
            node.Add("separateAxis", SeparateAxis);
            node.Add("inWorldSpace", InWorldSpace);
            node.Add("multiplyDragByParticleSize", GetExportMultiplyDragByParticleSize(container.Version));
            node.Add("multiplyDragByParticleVelocity", GetExportMultiplyDragByParticleVelocity(container.Version));
            node.Add("dampen", Dampen);
            node.Add("drag", GetExportDrag(container.Version).ExportYAML(container));
            return(node);
        }
コード例 #18
0
        public override YAMLNode ExportYAML(IAssetsExporter exporter)
        {
            YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(exporter);

            node.Add("x", X.ExportYAML(exporter));
            node.Add("y", Y.ExportYAML(exporter));
            node.Add("z", Z.ExportYAML(exporter));
            node.Add("magnitude", Magnitude.ExportYAML(exporter));
            node.Add("separateAxis", SeparateAxis);
            node.Add("inWorldSpace", InWorldSpace);
            node.Add("multiplyDragByParticleSize", MultiplyDragByParticleSize);
            node.Add("multiplyDragByParticleVelocity", MultiplyDragByParticleVelocity);
            node.Add("dampen", Dampen);
            node.Add("drag", Drag.ExportYAML(exporter));
            return(node);
        }
コード例 #19
0
        public override YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(container);

            node.Add(XName, X.ExportYAML(container));
            node.Add(YName, Y.ExportYAML(container));
            node.Add(ZName, Z.ExportYAML(container));
            node.Add(MagnitudeName, Magnitude.ExportYAML(container));
            node.Add(SeparateAxisName, SeparateAxis);
            node.Add(InWorldSpaceName, InWorldSpace);
            node.Add(MultiplyDragByParticleSizeName, GetExportMultiplyDragByParticleSize(container.Version));
            node.Add(MultiplyDragByParticleVelocityName, GetExportMultiplyDragByParticleVelocity(container.Version));
            node.Add(DampenName, Dampen);
            node.Add(DragName, GetExportDrag(container.Version).ExportYAML(container));
            return(node);
        }
コード例 #20
0
        /// <summary>
        /// A verbose descriptive string representation of the <see cref="LinearStateEstimator.Measurements.PhasorEstimate"/> class.
        /// </summary>
        /// <returns>A verbose descriptive string representation of the <see cref="LinearStateEstimator.Measurements.PhasorEstimate"/> class.</returns>
        public new string ToVerboseString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine();
            stringBuilder.AppendFormat("----- Phasor Estimate ----------------------------------------------------------");
            stringBuilder.AppendLine();
            stringBuilder.AppendFormat("            Type: " + Type.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("         Base KV: " + BaseKV.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("     MagnitudKey: " + MagnitudeKey + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        AngleKey: " + AngleKey + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("       Magnitude: " + Magnitude.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("           Angle: " + AngleInDegrees.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        Reported: " + MeasurementWasReported.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendLine();
            return(stringBuilder.ToString());
        }
コード例 #21
0
 public int this[Magnitude magnitude]
 {
     get
     {
         int  exponent = (int)magnitude;
         byte x        = (byte)((m_exponents >> (exponent << LOGWIDTH)) & EXPMASK);
         return((x > MAXEXP) ? ((int)x - COMPLEMENT) : (int)x);
     }
     private set
     {
         int exponent = (int)magnitude;
         if ((value < MINEXP) || (MAXEXP < value))
         {
             throw new OverflowException(String.Format("Dimension \"{0}\": exponent value \"{1}\" out of range [{2},{3}].", magnitude.ToString(), value, MINEXP, MAXEXP));
         }
         m_exponents |= ((DIMENSION)(value & EXPMASK)) << (exponent << LOGWIDTH);
     }
 }
コード例 #22
0
        public string ToLaTeX()
        {
            //if (Magnitude == 0)
            //    return "0";

            var i1 = Id;
            var i2 = Id + 1;

            var magnitudeText = Magnitude.GetLaTeXNumber();
            var phaseText = Phase.GetLaTeXAngleInDegrees();
            var basisText1 = $"{i1},{i2}".GetLaTeXBasisName();
            var basisText2 = $"{i1}".GetLaTeXBasisName();

            //if (Phase == 0)
            //    return $@"{magnitudeText} {basisText2}";

            return $@"{magnitudeText} e^{{ {phaseText} {basisText1} }} {basisText2}";
        }
コード例 #23
0
ファイル: TrainForm.cs プロジェクト: twanbeeren/Algorithms
        private void buttonAddAnimal_Click(object sender, EventArgs e)
        {
            if (comboBoxDiet.Text != String.Empty && comboBoxSize.Text != String.Empty)
            {
                Diet      diet      = (Diet)Enum.Parse(typeof(Diet), comboBoxDiet.Text);
                Magnitude magnitude = (Magnitude)Enum.Parse(typeof(Magnitude), comboBoxSize.Text);

                Animal animal = AnimalFactory.MakeAnimal(diet, magnitude);
                animals.Add(animal);
                animals.OrderBy(x => x.Magnitude == Magnitude.Large);

                listBoxAnimals.Items.Clear();
                foreach (Animal _animal in animals)
                {
                    listBoxAnimals.Items.Add(_animal);
                }
            }
        }
コード例 #24
0
ファイル: StandardValue.cs プロジェクト: QuasarX1/QuasarCode
        /// <summary>
        /// Provides a string representation of the value with its unit
        /// </summary>
        /// <returns>The value as a string</returns>
        public override string ToString()
        {
            string power = "";

            foreach (char num in StandardPower.ToString())
            {
                if (num == '-')
                {
                    power += Tools.StringLiterals.Superscript_Minus;
                }
                else
                {
                    power += Tools.StringLiterals.SuperscriptInt[int.Parse((num.ToString()))];
                }
            }

            return(Magnitude.ToString() + ((StandardPower != 0) ?  " x 10" + power : "") + ((Unit.ToString() != "") ? " " + Unit.ToString() : ""));
        }
コード例 #25
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Magnitude", true, out subEle);
            subEle.Value = Magnitude.ToString();

            ele.TryPathTo("Area", true, out subEle);
            subEle.Value = Area.ToString();

            ele.TryPathTo("Duration", true, out subEle);
            subEle.Value = Duration.ToString();

            ele.TryPathTo("Type", true, out subEle);
            subEle.Value = Type.ToString();

            ele.TryPathTo("ActorValue", true, out subEle);
            subEle.Value = ActorValue.ToString();
        }
コード例 #26
0
        /// <summary>
        /// A verbose descriptive string representation of the <see cref="PhasorMeasurement"/> class.
        /// </summary>
        /// <returns>A verbose descriptive string representation of the <see cref="PhasorMeasurement"/> class.</returns>
        public new string ToVerboseString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine();
            stringBuilder.AppendFormat("----- Phasor Measurement -------------------------------------------------------");
            stringBuilder.AppendLine();
            stringBuilder.AppendFormat("            Type: " + Type.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("         Base KV: " + BaseKV.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("     MagnitudKey: " + MagnitudeKey + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        AngleKey: " + AngleKey + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("       Magnitude: " + Magnitude.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("           Angle: " + AngleInDegrees.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        Reported: " + MeasurementWasReported.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("        Variance: " + m_measurementVariance.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("             RCF: " + m_rcf.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat("            PACF: " + m_pacf.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendFormat(" ShouldCalibrate: " + m_measurementShouldBeCalibrated.ToString() + "{0}", Environment.NewLine);
            //stringBuilder.AppendFormat("CalibrationSttng: " + m_calibrationSetting.ToString() + "{0}", Environment.NewLine);
            stringBuilder.AppendLine();
            return(stringBuilder.ToString());
        }
コード例 #27
0
        /// <summary>Indicates whether the current object is equal to another object of the same type.</summary>
        /// <returns>true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.</returns>
        /// <param name="other">An object to compare with this object.</param>
        public bool Equals(Alpha other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (Id == other.Id)
            {
                return(true);
            }

            return(Equals(Symbol, other.Symbol) &&
                   Direction == other.Direction &&
                   Type == other.Type &&
                   Confidence.Equals(other.Confidence) &&
                   Magnitude.Equals(other.Magnitude) &&
                   Period.Equals(other.Period));
        }
コード例 #28
0
    public void Hydrate()
    {
        if (IsHydrated == false)
        {
            name = "NEW Terrain Layer [Reference]";

            Octaves = ScriptableObject.CreateInstance <Int_MinMax_Reference>();
            Octaves.Hydrate();
            Octaves.name       = "Octaves";
            Octaves.IsHydrated = true;

            Scale = ScriptableObject.CreateInstance <Float_MinMax_Reference>();
            Scale.Hydrate();
            Scale.name       = "Scale";
            Scale.IsHydrated = true;

            Persistance = ScriptableObject.CreateInstance <Float_MinMax_Reference>();
            Persistance.Hydrate();
            Persistance.name       = "Persistance";
            Persistance.IsHydrated = true;

            Lacunarity = ScriptableObject.CreateInstance <Float_MinMax_Reference>();
            Lacunarity.Hydrate();
            Lacunarity.name       = "Lacunarity";
            Lacunarity.IsHydrated = true;

            Root = ScriptableObject.CreateInstance <Float_MinMax_Reference>();
            Root.Hydrate();
            Root.name       = "Root";
            Root.IsHydrated = true;

            Magnitude = ScriptableObject.CreateInstance <Float_MinMax_Reference>();
            Magnitude.Hydrate();
            Magnitude.name       = "Magnitude";
            Magnitude.IsHydrated = true;
        }
    }
コード例 #29
0
 /// <summary>
 /// Returns a string representation of the vector.
 /// </summary>
 /// <returns>A System.String representing the vector.</returns>
 public override string ToString()
 {
     return(Magnitude.ToString("N5") + " " + Direction.ToString("N2") + "°");
 }
コード例 #30
0
ファイル: EffectFactory.cs プロジェクト: ServerGame/NullQuest
 public IEffect DamageHealth(Magnitude magnitude)
 {
     return new DamageHealthEffect { Magnitude = magnitude };
 }
コード例 #31
0
ファイル: EffectFactory.cs プロジェクト: ServerGame/NullQuest
 public IEffect RestoreEnergy(Magnitude magnitude)
 {
     return new RestoreEnergyEffect() { Magnitude = magnitude };
 }
コード例 #32
0
 // Base unit
 public Dimension(Magnitude magnitude)
 {
     m_exponents     = 0;
     this[magnitude] = 1;
 }
コード例 #33
0
ファイル: EffectFactory.cs プロジェクト: ServerGame/NullQuest
 public IEffect RestoreHealth(Magnitude magnitude)
 {
     return new RestoreHealthEffect { Magnitude = magnitude };
 }
コード例 #34
0
ファイル: Dice.cs プロジェクト: ServerGame/NullQuest
 public int Roll(Magnitude magnitude)
 {
     return magnitude.BaseAmount + Roll(magnitude.NumberOfDice, magnitude.NumberOfSides);
 }