Inheritance: MonoBehaviour
Ejemplo n.º 1
0
	static void Main() {
		double[] a = {0.0, 0.5, 1.0};
		double[] squares = Apply(a, Square);
		double[] sines = Apply(a, Math.Sin);
		Multiplier m = new Multiplier(2.0);
		double[] doubles =  Apply(a, m.Multiply);
	}
Ejemplo n.º 2
0
 public MemoryOperand(
     OperandType type,
     Operand baseAddress,
     Operand index    = null,
     Multiplier scale = Multiplier.x1,
     int displacement = 0) : base(OperandKind.Memory, type)
 {
     BaseAddress  = baseAddress;
     Index        = index;
     Scale        = scale;
     Displacement = displacement;
 }
Ejemplo n.º 3
0
	public void SetReferences () {
        player = Player.instance;
        multi = Multiplier.instance;
        autoclicker = Autoclicker.instance;
        progressBar = ProgressBarHandler.instance;
        upgradeHandler = UpgradeHandler.instance;
        clicker = Clicker.instance;
        purchaseHandler = PurchaseHandler.instance;
        numberFormatter = NumberFormatter.instance;
        tooltip = Tooltip.instance;
        image = GetComponent<Image>();
	}
Ejemplo n.º 4
0
        public void Multiplication()
        {
            Multiplier sum = new Multiplier();
            decimal    var1, var2;
            decimal    res;

            var1          = 8;
            var2          = 4;
            sum.Operande1 = var1;
            sum.Operande2 = var2;
            res           = sum.Calculer();
        }
Ejemplo n.º 5
0
        public void PopulateMultiplesOfTwo_Should_PopulateArrayWithExpectedValues()
        {
            var array = new int[5];

            Multiplier.PopulateMultiplesOfTwo(array);

            Assert.Equal(2, array[0]);
            Assert.Equal(4, array[1]);
            Assert.Equal(6, array[2]);
            Assert.Equal(8, array[3]);
            Assert.Equal(10, array[4]);
        }
Ejemplo n.º 6
0
 // TODO - Documentation
 public T Remove <T>(T value) where T : INumber <T>
 {
     if (!Power.Equals(default(double)) && !Base.Equals(default(double)))
     {
         return(value.Multiply(Math.Pow(Base, Power)));
     }
     if (!Multiplier.Equals(default(double)))
     {
         return(value.Multiply(Multiplier));
     }
     return(value);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Removes a prefix from a value
 /// </summary>
 /// <example>
 /// For example, 5.01223 km, removing the prefix 'kilo' returns 5012.23 m
 /// </example>
 /// <param name="value">The value to remove the prefix from</param>
 /// <returns>The value after the prefix has been removed</returns>
 public double Remove(double value)
 {
     if (!Power.Equals(default(double)) && !Base.Equals(default(double)))
     {
         return(value * Math.Pow(Base, Power));
     }
     if (!Multiplier.Equals(default(double)))
     {
         return(value * Multiplier);
     }
     return(value);
 }
Ejemplo n.º 8
0
        private static int ApplyLetterMultiplier(int value, Multiplier multiplier)
        {
            if (multiplier == null)
            {
                return(value);
            }

            return(multiplier.Type switch
            {
                MultiplierType.Letter => value * multiplier.Value,
                _ => value
            });
Ejemplo n.º 9
0
        public override bool Equals(object obj)
        {
            if (!(obj is AtomTree anotherAtom))
            {
                return(false);
            }

            return(Multiplier.Equals(anotherAtom.Multiplier) &&
                   ((Atom == null && anotherAtom.Atom == null) || Atom != null && Atom.Equals(anotherAtom.Atom)) &&
                   Childs.Length == anotherAtom.Childs.Length &&
                   Enumerable.Range(0, Childs.Length).All(i => Childs[i].Equals(anotherAtom.Childs[i])));
        }
Ejemplo n.º 10
0
    public void Add(long limit, Multiplier multiplier)
    {
        int lastIndex = limits.Count - 1;

        if (lastIndex >= 0 && limit * (long)multiplier <= limits[lastIndex] * (long)multipliers[lastIndex])
        {
            throw new ArgumentOutOfRangeException("limit, multiplier", "must be added in increasing order");
        }
        limits.Add(limit);
        counts.Add(0);
        multipliers.Add(multiplier);
    }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     rb            = GetComponent <Rigidbody2D>();
     animator      = horse.GetComponent <Animator>();
     multiplier    = multiplierGraphic.GetComponent <Multiplier>();
     medal         = Camera.main.GetComponent <ScreenOverlay>();
     flashRenderer = flash.GetComponent <CanvasRenderer>();
     flashRenderer.SetAlpha(0);
     jumpSpeed                  = normalJumpSpeed;
     originalHorse              = animator.runtimeAnimatorController;
     GameEventManager.GameOver += GameOver;
 }
Ejemplo n.º 12
0
        public Multiplier GetMultipliers()
        {
            Multiplier playerMultiplier   = player.Multipliers;
            Multiplier buildingMultiplier = buildingService.GetBuildingsMultipliers();

            playerMultiplier.GatheringMultiplier += buildingMultiplier.GatheringMultiplier;
            playerMultiplier.HuntingMultipier    += buildingMultiplier.HuntingMultipier;
            playerMultiplier.MiningMultiplier    += buildingMultiplier.MiningMultiplier;


            return(playerMultiplier);
        }
Ejemplo n.º 13
0
        public string InternalsToString()
        {
            string type = IsServer ? "server" : "client";
            string str  = string.Format("SRP {0} Internals:\n", type);

            str += string.Format("G      = {0}\n", Generator.ToHexString());
            str += string.Format("K      = {0}\n", Multiplier.ToHexString());
            str += string.Format("N      = {0}\n", Modulus.ToHexString());

            str += string.Format("I      = '{0}'\n", Credentials);
            str += string.Format("Hash(I)= {0}\n", Hash(Credentials).ToHexString());
            str += string.Format("X      = {0}\n", CredentialsHash.ToHexString());
            str += string.Format("V      = {0}\n", Verifier.ToHexString());
            if (m_salt != null)
            {
                str += string.Format("Salt   = {0}\n", Salt.ToHexString());
            }
            if (null != m_publicEphemeralValueA && null != m_publicEphemeralValueB)
            {
                str += string.Format("u      = {0}\n", ScramblingParameter.ToHexString());
                str += string.Format("h(A)   = {0}\n", Hash(PublicEphemeralValueA).ToHexString());
                str += string.Format("h(B)   = {0}\n", Hash(PublicEphemeralValueB.GetBytes()).ToHexString());
            }

            if (IsServer == false || PublicEphemeralValueA != null)
            {
                str += string.Format("A      = {0}\n", PublicEphemeralValueA.ToHexString());
            }
            if (IsServer || PublicEphemeralValueB != null)
            {
                str += string.Format("B      = {0}\n", PublicEphemeralValueB.ToHexString());
                BigInteger tmp = Multiplier * Generator.ModPow(CredentialsHash, Modulus);
                str += string.Format("kg^x   = {0}\n", tmp.ToHexString());
                tmp  = PublicEphemeralValueB - tmp % Modulus;
                if (tmp < 0)
                {
                    tmp += Modulus;
                }
                str += string.Format("B-kg^x = {0}\n", tmp.ToHexString());
            }

            try
            {
                str += string.Format("S.key  = {0}\n", SessionKey.ToHexString());
            }
            catch
            {
                str += "S.key  = empty\n";
            }

            return(str);
        }
Ejemplo n.º 14
0
        public override Contract ToIbContract()
        {
            var contract = base.ToIbContract();

            if (OptionType != EOptionType.None)
            {
                contract.Right = OptionType == EOptionType.Call ? "C" : "P";
            }
            contract.Expiry     = Expiry < DateTime.Now ? null : Expiry.ToString("yyyyMMdd");
            contract.Strike     = Strike;
            contract.Multiplier = Multiplier.ToString();
            return(contract);
        }
Ejemplo n.º 15
0
        [Inject] internal void Construct(PluginConfig conf, SiraLog l)
        {
            l.Logger.Debug("ModSettingsViewController:Construct()");

            Logger           = l;
            Config           = conf;
            MultiplierConfig = conf.Multiplier;
            EnergyConfig     = conf.Energy;
            ComboConfig      = conf.Combo;
            ProgressConfig   = conf.Progress;
            PositionConfig   = conf.Position;
            MiscConfig       = conf.Misc;
        }
Ejemplo n.º 16
0
        public static void Main(string[] args)

        {
            Multiplier multiplyByThree = new Multiplier(3);

            Console.WriteLine("multiplyByThree.Multiply(2): " + multiplyByThree.Multiply(2));

            Multiplier multiplyByFour = new Multiplier(4);

            Console.WriteLine("multiplyByFour.Multiply(2): " + multiplyByFour.Multiply(2));
            Console.WriteLine("multiplyByThree.Multiply(1): " + multiplyByThree.Multiply(1));
            Console.WriteLine("multiplyByFour.Multiply(1): " + multiplyByFour.Multiply(1));
        }
Ejemplo n.º 17
0
        private List <BigNumber> DecodeBigNumbers(string message)
        {
            BigNumber        multiplyFactor          = Multiplier.ModInverse(Modulus);             //does multiplier^(-1)modModulus
            List <BigNumber> charsEncryptedBN        = StringHelper.DecodeStringToBNList(message); //convert numbers from string to BN array
            List <BigNumber> decodedEncryptedBNChars = new List <BigNumber>(charsEncryptedBN.Count);

            for (int i = 0; i < charsEncryptedBN.Count; i++)
            {
                BigNumber BNDecode = new BigNumber((charsEncryptedBN[i] * multiplyFactor) % Modulus);
                decodedEncryptedBNChars.Add(BNDecode);
            }
            return(decodedEncryptedBNChars);
        }
Ejemplo n.º 18
0
        public override int GetHashCode()
        {
            int hashCode = -1488041194;

            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + _amount.GetHashCode();
            hashCode = hashCode * -1521134295 + Amount.GetHashCode();
            hashCode = hashCode * -1521134295 + Multiplier.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <Booking> .Default.GetHashCode(Booking);

            hashCode = hashCode * -1521134295 + BookingId.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 19
0
 public MemoryOperand With(
     OperandType type,
     Operand baseAddress,
     Operand index    = null,
     Multiplier scale = Multiplier.x1,
     int displacement = 0)
 {
     With(OperandKind.Memory, type);
     BaseAddress  = baseAddress;
     Index        = index;
     Scale        = scale;
     Displacement = displacement;
     return(this);
 }
Ejemplo n.º 20
0
        static void Main()
        {
            var a = new[] { 0.0, 0.5, 1.0 };

            double[] squares = Apply(a, Square);

            double[] sines = Apply(a, System.Math.Sin);

            Multiplier m = new Multiplier(2.0);

            double[] doubles = Apply(a, m.Multiply);

            double[] dbles = Apply(a, (double x) => x * 2.0);
        }
Ejemplo n.º 21
0
        public void GetPackageIdentifierTest()
        {
            int s = 3, e = 15;
            int totalElements = 13;
            var mul           = new Multiplier();
            var result        = mul.GetPackageIdentifier(s, e);

            Assert.AreEqual(totalElements, result.Count);

            string lastIdentifier;

            result.TryGetValue(e, out lastIdentifier);
            Assert.AreEqual(Constants.returnDelivery, lastIdentifier);
        }
Ejemplo n.º 22
0
        public void ArrayPool()
        {
            var array = ArrayPool <int> .Shared.Rent(_size);

            try
            {
                Multiplier.CalculateMultiplesOfTwo(array, _size);
                // do something with the data
            }
            finally
            {
                ArrayPool <int> .Shared.Return(array);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        /// <param name="objCulture">Culture in which to print.</param>
        /// <param name="strLanguageToPrint">Language in which to print</param>
        public void Print(XmlTextWriter objWriter, CultureInfo objCulture, string strLanguageToPrint)
        {
            objWriter.WriteStartElement("lifestyle");
            objWriter.WriteElementString("name", CustomName);
            objWriter.WriteElementString("cost", Cost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("totalmonthlycost", TotalMonthlyCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("totalcost", TotalCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("dice", Dice.ToString(objCulture));
            objWriter.WriteElementString("multiplier", Multiplier.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("months", Increments.ToString(objCulture));
            objWriter.WriteElementString("purchased", Purchased.ToString());
            objWriter.WriteElementString("type", StyleType.ToString());
            objWriter.WriteElementString("increment", IncrementType.ToString());
            objWriter.WriteElementString("sourceid", SourceID.ToString("D"));
            objWriter.WriteElementString("bonuslp", BonusLP.ToString(objCulture));
            string strBaseLifestyle = string.Empty;

            // Retrieve the Advanced Lifestyle information if applicable.
            if (!string.IsNullOrEmpty(BaseLifestyle))
            {
                XmlNode objXmlAspect = GetNode();
                if (objXmlAspect != null)
                {
                    strBaseLifestyle = objXmlAspect["translate"]?.InnerText ?? objXmlAspect["name"]?.InnerText ?? strBaseLifestyle;
                }
            }

            objWriter.WriteElementString("baselifestyle", strBaseLifestyle);
            objWriter.WriteElementString("trustfund", TrustFund.ToString());
            objWriter.WriteElementString("source", CommonFunctions.LanguageBookShort(Source, strLanguageToPrint));
            objWriter.WriteElementString("page", DisplayPage(strLanguageToPrint));
            objWriter.WriteStartElement("qualities");

            // Retrieve the Qualities for the Advanced Lifestyle if applicable.
            foreach (LifestyleQuality objQuality in LifestyleQualities)
            {
                objQuality.Print(objWriter, objCulture, strLanguageToPrint);
            }
            // Retrieve the free Grids for the Advanced Lifestyle if applicable.
            foreach (LifestyleQuality objQuality in FreeGrids)
            {
                objQuality.Print(objWriter, objCulture, strLanguageToPrint);
            }
            objWriter.WriteEndElement();
            if (_objCharacter.Options.PrintNotes)
            {
                objWriter.WriteElementString("notes", Notes);
            }
            objWriter.WriteEndElement();
        }
Ejemplo n.º 24
0
    public void HitOperationBrick(Interactable i)
    {
        OperationBlock b = i as OperationBlock;

        if (operation != Multiplier.NONE)
        {
            number1 = result;
            number2 = Int32.MinValue;
            result  = Int32.MinValue;
        }

        operation      = b.multiplier;
        process        = 3;
        operationRound = false;
    }
Ejemplo n.º 25
0
 internal static void SetDifficulty(int _value)
 {
     if (_value == 0)
     {
         Current = Easy;
     }
     else if (_value == 2)
     {
         Current = Hard;
     }
     else
     {
         Current = Normal;
     }
 }
Ejemplo n.º 26
0
        public static IPackageIdentifier GetIdentifier()
        {
            IPackageIdentifier obj      = null;
            string             strategy = ConfigurationManager.AppSettings.Get("IdentifierStrategy");

            if (strategy.Equals("Multiplier"))
            {
                obj = new Multiplier();
            }
            //else if (strategy.Equals("XXXX"))
            //{
            //    obj = new XXXX;
            //}
            return(obj);
        }
Ejemplo n.º 27
0
        public void Example_7_2()
        {
            int     howManyPeople = 5;
            float   pi            = 3.14f;
            MyClass mc            = new MyClass();

            mc.SomeMethod(howManyPeople, pi);

            int        x            = 4;
            int        y            = 10;
            Multiplier myMultiplier = new Multiplier();
            int        result       = myMultiplier.Multiply(x, y);

            Console.WriteLine("Here are the result received: {0}", result);
        }
Ejemplo n.º 28
0
 private float GetMultiplier(Multiplier mult)
 {
     if (DFile.PhaseInfo.FortWarActive)
     {
         if (DFile.PhaseInfo.BuildPhase)
         {
             return(mult.Build);
         }
         if (DFile.PhaseInfo.FightPhase)
         {
             return(mult.Fight);
         }
     }
     return(1);
 }
Ejemplo n.º 29
0
        static void Main(string[] args)
        {
            Overseer overseer = new Overseer();

            overseer.Setup();
            overseer.Expression.Print();
            var mTerm       = Multiplier.Multiply(overseer.Expression.PolynomialList[0].Terms[0], overseer.Expression.PolynomialList[0].Terms[1]);
            var dTerm       = Divider.Divide(overseer.Expression.PolynomialList[0].Terms[0], overseer.Expression.PolynomialList[0].Terms[1]);
            var rPolynomial = Multiplier.Multiply(overseer.Expression.PolynomialList[0], overseer.Expression.PolynomialList[0]);
            var aPolynomial = Adder.Add(overseer.Expression.PolynomialList[0], overseer.Expression.PolynomialList[0]);

            mTerm.Print();
            dTerm.Print();
            rPolynomial.Print();
            aPolynomial.Print();
        }
Ejemplo n.º 30
0
        public override int GetHashCode()
        {
            var hashCode = 966821394;

            hashCode = hashCode * -1521134295 + Mode.GetHashCode();
            hashCode = hashCode * -1521134295 + BuffMode.GetHashCode();
            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + SubId.GetHashCode();
            hashCode = hashCode * -1521134295 + Schedule.GetHashCode();
            hashCode = hashCode * -1521134295 + Multiplier.GetHashCode();
            if (Effect != null)
            {
                hashCode = hashCode * -1521134295 + Effect.GetHashCode();
            }
            return(hashCode);
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Получить значение параметра преведенное к нужному множителю
 /// </summary>
 /// <param name="mt"></param>
 /// <returns></returns>
 public object GetValue(Multiplier mt)
 {
     if ((int)mt == (int)this.multiplier | this.Value == null)
     {
         return(this.Value);
     }
     if (this.Value is Double)
     {
         return(this.Value != null ? (double)((double)this.Value * (int)this.multiplier) / (int)mt : (double?)null);
     }
     if (this.Value is int)
     {
         return(this.Value != null ? (int)((int)this.Value * (int)this.multiplier) / (int)mt : (int?)null);
     }
     return(this.Value);
 }
Ejemplo n.º 32
0
    static void Main()
    {
        double[] a = { 0.0, 0.5, 1.0 };
        double[] squares = Apply(a, Square);

        double[] sines = Apply(a, Math.Sin);

        Multiplier m = new Multiplier(2.0);

        double[] doubles1 = Apply(a, m.Multiply);
        double[] doubles2 = Apply(a, (double x) => x * 2.0);

        foreach (var v in doubles1)
        {
          Console.WriteLine("value = " + v.ToString());
        }
    }
Ejemplo n.º 33
0
        /// <summary>
        /// This constructor attempts to construct a Unit object with the same long or short name as the given string.
        /// (ie it will parse strings like "mHz", "microvolts", "gigaunity", "M", "ks"). The constructor is case sensitive.
        /// If no matching unit type is found, the constructor throws an exception.
        /// </summary>
        /// <param name="unitString"></param>
        public Units(string unitString)
        {
            Units testUnit = new Units();
            foreach (Dimension dim in Dimension.allDimensions)
                foreach (Multiplier mul in Multiplier.allMultipliers)
                {
                    testUnit.myDimension = dim;
                    testUnit.myMultiplier = mul;
                    if ((unitString == testUnit.ToString()) || (unitString == testUnit.toLongString()))
                    {
                        myDimension = dim;
                        myMultiplier = mul;
                        return;
                    }
                }

            throw new Exception("Unrecognized Unit type " + unitString + " passed to Units(string unitString) constructor.");
        }
Ejemplo n.º 34
0
 public Units(Dimension dimension, Multiplier multiplier)
     : this()
 {
     this.dimension = dimension;
     this.multiplier = multiplier;
 }
Ejemplo n.º 35
0
    public static StatEffect TranslateMultiplayerToStat(Multiplier multi)
    {
        StatEffect stat;

        if (multi == Multiplier.Defense) { stat = StatEffect.Defense; }
        else if (multi == Multiplier.Offense) { stat = StatEffect.Offense; }
        else if (multi == Multiplier.Sense) { stat = StatEffect.Sense; }
        else if (multi == Multiplier.Sneak) { stat = StatEffect.Sneak; }
        else { stat = StatEffect.Speed; }

        return stat;
    }
    public void AddMultiplier(Multiplier _eMultiplierToAdd)
    {
        Multipliers.Add(_eMultiplierToAdd);

        UpdateMultiplierText();
    }
 public void RemoveMultiplier(Multiplier _eMultiplierToRemove)
 {
     Multipliers.Remove(_eMultiplierToRemove);
     UpdateMultiplierText();
 }