Example #1
0
        public NavSettings(Navigator owner)
        {
            this.myNav       = owner;
            isAMissile       = false;
            waitUntil        = DateTime.UtcNow;
            waitUntilNoCheck = DateTime.UtcNow;
            //searchBlockName = null;
            lockOnTarget     = TARGET.OFF;
            lockOnRangeEnemy = 0;
            lockOnBlock      = null;
            tempBlockName    = null;
            //noWayForward = false;
            speedCruise_internal = Settings.floatSettings[Settings.FloatSetName.fMaxSpeed];
            speedSlow_internal   = Settings.floatSettings[Settings.FloatSetName.fMaxSpeed];

            // private vars
            myWaypoint       = null;
            coordDestination = null;
            CurrentGridDest  = null;

            startOfCommands();             // for consistency

            if (myNav != null && myNav.myGrid != null)
            {
                myLogger = new Logger(myNav.myGrid.DisplayName, "NavSettings");
            }
        }
Example #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (END == true)
        {
            return;
        }

        if (other.gameObject.GetComponent <TeamObject>().TEAM_TYPE != casterCharacterTeam &&
            TEMP_OFF == false)
        {
            GameObject colObject   = other.gameObject;
            BaseObject actorObject = colObject.GetComponent <BaseObject>();

            TeamObject Target = other.gameObject.GetComponent <TeamObject>();
            casterActor.ThrowEvent(ConstValue.ActorData_SetTarget, Target);

            //스킬이 생성될 때 타켓을 정해주는데, throw이벤트로 타겟을 정해주는 것은 그 후임.
            SkillManager.Instance.makeSkill.TARGET = SkillManager.Instance.makeSkill.OWNER.GetData(ConstValue.ActorData_GetTarget) as BaseObject;


            if (actorObject != TARGET)
            {
                return;
            }

            TARGET.ThrowEvent(ConstValue.EventKey_Hit,
                              OWNER.GetData(ConstValue.ActorData_Character),
                              SKILL_TEMPLATE, casterActor.CUR_BUFF, casterActor.transform.rotation);
        }
    }
Example #3
0
 public Skillette(TARGET _target, float[] _dScale, StatusEffect[] _debuffs, StatusEffect[] _buffs)
 {
     target        = _target;
     damageScaling = _dScale;
     debuffs       = _debuffs;
     buffs         = _buffs;
 }
 public EffectSplash(Effect iEffect, float iRange, TARGET iTarget, bool iDestroy = false)
 {
     _effect        = iEffect;
     _range         = iRange;
     _target        = iTarget;
     _destroySource = iDestroy;
 }
Example #5
0
        public void testFlatHazardRate()
        {
            // Testing flat hazard rate...

            double         hazardRate      = 0.0100;
            Handle <Quote> hazardRateQuote = new Handle <Quote>(new SimpleQuote(hazardRate));
            DayCounter     dayCounter      = new Actual360();
            Calendar       calendar        = new TARGET();
            int            n = 20;

            double tolerance = 1.0e-10;
            Date   today     = Settings.evaluationDate();
            Date   startDate = today;
            Date   endDate   = startDate;

            FlatHazardRate flatHazardRate = new FlatHazardRate(today, hazardRateQuote, dayCounter);

            for (int i = 0; i < n; i++)
            {
                endDate = calendar.advance(endDate, 1, TimeUnit.Years);
                double t                   = dayCounter.yearFraction(startDate, endDate);
                double probability         = 1.0 - Math.Exp(-hazardRate * t);
                double computedProbability = flatHazardRate.defaultProbability(t);

                if (Math.Abs(probability - computedProbability) > tolerance)
                {
                    QAssert.Fail("Failed to reproduce probability for flat hazard rate\n"
                                 + "    calculated probability: " + computedProbability + "\n"
                                 + "    expected probability:   " + probability);
                }
            }
        }
Example #6
0
        public void testCashedValues()
        {
            Date     startDate = new Date(01, 03, 2007);
            Period   period    = new Period(360, TimeUnit.Months);
            Calendar calendar  = new TARGET();
            Date     endDate   = calendar.advance(startDate, period, BusinessDayConvention.Unadjusted);

            Schedule schedule = new Schedule(startDate, endDate, new Period(1, TimeUnit.Months), calendar,
                                             BusinessDayConvention.Unadjusted,
                                             BusinessDayConvention.Unadjusted,
                                             DateGeneration.Rule.Backward, false);

            // PSA 100%
            PSACurve psa100 = new PSACurve(startDate);

            double[] listCPR = { 0.2000, 0.4000, 0.6000, 0.8000, 1.0000, 1.2000, 1.4000, 1.6000, 1.8000, 2.0000, 2.2000, 2.4000, 2.6000, 2.8000,
                                 3.0000, 3.2000, 3.4000, 3.6000, 3.8000, 4.0000, 4.2000, 4.4000, 4.6000, 4.8000, 5.0000, 5.2000, 5.4000, 5.6000,
                                 5.8000, 6.0000 };

            for (int i = 0; i < schedule.Count; i++)
            {
                if (i <= 29)
                {
                    QAssert.AreEqual(listCPR[i], psa100.getCPR(schedule[i]) * 100, 0.001);
                }
                else
                {
                    QAssert.AreEqual(6.0000, psa100.getCPR(schedule[i]) * 100);
                }
            }
        }
Example #7
0
        public void testFairRate()
        {
            Calendar calendar = new TARGET();

            Date settlementDate = new Date(10, Month.Mar, 2010);

            /*********************
             * LOAN TO BE PRICED *
             **********************/

            // constant nominal 1,000,000 Euro
            double nominal = 1000000.0;
            // fixed leg
            Frequency             fixedLegFrequency      = Frequency.Monthly;
            BusinessDayConvention fixedLegConvention     = BusinessDayConvention.Unadjusted;
            BusinessDayConvention principalLegConvention = BusinessDayConvention.ModifiedFollowing;
            DayCounter            fixedLegDayCounter     = new Thirty360(Thirty360.Thirty360Convention.European);
            double fixedRate = 0.04;

            // Principal leg
            Frequency pricipalLegFrequency = Frequency.Annual;

            int lenghtInMonths = 3;

            Loan.Type loanType = Loan.Type.Payer;

            Date     maturity      = settlementDate + new Period(lenghtInMonths, TimeUnit.Years);
            Schedule fixedSchedule = new Schedule(settlementDate, maturity, new Period(fixedLegFrequency),
                                                  calendar, fixedLegConvention, fixedLegConvention, DateGeneration.Rule.Forward, false);
            Schedule principalSchedule = new Schedule(settlementDate, maturity, new Period(pricipalLegFrequency),
                                                      calendar, principalLegConvention, principalLegConvention, DateGeneration.Rule.Forward, false);
            Loan testLoan = new FixedLoan(loanType, nominal, fixedSchedule, fixedRate, fixedLegDayCounter,
                                          principalSchedule, principalLegConvention);
        }
Example #8
0
        public void testFdImpliedVol()
        {
            var settlementDate = new Date(26, 2, 2015);

            Settings.setEvaluationDate(settlementDate);

            var calendar   = new TARGET();
            var dayCounter = new Actual365Fixed();

            const double volatility        = 0.5;
            var          underlyingQuote   = new Handle <Quote>(new SimpleQuote(3227));
            var          flatTermStructure = new Handle <YieldTermStructure>(new FlatForward(settlementDate, 0.05, dayCounter));
            var          flatDividendYield = new Handle <YieldTermStructure>(new FlatForward(settlementDate, 0, dayCounter));
            var          flatVolatility    = new Handle <BlackVolTermStructure>(new BlackConstantVol(settlementDate, calendar, volatility, dayCounter));
            var          process           = new BlackScholesMertonProcess(underlyingQuote, flatDividendYield, flatTermStructure, flatVolatility);
            var          exercise          = new AmericanExercise(new Date(1, 12, 2015));
            var          pricingEngine     = new FDDividendAmericanEngine(process);
            var          payoff            = new PlainVanillaPayoff(Option.Type.Put, 3200);
            var          dividendDates     = new[] { new Date(1, 3, 2015) };
            var          dividendAmounts   = new[] { 10d };
            var          option            = new DividendVanillaOption(payoff, exercise, dividendDates.ToList(), dividendAmounts.ToList());

            option.setPricingEngine(pricingEngine);

            var npv        = option.NPV();
            var impliedVol = option.impliedVolatility(npv, process);

            const double tolerance = 3.0e-3;

            if (Math.Abs(impliedVol - volatility) > tolerance)
            {
                QAssert.Fail(string.Format("Implied volatility calculation failed. Expected {0}. Actual {1}", volatility, impliedVol));
            }
        }
Example #9
0
    private void OnTriggerEnter(Collider other)
    {
        if (END == true)
        {
            return;
        }
        if (bFire == false)
        {
            return;
        }

        Actor casterActor = OWNER.GetData(ConstValue.ActorData_GetThisActor) as Actor;

        GameObject colObject   = other.gameObject;
        BaseObject actorObject = colObject.GetComponent <BaseObject>();

        if (actorObject != TARGET)
        {
            return;
        }

        TARGET.ThrowEvent(ConstValue.EventKey_Hit,
                          OWNER.GetData(ConstValue.ActorData_Character),
                          SKILL_TEMPLATE, casterActor.CUR_BUFF, casterActor.transform.rotation);
        END = true;
    }
        private void DrawPrefabs(TARGET tgt, int index)
        {
            var rectA   = Reserve();
            var rectB   = rectA; rectB.xMax -= 22.0f;
            var rectC   = rectA; rectC.xMin = rectC.xMax - 20.0f;
            var prefab  = tgt.Prefabs[index];
            var rebuilt = false;
            var expand  = EditorGUI.Foldout(new Rect(rectA.x, rectA.y, 20, rectA.height), expandPrefab == index, "");

            if (expand == true)
            {
                expandPrefab = index;
            }
            else if (expandPrefab == index)
            {
                expandPrefab = -1;
            }

            BeginDisabled(true);
            BeginError(prefab.Root == null);
            EditorGUI.ObjectField(rectB, prefab.Root, typeof(Object), false);
            EndError();
            if (prefab.Root != null)
            {
                Undo.RecordObject(tgt, "Rebuild Sources");

                rebuilt |= prefab.RebuildSources();

                if (expand == true)
                {
                    var sources = prefab.Sources;

                    BeginIndent();
                    foreach (var source in sources)
                    {
                        EditorGUI.ObjectField(Reserve(), source, typeof(LeanSource), false);
                    }
                    EndIndent();
                }
            }
            EndDisabled();
            if (rebuilt == true)
            {
                DirtyAndUpdate();
            }
            if (GUI.Button(rectC, "X", EditorStyles.miniButton) == true)
            {
                Undo.RecordObject(tgt, "Remove Prefab");

                tgt.Prefabs.RemoveAt(index);

                DirtyAndUpdate();

                if (expand == true)
                {
                    expandPrefab = -1;
                }
            }
        }
        private void AddLanguage(TARGET tgt, PresetLanguage presetLanguage)
        {
            Undo.RecordObject(tgt, "Add Language");

            tgt.AddLanguage(presetLanguage.Name);

            DirtyAndUpdate();
        }
Example #12
0
 protected static bool validateTarget(TARGET iType, Entity iTarget)
 {
     if (iType == TARGET.RUNNER && iTarget is Runner ||
         iType == TARGET.TOWER && iTarget is Tower)
     {
         return(true);
     }
     return(false);
 }
Example #13
0
        /// <summary>
        /// Opens the registry key.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <returns>Registry key</returns>
        public static RegistryKey OpenRegistryKey(TARGET target)
        {
            switch (target)
            {
            case TARGET.MACHINE: return(Registry.LocalMachine.OpenSubKey(FOLDER, true));

            default: return(Registry.CurrentUser.OpenSubKey(FOLDER, true));
            }
        }
Example #14
0
 public virtual int GetHit(TARGET att, Label A, TextBox B)
 {
     if (att == Blocked)
     {
         return(Block(A, B));
     }
     else
     {
         return(Wound(A, B));
     }
 }
Example #15
0
        public void testFDDividendAmericanEngine()
        {
            /*
             * Valuation date: 20 July 2018
             * Maturity date: 17 Aug 2018
             * Type: Call
             * Spot: 2900
             * Strike: 2800
             * Volatility: 20 %
             * Interest rate: 0 %
             *
             * Dividend(paid one day before expiry)
             * Date: 16 Aug 2018
             * Value: 40
             *
             * NPV = 124.37658
             */
            var result         = 124.37658;
            var settlementDate = new Date(20, 7, 2018);

            Settings.setEvaluationDate(settlementDate);

            var calendar   = new TARGET();
            var dayCounter = new Actual365Fixed();

            var spot  = new Handle <Quote>(new SimpleQuote(2900));
            var qRate = new Handle <Quote>(new SimpleQuote(0.0));
            var rRate = new Handle <Quote>(new SimpleQuote(0.0));
            var vol   = new Handle <Quote>(new SimpleQuote(0.2));

            var flatDividendYield = new Handle <YieldTermStructure>(new FlatForward(settlementDate, qRate, dayCounter));
            var flatTermStructure = new Handle <YieldTermStructure>(new FlatForward(settlementDate, rRate, dayCounter));
            var flatVolatility    = new Handle <BlackVolTermStructure>(new BlackConstantVol(settlementDate, calendar, vol, dayCounter));
            var process           = new BlackScholesMertonProcess(spot, flatDividendYield, flatTermStructure, flatVolatility);
            var exercise          = new AmericanExercise(new Date(17, 8, 2018));
            var pricingEngine     = new FDDividendAmericanEngine(process);
            var payoff            = new PlainVanillaPayoff(Option.Type.Call, 2800);
            var dividendDates     = new[] { new Date(16, 8, 2018) };
            var dividendAmounts   = new[] { 40d };
            var option            = new DividendVanillaOption(payoff, exercise, dividendDates.ToList(), dividendAmounts.ToList());

            option.setPricingEngine(pricingEngine);

            var npv = option.NPV();

            const double tolerance = 1.0e-5;

            if (Math.Abs(npv - result) > tolerance)
            {
                QAssert.Fail(string.Format("NPV calculation failed. Expected {0}. Actual {1}", result, npv));
            }
        }
Example #16
0
        //double fixedRate = 0.001;
        //double notional = 10000.0;
        //double recoveryRate = 0.4;

        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Calculates the cds. </summary>
        ///
        /// <param name="msg">          [in,out] The message. </param>
        /// <param name="fixedRate">    The fixed rate. </param>
        /// <param name="notional">     The notional. </param>
        /// <param name="recoveryRate"> The recovery rate. </param>
        ///
        /// <returns>   True if it succeeds, false if it fails. </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public bool CalcCDS(ref CreditDefaultSwapRequestMessage msg, double fixedRate, double notional, double recoveryRate)
        {
            // Testing fair-spread calculation for credit-default swaps...
            using (SavedSettings backup = new SavedSettings())
            {
                // Initialize curves
                Calendar calendar = new TARGET();
                Date     today    = calendar.adjust(Date.Today);
                Settings.setEvaluationDate(today);

                Handle <Quote> hazardRate = new Handle <Quote>(new SimpleQuote(0.01234));
                RelinkableHandle <DefaultProbabilityTermStructure> probabilityCurve =
                    new RelinkableHandle <DefaultProbabilityTermStructure>();
                probabilityCurve.linkTo(new FlatHazardRate(0, calendar, hazardRate, new Actual360()));

                RelinkableHandle <YieldTermStructure> discountCurve =
                    new RelinkableHandle <YieldTermStructure>();
                discountCurve.linkTo(new FlatForward(today, 0.06, new Actual360()));

                // Build the schedule
                Date issueDate = calendar.advance(today, -1, TimeUnit.Years);
                Date maturity  = calendar.advance(issueDate, 10, TimeUnit.Years);
                BusinessDayConvention convention = BusinessDayConvention.Following;

                Schedule schedule = new MakeSchedule().from(issueDate)
                                    .to(maturity)
                                    .withFrequency(Frequency.Quarterly)
                                    .withCalendar(calendar)
                                    .withTerminationDateConvention(convention)
                                    .withRule(DateGeneration.Rule.TwentiethIMM).value();

                // Build the CDS
                DayCounter dayCount = new Actual360();

                IPricingEngine    engine = new MidPointCdsEngine(probabilityCurve, recoveryRate, discountCurve);
                CreditDefaultSwap cds    = new CreditDefaultSwap(Protection.Side.Seller, notional, fixedRate,
                                                                 schedule, convention, dayCount, true, true);
                cds.setPricingEngine(engine);
                double            fairRate = cds.fairSpread();
                CreditDefaultSwap fairCds  = new CreditDefaultSwap(Protection.Side.Seller, notional, fairRate,
                                                                   schedule, convention, dayCount, true, true);
                fairCds.setPricingEngine(engine);

                double fairNPV   = fairCds.NPV();
                double tolerance = 1e-10;

                msg.fairRate = fairRate;
                msg.fairNPV  = fairNPV;
                return(Math.Abs(fairNPV) <= tolerance);
            }
        }
Example #17
0
        /// <summary>
        /// Remove by autorun name
        /// </summary>
        /// <param name="name"> Autorun name (Which you used in add as 1st arg) </param>
        /// <param name="target"> The target </param>
        /// <returns> Is removed </returns>
        public static bool Remove(string name, TARGET target)
        {
            var key = OpenRegistryKey(target);

            try
            {
                key.DeleteValue(name, true);
            }
            catch (Exception e)
            {
                throw new AutorunException(e.Message);
            }
            return(true);
        }
Example #18
0
        /// <summary>
        /// Adds the specified name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="exePath">The executable path.</param>
        /// <param name="target">The target.</param>
        /// <returns>Is added.</returns>
        /// <exception cref="AutorunException"></exception>
        public static bool Add(string name, string exePath, TARGET target)
        {
            RegistryKey key = OpenRegistryKey(target);

            try
            {
                key.SetValue(name, exePath);
            }
            catch (Exception e)
            {
                throw new AutorunException(e.Message);
            }
            return(true);
        }
Example #19
0
        private void DrawState(TARGET tgt, TARGET[] tgts)
        {
            var state = tgt.State;

            EditorGUI.BeginChangeCheck();

            EditorGUI.showMixedValue = Any(tgts, t => t.State != state);
            state = EditorGUILayout.IntSlider("State", state, 0, tgt.States.Count - 1);
            EditorGUI.showMixedValue = false;

            if (EditorGUI.EndChangeCheck() == true)
            {
                Each(tgts, t => t.State = state);
            }
        }
Example #20
0
        private void DrawAutoFill(TARGET tgt, System.Reflection.FieldInfo data)
        {
            var state = data.GetValue(tgt) as LeanState;

            if (state != null && state.CanFill > -1)
            {
                var rect = Reserve();

                BeginDisabled(state.CanFill == 0);
                if (GUI.Button(rect, new GUIContent("auto fill", "Copy the current value from the scene into this component?"), EditorStyles.miniButton) == true)
                {
                    state.Fill();
                }
                EndDisabled();
            }
        }
Example #21
0
        private void DrawIconBuilder(TARGET tgt)
        {
            size = EditorGUILayout.IntField("Size", size);

            Info("To build an icon I recommend you open the 'Icon Builder (Material)' demo scene, paint the sphere, and then click the button below.");

            Separator();

            if (GUILayout.Button("Build Icon") == true)
            {
                var path      = System.IO.Path.ChangeExtension(PrefabStageUtility.GetPrefabStage(tgt.gameObject).prefabAssetPath, "png");
                var target    = new RenderTexture(size, size, 32, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
                var buffer    = new Texture2D(size, size, TextureFormat.ARGB32, false);
                var oldActive = RenderTexture.active;
                var oldTarget = Camera.main.targetTexture;

                Camera.main.targetTexture = target;
                Camera.main.Render();
                Camera.main.targetTexture = oldTarget;

                RenderTexture.active = target;
                buffer.ReadPixels(new Rect(0, 0, size, size), 0, 0, false);
                buffer.Apply();
                RenderTexture.active = oldActive;

                System.IO.File.WriteAllBytes(path, buffer.EncodeToPNG());

                DestroyImmediate(target);
                DestroyImmediate(buffer);

                AssetDatabase.ImportAsset(path);

                var importer = (TextureImporter)AssetImporter.GetAtPath(path);

                importer.filterMode          = FilterMode.Trilinear;
                importer.anisoLevel          = 8;
                importer.textureCompression  = TextureImporterCompression.Uncompressed;
                importer.alphaIsTransparency = true;

                importer.SaveAndReimport();

                tgt.Icon = AssetDatabase.LoadAssetAtPath <Texture2D>(path);

                EditorSceneManager.MarkSceneDirty(tgt.gameObject.scene);
            }
        }
Example #22
0
    public void SetDot()
    {
        Dice tmp = GetComponentInParent <Dice>();

        image = GetComponent <Image>();
        type  = tmp.TYPE;
        //attack, attackSpeed 초기화
        switch (type)
        {
        case DICETYPE.FIRE:
            target      = TARGET.FRONT;
            attack      = FindObjectOfType <GameController>().diceattacks[0];
            attackSpeed = 0.8f;
            image.color = new Color(255, 0, 0, 255);
            break;

        case DICETYPE.METAL:
            target      = TARGET.HEALTH;
            attack      = FindObjectOfType <GameController>().diceattacks[1];
            attackSpeed = 1f;
            image.color = new Color(0, 0, 0, 255);
            break;

        case DICETYPE.POISON:
            target      = TARGET.RANDOM;
            attack      = FindObjectOfType <GameController>().diceattacks[2];
            attackSpeed = 1.3f;
            image.color = new Color(0, 255, 0, 255);
            break;

        case DICETYPE.THUNDER:
            target      = TARGET.FRONT;
            attack      = FindObjectOfType <GameController>().diceattacks[3];
            attackSpeed = 0.8f;
            image.color = new Color(185, 185, 0, 255);
            break;

        case DICETYPE.WIND:
            target      = TARGET.FRONT;
            attack      = FindObjectOfType <GameController>().diceattacks[4];
            attackSpeed = 0.45f;
            image.color = new Color(0, 230, 255, 255);
            break;
        }
    }
Example #23
0
        public void testAccessViolation()
        {
            // Testing dynamic cast of coupon in Black pricer...

            SavedSettings backup = new SavedSettings();

            Date todaysDate     = new Date(7, Month.April, 2010);
            Date settlementDate = new Date(9, Month.April, 2010);

            Settings.setEvaluationDate(todaysDate);
            Calendar calendar = new TARGET();

            Handle <YieldTermStructure> rhTermStructure = new Handle <YieldTermStructure>(
                Utilities.flatRate(settlementDate, 0.04875825, new Actual365Fixed()));

            double volatility = 0.10;
            Handle <OptionletVolatilityStructure> vol = new Handle <OptionletVolatilityStructure>(
                new ConstantOptionletVolatility(2,
                                                calendar,
                                                BusinessDayConvention.ModifiedFollowing,
                                                volatility,
                                                new Actual365Fixed()));

            IborIndex index3m = new USDLibor(new Period(3, TimeUnit.Months), rhTermStructure);

            Date               payDate   = new Date(20, Month.December, 2013);
            Date               startDate = new Date(20, Month.September, 2013);
            Date               endDate   = new Date(20, Month.December, 2013);
            double             spread    = 0.0115;
            IborCouponPricer   pricer    = new BlackIborCouponPricer(vol);
            FloatingRateCoupon coupon    = new FloatingRateCoupon(100, payDate, startDate, endDate, 2,
                                                                  index3m, 1.0, spread / 100);

            coupon.setPricer(pricer);

            try
            {
                // this caused an access violation in version 1.0
                coupon.amount();
            }
            catch (Exception)
            {
                // ok; proper exception thrown
            }
        }
Example #24
0
        public BbData Pre(PlotCollection dataset)
        {
            m_caVal    = new CalculationArray((int)m_config.Interval);
            m_caValExt = new CalculationArray((int)m_config.Interval);
            PlotCollection dataSrc = dataset;
            PlotCollection dataDst = new PlotCollection(dataSrc.Name + " BB" + m_config.Interval.ToString());

            if (m_config.GetExtraSetting("BbTarget:BarRange", 0) == 1)
            {
                m_target = TARGET.BAR;
            }
            else if (m_config.GetExtraSetting("BbTarget:TotalRange", 0) == 1)
            {
                m_target = TARGET.RANGE;
            }

            return(new BbData(dataSrc, dataDst, m_config.Interval));
        }
Example #25
0
        /// <summary>
        /// Copy on parameter to another.
        /// </summary>
        /// <param name="src">Specifies the parameter to copy.</param>
        public override void Copy(LayerParameterBase src)
        {
            DecodeParameter p = (DecodeParameter)src;

            m_nCentroidOutputIteration = p.m_nCentroidOutputIteration;
            m_nCacheSize              = p.m_nCacheSize;
            m_bOutputCentroids        = p.m_bOutputCentroids;
            m_dfPreGenAlpha           = p.m_dfPreGenAlpha;
            m_nPreGenerateTargetCount = p.m_nPreGenerateTargetCount;
            m_bEnableCentroidUpdate   = p.m_bEnableCentroidUpdate;

            if (p.m_rgIgnoreLabels != null)
            {
                m_rgIgnoreLabels = Utility.Clone <int>(p.m_rgIgnoreLabels);
            }

            m_target = p.m_target;
            m_nK     = p.m_nK;
        }
Example #26
0
    private void OnTriggerEnter(Collider other)
    {
        if (END == true)
        {
            return;
        }

        if (other.gameObject.tag != "Obstacle")
        {
            if (other.gameObject.GetComponent <Actor>().TEMPLATE_KEY == "ENEMY_1")
            {
                other.gameObject.GetComponent <NonPlayer>().AI.IS_SKILL = false;
            }
        }

        if (other.gameObject.GetComponent <TeamObject>().TEAM_TYPE != casterCharacterTeam ||
            (bGiantEnemy &&
             other.gameObject.GetComponent <Actor>() != casterActor))
        {
            GameObject colObject   = other.gameObject;
            BaseObject actorObject = colObject.GetComponent <BaseObject>();

            TeamObject Target = other.gameObject.GetComponent <TeamObject>();
            casterActor.ThrowEvent(ConstValue.ActorData_SetTarget, Target);

            //스킬이 생성될 때 타켓을 정해주는데, throw이벤트로 타겟을 정해주는 것은 그 후임.
            SkillManager.Instance.makeSkill.TARGET = SkillManager.Instance.makeSkill.OWNER.GetData(ConstValue.ActorData_GetTarget) as BaseObject;


            if (actorObject != TARGET)
            {
                return;
            }


            //Destroy(other.gameObject);

            TARGET.ThrowEvent(ConstValue.EventKey_Hit,
                              OWNER.GetData(ConstValue.ActorData_Character),
                              SKILL_TEMPLATE, casterActor.CUR_BUFF, casterActor.transform.rotation);
        }
    }
Example #27
0
        private static string _CreateBaseMessage(TARGET target, String message)
        {
            if (target == null)
            {
                return(message);
            }

            var targetTypeInfo = target.GetType().GetTypeInfo();

            var logicalIndexProp = targetTypeInfo.GetProperty("LogicalIndex");

            var logicalIndex = logicalIndexProp != null ? (int)logicalIndexProp.GetValue(target) : -1;

            if (logicalIndex >= 0)
            {
                return($"{targetTypeInfo.Name}[{logicalIndex}] {message}");
            }

            return($"{targetTypeInfo.Name} {message}");
        }
Example #28
0
        private void DrawMap(TARGET tgt)
        {
            var inputManagers = AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset");

            if (inputManagers != null && inputManagers.Length > 0)
            {
                var inputManager = new SerializedObject(inputManagers[0]);
                var axes         = inputManager.FindProperty("m_Axes");

                if (axes != null)
                {
                    var axis = FindAxis(axes, tgt.AxisName);

                    if (axis == null)
                    {
                        Warning("This axis hasn't been mapped to your Project Settings yet, so you will not be able to use it.");
                    }

                    if (Button(axis == null ? "Create Input Axis" : "Update Input Axis") == true)
                    {
                        if (axis == null)
                        {
                            var index = axes.arraySize;

                            axes.InsertArrayElementAtIndex(index);

                            axis = axes.GetArrayElementAtIndex(index);
                        }

                        axis.FindPropertyRelative("m_Name").stringValue     = tgt.AxisName;
                        axis.FindPropertyRelative("axis").intValue          = tgt.AxisIndex;
                        axis.FindPropertyRelative("type").intValue          = 2;                // Axis
                        axis.FindPropertyRelative("gravity").floatValue     = 0;
                        axis.FindPropertyRelative("sensitivity").floatValue = 1;

                        inputManager.ApplyModifiedProperties();
                    }
                }
            }
        }
Example #29
0
        static void Main(string[] args)
        {
            Calendar calendar = new TARGET();

            Date todaysDate     = new Date(22, 7, 2014);
            Date settlementDate = new Date(3, 6, 2014);

            Settings.setEvaluationDate(todaysDate);

            DayCounter dayCounter    = new Actual365Fixed();
            double     dividendYield = 0.0117;
            double     volatility    = 0.15517;

            Barrier.Type             type   = Barrier.Type.UpOut;
            QLNet.PlainVanillaPayoff payoff = new PlainVanillaPayoff(Option.Type.Call, 261.4);
            QLNet.EuropeanExercise   ex     = new EuropeanExercise(new Date(30, 11, 2015));

            //QLNet.BarrierOption barrierOption = new BarrierOption(type, 1.2,1.0, 0.0, payoff, ex);
            //QLNet.BarrierOption barrierOption = new BarrierOption(type, 313.68, 0.0, payoff, ex);
            QLNet.BarrierOption barrierOption = new BarrierOption(type, 313.68, 0.32, 0.0, payoff, ex);

            double underlying   = 262.86;
            double riskFreeRate = 0.0243;

            Handle <Quote> underlyingH = new Handle <Quote>(new SimpleQuote(underlying));

            // bootstrap the yield/dividend/vol curves
            var flatTermStructure = new Handle <YieldTermStructure>(new FlatForward(settlementDate, riskFreeRate, dayCounter));
            var flatDividendTS    = new Handle <YieldTermStructure>(new FlatForward(settlementDate, dividendYield, dayCounter));
            var flatVolTS         = new Handle <BlackVolTermStructure>(new BlackConstantVol(settlementDate, calendar, volatility, dayCounter));
            var bsmProcess        = new BlackScholesMertonProcess(underlyingH, flatDividendTS, flatTermStructure, flatVolTS);

            QLNet.AnalyticBarrierWithPartiRateEngine engine = new AnalyticBarrierWithPartiRateEngine(bsmProcess);
            barrierOption.setPricingEngine(engine);

            double kk = barrierOption.NPV();

            Console.WriteLine(kk);
            Console.WriteLine(kk / 261.4);
        }
Example #30
0
        public void testSingleInstrumentBootstrap()
        {
            //Testing single-instrument curve bootstrap...

            Calendar calendar = new TARGET();

            Date today = Settings.Instance.evaluationDate();

            int settlementDays = 0;

            double quote = 0.005;
            Period tenor = new Period(2, TimeUnit.Years);

            Frequency             frequency  = Frequency.Quarterly;
            BusinessDayConvention convention = BusinessDayConvention.Following;

            DateGeneration.Rule rule       = DateGeneration.Rule.TwentiethIMM;
            DayCounter          dayCounter = new Thirty360();
            double recoveryRate            = 0.4;

            RelinkableHandle <YieldTermStructure> discountCurve = new RelinkableHandle <YieldTermStructure>();

            discountCurve.linkTo(new FlatForward(today, 0.06, new Actual360()));

            List <CdsHelper> helpers = new List <CdsHelper>();

            helpers.Add(
                new SpreadCdsHelper(quote, tenor,
                                    settlementDays, calendar,
                                    frequency, convention, rule,
                                    dayCounter, recoveryRate,
                                    discountCurve));

            PiecewiseDefaultCurve <HazardRate, BackwardFlat> defaultCurve = new PiecewiseDefaultCurve <HazardRate, BackwardFlat>(today, helpers,
                                                                                                                                 dayCounter);

            defaultCurve.recalculate();
        }
Example #31
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TARGET obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Example #32
0
        public IroncladAppVerb(SourcePath dfyroot, TARGET target, DafnyCCVerb.FramePointerMode framePointerMode, VerificationRequest verificationRequest)
        {
            this.dfyroot = dfyroot;

            // TODO this is the only #define we support just yet, so I'm stuffing it in here.
            // We'll need to plumb more carefully when we want to add x64.
            if (dfyroot.getDirPath().Split(Path.DirectorySeparatorChar).Last().Equals("AppLoader"))
            {
                this.poundDefines = new PoundDefines(new string[] { "AppLoader" });
            }
            else
            {
                this.poundDefines = PoundDefines.empty();
            }

            this.verificationRequest = verificationRequest;
            this.abstractId = new AbstractId(
                this.GetType().Name,
                version,
                dfyroot.ToString(),
                this.poundDefines,
                concrete: string.Format(
                    "{0},{1},{2}",
                    target,
                    framePointerMode.ToString(),
                    verificationRequest.ToString()));
            this.appLabel = dfyroot.getDirPath().Split(Path.DirectorySeparatorChar).Last();
            this.dafnyspecVerb = new DafnySpecVerb(dfyroot, this.appLabel);
            this.dafnyccVerb = new DafnyCCVerb(dfyroot, this.appLabel, framePointerMode);

            bool isLoader = dfyroot.getRelativePath().Equals(BootableAppVerb.LOADER_DFY);

            // NB we keep dafnyccVerb as the lowest-priority context, so that our hand-written
            // beat impls will override its output.
            IContextGeneratingVerb contextWithDafny = new ConcatContextVerb(
                BuildEngine.theEngine.getVerveContextVerb(this.poundDefines),
                new VerbOutputsContextVerb(this.dafnyspecVerb, false),
                new VerbOutputsContextVerb(this.dafnyccVerb, true),
                this.poundDefines);
            this.stitcherVerb = new EntryStitcherVerb(contextWithDafny, this.appLabel);
            IContextGeneratingVerb contextWithDafnyAndEntry = new ConcatContextVerb(
                new VerbOutputsContextVerb(this.stitcherVerb, false),
                contextWithDafny,
                this.poundDefines);

            BuildObject entryImpObj = this.stitcherVerb.getEntryImpOutput();
            BoogieAsmLinkVerb entryVerb = new BoogieAsmLinkVerb(contextWithDafnyAndEntry, entryImpObj);
            if (target == TARGET.BARE_METAL)
            {
                MasmVerb masmVerb = new MasmVerb(entryVerb);
                this.linkerVerb = new LinkerVerb(masmVerb, isLoader);
            }
            else if (target == TARGET.WINDOWS)
            {     // Rewrite the asm that comes out of entryVerb before linking it
                AsmRewriterVerb rewriter = new AsmRewriterVerb(entryVerb);
                MasmVerb masmVerb = new MasmVerb(rewriter);
                this.linkerVerb = new WinLinkerVerb(masmVerb, isLoader);
            }

            BoogieAsmVerificationObligationListVerb bavolVerb =
                new BoogieAsmVerificationObligationListVerb(contextWithDafnyAndEntry, entryImpObj, verificationRequest);

            this.verifyResultsVerb = new VerificationResultSummaryVerb(bavolVerb);

            this.srcObject = this.linkerVerb.getUntrustedExe();
            if (verificationRequest.isComplete())
            {
                this.exeObject = dfyroot.makeOutputObject(TRUSTED_EXE_EXTN);
                this.outputObject = this.exeObject;
            }
            else
            {
                this.exeObject = this.srcObject;
                this.outputObject = dfyroot.makeVirtualObject(UNVERIFIED_SENTINEL_EXTENSION);
            }
        }