Esempio n. 1
0
 public void onCompleteAnimation(float waitTime, Monster.Callback callback = null)
 {
     _isEnabled = true;
     type       = TYPE.onCompleteAnimation1;
     _waitTime  = waitTime;
     _callback  = callback;
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="f"></param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        private static float simp(IFloat f, float a, float b, int n)
        {
            if (n < 3)
            {
                return(float.NaN);       //Need at least 3 points
            }
            float sum = 0.0f;
            float h   = (b - a) / n;

            if (n % 2 != 0)
            {
                for (int i = 0; i < n - 1; i += 2)
                {
                    sum += h * (f(a + i * h) + 4 * f(a + (i + 1) * h) + f(a + (i + 2) * h)) / 3;
                }
            }
            else
            {
                sum = 3 * h * (f(a) + 3 * f(a + h) + 3 * f(a + 2 * h) + f(a + 3 * h)) / 8;
                for (int i = 3; i < n - 1; i += 2)
                {
                    sum += h * (f(a + i * h) + 4 * f(a + (i + 1) * h) + f(a + (i + 2) * h)) / 3;
                }
            }
            return(sum);
        }
    public static void tryParse(string str, out IFloat value)
    {
        float temp = 0.0f;

        float.TryParse(str, out temp);
        value = temp;
    }
Esempio n. 4
0
        public bool SetWhiteBalanceBlue(double wbBlue)
        {
            bool result = false;

            try
            {
                //camera.BalanceRatioSelector.Value = BalanceRatioSelectorEnums.Blue.ToString();
                //camera.BalanceRatio.Value = wbBlue;
                //result = true;

                IEnum balanceWhiteAuto = nodeMap.GetNode <IEnum>("BalanceWhiteAuto");
                balanceWhiteAuto.Value = "Off";

                IEnum balanceRatioSelector = nodeMap.GetNode <IEnum>("BalanceRatioSelector");
                balanceRatioSelector.Value = "Blue";

                IFloat balanceRatio = nodeMap.GetNode <IFloat>("BalanceRatio");
                balanceRatio.Value = wbBlue;

                result = true;
            }
            catch (SpinnakerException ex)
            {
                Debug.WriteLine("Error: {0}", ex.Message);
                result = false;
            }


            return(result);
        }
Esempio n. 5
0
 public void changeWaitTime(IFloat value)
 {
     if (_isEnabled && _waitTime > 0)
     {
         _waitTime = _waitTime / value;
     }
 }
Esempio n. 6
0
        public override bool SetGain(float gainValue)
        {
            bool rect = false;

            try
            {
                IFloat iGainNode = m_NodeMap.GetNode <IFloat>("Gain");
                if (iGainNode == null || !iGainNode.IsWritable)
                {
                    LogHelper.AppLoger.Error("Unable to set gain. Aborting...");
                    return(rect);
                }

                // Ensure desired exposure time does not exceed the maximum
                iGainNode.Value = (gainValue > iGainNode.Max ? iGainNode.Max : gainValue);

                LogHelper.AppLoger.DebugFormat("Gain time set to {0} us...", iGainNode.Value);
                rect = true;
            }
            catch (Exception ex)
            {
                LogHelper.AppLoger.Error(ex);
            }
            return(rect);
        }
Esempio n. 7
0
        /// <summary>
        /// Returns the value of a derived function.
        /// </summary>
        /// <param name="function">Continuous function delegate</param>
        /// <param name="x">Argument value</param>
        /// <param name="h">Step</param>
        /// <param name="order">Order</param>
        /// <returns>float precision floating point number</returns>
        public float Compute(IFloat function, float x, float h, int order)
        {
            // exception
            if (order > this.points)
            {
                throw new Exception("The order of the derivative cannot be greater than the number of interpolation points");
            }
            if (order < 0)
            {
                throw new Exception("The derivative order cannot be less than 0");
            }

            // Create the interpolation points
            int length = this.points + 1;

            float[,] coefficients = Differentation.GetCoefficients(length);
            float sum = 0.0f;

            // do job
            for (int i = 0, center = 0; i < length; i++)
            {
                sum += coefficients[order, i] * function(x + center * h);
                center++;
            }

            // result
            return(sum / (float)Math.Pow(h, order));
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="f"></param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <param name="eps"></param>
        /// <returns></returns>
        private static float falpo(IFloat f, float a, float b, float eps = 1e-8f)
        {
            float x1 = a;
            float x2 = b;
            float fb = f(b);
            int   n  = 0;

            while (Math.Abs(x2 - x1) > eps && n < short.MaxValue)
            {
                float xpoint = x2 - (x2 - x1) * f(x2) / (f(x2) - f(x1));
                if (fb * f(xpoint) > 0)
                {
                    x2 = xpoint;
                }
                else
                {
                    x1 = xpoint;
                }
                if (Math.Abs(f(xpoint)) < eps)
                {
                    break;
                }
                n++;
            }
            return(x2 - (x2 - x1) * f(x2) / (f(x2) - f(x1)));
        }
Esempio n. 9
0
 public void checkDamageReflection(IFloat damageValue, Monster shooter = null, int attackerUniqueId = -1000)
 {
     if (shooter != null && shooter.stat.uniqueId == attackerUniqueId)
     {
         shooter.characterEffect.check35(damageValue);
     }
     else if (attackerUniqueId > -1)
     {
         if (isPlayerSide)
         {
             foreach (Monster mon in GameManager.me.characterManager.monsters)
             {
                 if (mon.isEnabled && mon.stat.uniqueId == attackerUniqueId)
                 {
                     mon.characterEffect.check35(damageValue);
                     return;
                 }
             }
         }
         else
         {
             foreach (Monster mon in GameManager.me.characterManager.playerMonster)
             {
                 if (mon.isEnabled && mon.stat.uniqueId == attackerUniqueId)
                 {
                     mon.characterEffect.check35(damageValue);
                     return;
                 }
             }
         }
     }
 }
Esempio n. 10
0
    public static IFloat Distance(IFloat v1x, IFloat v1y, IFloat v2x, IFloat v2y)
    {
        int dx = Mathf.FloorToInt(v2x - v1x);
        int dy = Mathf.FloorToInt(v2y - v1y);

        return(Mathf.Sqrt(dx * dx + dy * dy));
    }
Esempio n. 11
0
 public IQuaternion(Quaternion v)
 {
     x = v.x;
     y = v.y;
     z = v.z;
     w = v.w;
 }
Esempio n. 12
0
    public static IFloat lerpAngle(IFloat from, IFloat to, IFloat step)
    {
        IFloat num = MathUtil.Repeat(to - from, 360);

        if (num > 180)
        {
            num -= 360;
        }
        num = from + num * MathUtil.Clamp01(step);

        if (num < 0)
        {
            while (num < 0)
            {
                num = 360 + num;
            }
        }
        else if (num >= 360)
        {
            while (num >= 360)
            {
                num -= 360;
            }
        }

        return(num);
    }
Esempio n. 13
0
        //public float GetPropertyValue(PropertyType property, bool absolute, bool valueB = false)
        //{
        //    CameraProperty camProp = camera.GetProperty(property);

        //    return (absolute ? camProp.absValue : (!valueB ? camProp.valueA : camProp.valueB));
        //}
        public string GetPropertyValue(string property, bool valueB = false)
        {
            if (property == "Shutter")
            {
                IFloat node = nodeMap.GetNode <IFloat>("ExposureTime");
                return(node.Value.ToString());
            }
            else if (property == "DeviceTemperature")
            {
                IFloat node = nodeMap.GetNode <IFloat>("DeviceTemperature");
                return(node.Value.ToString());
            }
            else if (property == "WidthMax")
            {
                IInteger node = nodeMap.GetNode <IInteger>("WidthMax");
                return(node.Value.ToString());
            }
            else if (property == "HeightMax")
            {
                IInteger node = nodeMap.GetNode <IInteger>("HeightMax");
                return(node.Value.ToString());
            }
            else
            {
                IEnum node = nodeMap.GetNode <IEnum>(property);
                return(node.Value.ToString());
            }
        }
Esempio n. 14
0
    public static IFloat Atan2(IFloat F1, IFloat F2)
    {
        if (F2.Value == 0 && F1.Value == 0)
        {
            return((IFloat)0);
        }

        IFloat result = (IFloat)0;

        if (F2 > 0)
        {
            result = Atan(F1 / F2);
        }
        else if (F2 < 0)
        {
            if (F1 >= 0)
            {
                result = (PI - Atan(Abs(F1 / F2)));
            }
            else
            {
                result = (PI - Atan(Abs(F1 / F2))).Inverse;
            }
        }
        else
        {
            result = (F1 >= 0 ? PI : PI.Inverse) / IFloat.Create(2, true);
        }

        return(result);
    }
Esempio n. 15
0
    void checkSkillChargingTime()
    {
        //풀차징 시간 (ms) = 풀차징까지의 남은시간
//		Debug.Log("_nowSelectSkillSlot.chargingTimeLimit : " + _nowSelectSkillSlot.chargingTimeLimit);
//		Debug.Log("chargingTime : " + chargingTime);
        leftFullChargingTime = _nowSelectSkillSlot.chargingTimeLimit - chargingTime;
    }
Esempio n. 16
0
    public void init(IVector3 boundCenter, IVector3 boundExtens)
    {
        boundCenter.x = MathUtil.Round(boundCenter.x * 100.0f) / 100.0f;
        boundCenter.y = MathUtil.Round(boundCenter.y * 100.0f) / 100.0f;
        boundCenter.z = MathUtil.Round(boundCenter.z * 100.0f) / 100.0f;

        boundExtens.x = MathUtil.Round(boundExtens.x * 100.0f) / 100.0f;
        boundExtens.y = MathUtil.Round(boundExtens.y * 100.0f) / 100.0f;
        boundExtens.z = MathUtil.Round(boundExtens.z * 100.0f) / 100.0f;

        width  = boundExtens.x * 2.0f;
        height = boundExtens.y * 2.0f;
        depth  = boundExtens.z * 2.0f;

        _boundCenter = boundCenter;
        _boundExtens = boundExtens;

        x = boundCenter.x - boundExtens.x;
        y = boundCenter.y - boundExtens.y;
        z = boundCenter.z - boundExtens.z;

        lineLeft  = _boundCenter.x - _boundExtens.x;
        lineRight = _boundCenter.x + _boundExtens.x;

        //Log.log("init center: " + boundCenter + "    extends: " + boundExtens);
    }
Esempio n. 17
0
 public void onCompleteSkillAnimation(float waitTime, string state)
 {
     _isEnabled   = true;
     type         = TYPE.onCompleteSkillAnimation;
     _waitTime    = waitTime;
     currentState = state;
 }
Esempio n. 18
0
 public void onCompleteSkillAni(float waitTime, string id)
 {
     _isEnabled = true;
     type       = TYPE.onCompleteSkillAni;
     _waitTime  = waitTime;
     _id        = id;
 }
Esempio n. 19
0
    // Adapted from source : http://www.robertpenner.com/easing/

    public static IFloat Ease(IFloat linearStep, IFloat acceleration, EasingType type)
    {
        IFloat easedStep = acceleration > 0 ? EaseIn(linearStep, type) :
                           acceleration < 0 ? EaseOut(linearStep, type) :
                           (IFloat)linearStep;

        return(FixedMathHelper.Lerp(linearStep, easedStep, Math.Abs(acceleration)));
    }
Esempio n. 20
0
 public IFloat getValueByATTR(int[] transcendLevel, IFloat inputValue, int inputAttr)
 {
     if (transcendLevel == null || totalPLevel <= 0 || transcendData == null)
     {
         return(inputValue);
     }
     return(transcendData.getValueByATTR(transcendLevel, inputValue, inputAttr));
 }
Esempio n. 21
0
    public static IVector2 Create(IFloat X, IFloat Y)
    {
        IVector2 v;

        v.x = X;
        v.y = Y;
        return(v);
    }
 private void parser(object obj, out IFloat fVar, Checker callback)
 {
     Util.parseObject(obj, out fVar, true, -1.0f);
     if (fVar > -1)
     {
         tempCheckers.Add(callback);
     }
 }
Esempio n. 23
0
    public void Set(IFloat v)
    {
        _zl  = Dkaghghk.fdsfas;
        _zl2 = Dkaghghk.dsfafasfassfd;;

        _value  = v.Value + _zl;
        _eValue = _value + _zl2;
    }
Esempio n. 24
0
    public static IVector3 Create(IFloat X, IFloat Y, IFloat Z)
    {
        IVector3 v;

        v.x = X;
        v.y = Y;
        v.z = Z;
        return(v);
    }
Esempio n. 25
0
 public void copy(HitObject h)
 {
     this.x      = h.x;
     this.y      = h.y;
     this.z      = h.z;
     this.width  = h.width;
     this.height = h.height;
     this.depth  = h.depth;
 }
Esempio n. 26
0
 public HitObject(float x = 0.0f, float y = 0.0f, float z = 1.0f, float width = 0.0f, float height = 0.0f, float depth = 1.0f)
 {
     this._x     = x;
     this._y     = y;
     this._z     = z;
     this.width  = width;
     this.height = height;
     this.depth  = depth;
 }
Esempio n. 27
0
    public static IFloat abs(IFloat a)
    {
        if (a < 0)
        {
            return(-a);
        }

        return(a);
    }
Esempio n. 28
0
    public Xfloat(IFloat v)
    {
        _zl     = 1000;
        _zl2    = 1000;
        _value  = 0;
        _eValue = 0;

        Set(v);
    }
Esempio n. 29
0
    public void startSkillAniLoop2(float waitTime, AttackData.PlayerShoot shoot, int skillLevel, int applyReinforceLevel, float fadeTime = 0.2f)
    {
        _isEnabled  = true;
        type        = TYPE.startSkillAniLoop2;
        _shoot      = shoot;
        _skillLevel = skillLevel;

        _applyReinforceLevel = applyReinforceLevel;
        _waitTime            = waitTime;
    }
Esempio n. 30
0
    public static IVector3 getFixedPositionByAngleAndDistanceXZ(int angle, IFloat dist)
    {
        IVector3 iv;

        iv.x = dist * GameManager.fixedAngleTable[angle].x;
        iv.y = 0;
        iv.z = dist * GameManager.fixedAngleTable[angle].y;

        return(iv);
    }