예제 #1
0
    public void MakeDamage(BaseCharacter target, float baseDamage)
    {
        if (target != null)
        {
            if (target.tag.Contains("Side") && target.tag != Side.ToString())
            {
                bool iscritical = CharInfo.IsCritical(AtkType == AttackAnimType.Weak_Atk ? true : false);
                //Set damage to the hitting character
                if (AtkType != AttackAnimType.Weak_Atk)
                {
                    CameraManagerScript.Instance.CameraShake(CameraShakeType.PowerfulAttackHit);
                }

                target.SetDamage((baseDamage) * (iscritical ? 2 : 1),
                                 Elemental, iscritical, CharInfo.ClassType == CharacterClassType.Desert && AtkType != AttackAnimType.Weak_Atk ? true : false);

                int chances = Random.Range(0, 100);
                if (chances < 100)
                {
                    foreach (ScriptableObjectAttackEffect item in BulletEffects)
                    {
                        target.Buff_DebuffCo(new Buff_DebuffClass(item.Name, item.Duration.x, item.Value.x, item.StatsToAffect, item.StatsChecker, new ElementalResistenceClass(), ElementalType.Dark, item.AnimToFire, item.Particles));
                    }
                }
            }
        }
    }
예제 #2
0
 //Used to set the unit info for the facing,side,unitbehaviour, tag and AI
 public void SetUnit(FacingType facing, SideType side, UnitBehaviourType ubt, bool ai = false)
 {
     Facing = facing;
     if (facing == FacingType.Right)
     {
         transform.eulerAngles = new Vector3(0, 180, 0);
     }
     else
     {
         transform.eulerAngles = Vector3.zero;
     }
     Side           = side;
     gameObject.tag = Side.ToString();
     if (CharOwner.SpineAnim == null)
     {
         CharOwner.SpineAnimatorsetup();
     }
     CharOwner.SpineAnim.gameObject.tag = Side.ToString();
     UnitBehaviour = ubt;
 }
예제 #3
0
        public async Task <dynamic> PlaceTakeProfitOrderAsync(string instrument, SideType side, decimal size, decimal triggerPrice, decimal?orderPrice = null, bool reduceOnly = false)
        {
            var path = $"api/conditional_orders";

            if (orderPrice == null)
            {
                var body = new
                {
                    market       = instrument,
                    side         = side.ToString(),
                    triggerPrice = triggerPrice,
                    size         = size,
                    type         = "takeProfit",
                    reduceOnly   = reduceOnly,
                };
                var sign   = GenerateSignature(HttpMethod.POST, "/api/conditional_orders", body);
                var result = await CallAsyncSign(HttpMethod.POST, path, sign, body);

                return(result);
            }
            else
            {
                var body = new
                {
                    market       = instrument,
                    side         = side.ToString(),
                    triggerPrice = triggerPrice,
                    orderPrice   = orderPrice,
                    size         = size,
                    type         = "takeProfit",
                    reduceOnly   = reduceOnly,
                };
                var sign   = GenerateSignature(HttpMethod.POST, "/api/conditional_orders", body);
                var result = await CallAsyncSign(HttpMethod.POST, path, sign, body);

                return(result);
            }
        }
예제 #4
0
        public PlaceOrderInfo PlaceOrder(string market, SideType side, decimal?price, OrderType orderType, decimal size, bool reduceOnly, bool ioc, bool postOnly, string clientOrderId)
        {
            var path     = $"api/orders";
            var priceStr = (price == null || orderType == OrderType.Market) ? "null" : price.ToString();
            var body     = "";

            if (string.IsNullOrEmpty(clientOrderId))
            {
                body = $"{{\"market\": \"{market}\"," +
                       $"\"side\": \"{side.ToString().ToLower()}\"," +
                       $"\"price\": {priceStr}," +
                       $"\"type\": \"{orderType.ToString().ToLower()}\"," +
                       $"\"size\": {size}," +
                       $"\"reduceOnly\": {reduceOnly.ToString().ToLower()}," +
                       $"\"ioc\": {ioc.ToString().ToLower()}," +
                       $"\"postOnly\": {postOnly.ToString().ToLower()}}}";
            }
            else
            {
                body = $"{{\"market\": \"{market}\"," +
                       $"\"side\": \"{side.ToString().ToLower()}\"," +
                       $"\"price\": {priceStr}," +
                       $"\"type\": \"{orderType.ToString().ToLower()}\"," +
                       $"\"size\": {size}," +
                       $"\"clientId\": {clientOrderId}," +
                       $"\"reduceOnly\": {reduceOnly.ToString().ToLower()}," +
                       $"\"ioc\": {ioc.ToString().ToLower()}," +
                       $"\"postOnly\": {postOnly.ToString().ToLower()}}}";
            }

            var sign   = GenerateSignature(HttpMethod.Post, "/api/orders", body);
            var result = CallSign(HttpMethod.Post, path, sign, body);
            var res    = FtxRestDataParser.ParseOrderInfo(result);

            return(res);
        }
예제 #5
0
        public async Task <dynamic> PlaceTakeProfitOrderAsync(string instrument, SideType side, decimal triggerPrice, decimal amount, bool reduceOnly = false)
        {
            var path = $"api/conditional_orders";

            var body =
                $"{{\"market\": \"{instrument}\"," +
                $"\"side\": \"{side.ToString()}\"," +
                $"\"triggerPrice\": {triggerPrice}," +
                $"\"type\": \"takeProfit\"," +
                $"\"size\": {amount}," +
                $"\"reduceOnly\": {reduceOnly.ToString().ToLower()}}}";

            var sign   = GenerateSignature(HttpMethod.Post, "/api/conditional_orders", body);
            var result = await CallAsyncSign(HttpMethod.Post, path, sign, body);

            return(ParseResponce(result));
        }
예제 #6
0
        public async Task <dynamic> PlaceTrailingStopOrderAsync(string instrument, SideType side, decimal size, decimal trailValue, bool reduceOnly = false)
        {
            var path = $"api/conditional_orders";

            var body = new
            {
                market     = instrument,
                side       = side.ToString(),
                trailValue = trailValue,
                size       = size,
                type       = "trailingStop",
                reduceOnly = reduceOnly,
            };
            var sign   = GenerateSignature(HttpMethod.POST, "/api/conditional_orders", body);
            var result = await CallAsyncSign(HttpMethod.POST, path, sign, body);

            return(result);
        }
예제 #7
0
        public async Task <dynamic> PlaceOrderAsync(string instrument, SideType side, decimal?price, OrderType type, decimal size, bool reduceOnly = false, bool ioc = false, bool postOnly = false, string clientId = null)
        {
            var path = $"api/orders";
            var body = new
            {
                market     = instrument,
                side       = side.ToString(),
                price      = price,
                type       = type.ToString(),
                size       = size,
                reduceOnly = reduceOnly,
                ioc        = ioc,
                postOnly   = postOnly,
                clientId   = clientId,
            };

            var sign = GenerateSignature(HttpMethod.POST, "/api/orders", body);

            var result = await CallAsyncSign(HttpMethod.POST, path, sign, body);

            return(result);
        }
예제 #8
0
 public override string Name()
 {
     return(_side.ToString() + "_Leg");
 }
예제 #9
0
 public override string Name()
 {
     return(_side.ToString() + "_" + finger.ToString());
 }