예제 #1
0
    public static IFloat Create(Xfloat FloatValue)
    {
        IFloat iFloat;

        iFloat.Value = FloatValue.GetCompareValue();
        return(iFloat);
    }
예제 #2
0
 public bool checkingDefaultAttackRange(Monster attacker, Monster target, IVector3 targetPosition, float offset = 0.0f)
 {
     if (attacker.isPlayerSide == false)
     {
         if (isShortType)
         {
             return(VectorUtil.DistanceXZ(targetPosition, attacker.cTransformPosition) <= (IFloat)(attacker.stat.atkRange + target.damageRange + offset + attacker.damageRange));                                // hitrange
         }
         else
         {
             return(Xfloat.lessEqualThan(attacker.cTransformPosition.x - attacker.stat.atkRange - offset - attacker.damageRange, targetPosition.x + target.hitObject.lineRight));
         }
     }
     else
     {
         if (isShortType)
         {
             return(Xfloat.lessEqualThan(VectorUtil.DistanceXZ(targetPosition, attacker.cTransformPosition), attacker.stat.atkRange + target.damageRange + offset + attacker.damageRange));                                 // hitrange
         }
         else
         {
             return(Xfloat.greatEqualThan(attacker.cTransformPosition.x + attacker.stat.atkRange + offset + attacker.damageRange, target.hitObject.lineLeft + targetPosition.x));
         }
     }
 }
예제 #3
0
    public void Set(Xfloat v)
    {
        _zl  = Dkaghghk.fdsfas;
        _zl2 = Dkaghghk.dsfafasfassfd;;

        _value  = v.GetCompareValue() + _zl;
        _eValue = _value + _zl2;
    }
예제 #4
0
    public static Xfloat abs(Xfloat a)
    {
        if (a < 0)
        {
            return(-a);
        }

        return(a);
    }
예제 #5
0
    public static Xfloat abs(Xfloat a, Xfloat b)
    {
        a -= b;
        if (a < 0)
        {
            return(-a);
        }

        return(a);
    }
예제 #6
0
    public static int getDamage(float inputAtk, float def, float inputMagicAtk = 0.0f, float magicDef = 0.0f, float damagePer = 1.0f, float minimumDamagePer = 1.0f, float damagePer2 = 1.0f, float inputTempDiscountDamageValue = 1.0f)
    // damagePer2는 공격동작중 한번에 여러번 타격판정이 들어가는 경우에 사용한다.
    {
        //#if UNITY_EDITOR
        //		Log.log("atk:",atk,"def:",def,"magicAtk:",magicAtk,"magicDef:",magicDef,"damagePer:",damagePer,"minimumDamagePer:",minimumDamagePer,"damagePer2:",damagePer2);
        //#endif
        IFloat atk      = inputAtk;
        IFloat magicAtk = inputMagicAtk;
        IFloat tempDiscountDamageValue = inputTempDiscountDamageValue;

        damagePer = (Mathf.Round(damagePer * 100.0f)) / 100.0f;

        //데미지 = 물리공격력 * (1/SQRT(물리방어력)) * A + 마법공격력 * (1/SQRT(마법방어력)) * B
        //* SQRT : 제곱근, A : 데미지보정계수 (5), B : 데미지보정계수 (5)

        if (Xfloat.lessEqualThan(def, 0))
        {
            def = 1;
        }

        if (Xfloat.lessEqualThan(magicDef, 0))
        {
            magicDef = 1;
        }

        atk = (atk * (1.0f / Mathf.Sqrt(def))) * 5.0f + (magicAtk * (1.0f / Mathf.Sqrt(magicDef)) * 5.0f);

        // damagePer // 기본 데미지의 몇 %.
        // minimumDamagePer // 데미지의 최소 비율.
        if (Xfloat.lessThan(damagePer, 1.0f))
        {
            atk = atk * minimumDamagePer + ((atk - (atk * minimumDamagePer)) * damagePer);
        }

        // 얘는 한공격 동작에 데미지가 여러번 들어가는 경우 그 횟수로 나누어줘서 밸런스를 맞춰주기 위함이다.
        atk *= damagePer2;


        // 이런 코드를 만들고 싶지 않았으나... 공격타입 5번과 15번은 단계마다 특정비율로 데미지를 깍는다.
        // 거치는 곳이 많기 때문에 어쩔 수 없이 예외를 만들어 데미지를 깍아준다.
        atk *= tempDiscountDamageValue;

        int gValue = Mathf.RoundToInt(atk * 100.0f);

        if (GameManager.inGameRandom.Range(0, 100) < gValue % 100)
        {
            return(gValue / 100 + 1);
        }
        else
        {
            return(gValue / 100);
        }
    }
예제 #7
0
    public int CompareTo(Xfloat sValue)
    {
        if ((_value - _zl) == (sValue._value - sValue._zl))
        {
            return(0);
        }
        else if ((_value - _zl) <= (sValue._value - sValue._zl))
        {
            return(-1);
        }

        return(1);
    }
예제 #8
0
    // pvp 캐릭터 후진.
    public bool moveBackward()
    {
        _v = cTransformPosition;

        _v2    = _v;
        _v2.x += (isPlayerSide)?-1000.0f:1000.0f;
        _v2.z  = 0.0f;

        _q = Util.getLookRotationQuaternion(_v2 - cTransformPosition);

        _v2            = _q.eulerAngles;
        _v2.y         += 180.0f;
        _q.eulerAngles = _v2;

        if (Xfloat.greaterThan(Quaternion.Angle(_q, tf.rotation), 5))
        {
            tf.rotation = Util.getFixedQuaternionSlerp(tf.rotation, _q, CharacterAction.rotationSpeed * GameManager.globalDeltaTime);
        }

        _v  -= (IVector3)(tf.forward) * stat.speed * GameManager.globalDeltaTime;
        _v.y = 0;

        if (isPlayerSide)
        {
            if (Xfloat.greaterThan(_v.x, StageManager.mapStartPosX.Get()) && cm.checkPlayerMonsterBlockLine(this))
            {
                setPosition(_v);
            }
            else
            {
                state = NORMAL;
                return(false);
            }
        }
        else
        {
            if (Xfloat.lessThan(_v.x, StageManager.mapEndPosX.Get()) && cm.checkMonsterBlockLine(this))
            {
                setPosition(_v);
            }
            else
            {
                state = NORMAL;
                return(false);
            }
        }

        //if(_state != WALK)
        state = BWALK;
        return(true);
    }
예제 #9
0
    public void setData(Monster monster, UnitSkillData sd)
    {
        player         = null;
        exeCount       = 0;
        mon            = monster;
        maxCoolTime    = sd.coolTime;
        coolTime       = maxCoolTime + sd.coolTimeStartDelay;
        _unitSkillData = sd;

        useMp = 0.0f;

        hasSkillAni = sd.hasSkillAni;

        sd.exeData.init(AttackData.AttackerType.Unit, AttackData.AttackType.Skill, sd);
    }
    public bool canMonsterHeroTargetingType1(Monster attacker, int targetIndex = -1)
    {
        // 타겟팅 1,2번
        _target = null;

        //<1 : 히어로 전방 A거리(cm), B지름>
        //  - 바닥에 뭔가가 떨어지거나 생성되는 스킬에 적용
        //  - 타게팅(차징)중 히어로 전방 A거리에 B지름 형태의 (원형 마법진모양의) 타게팅 데칼을 표시함
        //  - 설정된 지름의 크기에 따라서 원형태의 마법진 이미지의 크기를 변경해서 표시함
        //  - B지름이 400을 넘어가면 타원으로 (일단;) 늘려서 표시
        _fixedLineLeft  = -(float)targetAttr[0] - ((float)targetAttr[1]) * 0.5f;
        _fixedLineRight = -(float)targetAttr[0] + ((float)targetAttr[1]) * 0.5f;

        if (targetType == Skill.TargetType.ENEMY)
        {
            // 플레이어 몬스터에서 고른다. (적의 적군)
            _target = GameManager.me.characterManager.getCloseEnemyTargetByIndexForHeroMonster(attacker.isPlayerSide, targetIndex);
        }
        else
        {
            // 적 몬스터에서 고른다. (적의 아군)
            _target = GameManager.me.characterManager.getCloseTeamTarget(attacker.isPlayerSide, attacker);
        }

        if (_target == null)
        {
            return(false);
        }

        _v = attacker.cTransformPosition;

        if (Xfloat.greaterThan(_target.cTransformPosition.x, GameManager.me.characterManager.targetZonePlayerLine + _fixedLineLeft) &&
            Xfloat.lessThan(_target.cTransformPosition.x, StageManager.mapEndPosX.Get() + _fixedLineRight))
        {
            attacker.setSkillTarget(_target);
            attacker.skillTargetChecker = ctFixed;
            attacker.skillMove          = ctMoveFixed;
            _target = null;
            return(true);
        }

        _target = null;
        return(false);
    }
예제 #11
0
    protected void updateRecoveryData()
    {
#if UNITY_EDITOR
        if (UnitSkillCamMaker.instance.useUnitSkillCamMaker)
        {
            _recoveryDelay = 5;
        }
#endif

        _recoveryDelay.Set(_recoveryDelay + GameManager.globalDeltaTime);
        if (_recoveryDelay >= GameManager.info.setupData.recoveryDelay)
        {
            _recoveryDelay.Set(_recoveryDelay - GameManager.info.setupData.recoveryDelay);
            //if(isPlayer) hp += hpRecovery;
            //else hpWithoutDisplay += hpRecovery;
            mp += stat.mpRecovery;
            sp += stat.spRecovery;
        }
    }
    public void init(PVPPlayerSkillSlot aiSkillSlot, Player player)
    {
        _player = player;

        _playerTagIndex = player.playerTagIndex;

        chargingEffect.Stop();
        chargingFullNoticeEffect.Stop();
        chargingFullEffect.Stop();
        _isFullCharging = false;

        skillSlot = aiSkillSlot;

        _lastClickState = false;

        lastClickedSlotIndex = -1;
        blockThis            = false;
        isClicked            = false;
        _isPress             = false;
        isWaitingPress       = false;

        isLocked = false;
        //Debug.Log(skillId);

        skillSlot.skillData.exeData.init(AttackData.AttackerType.Hero, AttackData.AttackType.Skill, skillSlot.skillData, skillSlot.skillInfo.transcendData, skillSlot.skillInfo.transcendLevel);

        chargingTimeLimit = skillSlot.skillData.getChargingTime(skillSlot.skillInfo.reinforceLevel).AsFloat();

        lbLeftItemNum.text = Mathf.RoundToInt(skillSlot.useMp / player.maxMp * 100.0f).ToString();        //Mathf.CeilToInt(useMp).ToString();

        tfItemName.text = skillSlot.skillData.name;

        spBackground.spriteName  = RareType.getRareBgSprite(skillSlot.skillInfo.rare);
        spFrameBorder.spriteName = RareType.getRareLineSprite(skillSlot.skillInfo.rare);

        Icon.setSkillIcon(skillSlot.skillInfo.getSkillIcon(), spSkillIcon);
        spSkillIcon.MakePixelPerfect();

        resetCoolTime();

        btn.isEnabled = true;
    }
예제 #13
0
    public bool checkGameClearArrive(int attr = -1, Monster mon = null)
    {
        if (GameManager.me.isPlaying == false)
        {
            return(false);
        }

        if (attr == ClearChecker.CHECK_TIME)
        {
            updateDistance();
            if (Xfloat.greatEqualThan((GameManager.me.player.cTransformPosition.x + StageManager.ARRIVE_DISTANCE_BUFFER).AsFloat(), nowRound.targetPos.Get()))
            {
                nowPlayingGameResult = Result.Type.Clear;
                GameManager.me.mapManager.clearRound();
                GameManager.me.uiManager.uiPlay.lbRoundLeftNum.text = "0m";
                return(true);
            }
        }

        return(false);
    }
//=======================================================================================



    public void resetCoolTime()
    {
        if (GameManager.info.setupData.tagCoolTime <= 0.1f)
        {
            state = State.Ready;
            coolTime.Set(0.0f);
            spLockImage.fillAmount    = 0.0f;
            btn.isEnabled             = true;
            spArrow.enabled           = false;
            spFeverBackground.enabled = true;
        }
        else
        {
            state    = State.CoolTime;
            coolTime = GameManager.info.setupData.tagCoolTime;
            spLockImage.fillAmount    = 0.0f;
            btn.isEnabled             = false;
            spArrow.enabled           = false;
            spFeverBackground.enabled = false;
        }
    }
 public virtual void init(Monster monster)
 {
     this.mon    = monster;
     dx          = 0.0f;
     dy          = 0.0f;
     state       = 0;
     targetPos.x = 0.0f;
     targetPos.y = 0.0f;
     targetPos.z = 0.0f;
     state       = 0;
     if (mon != null)
     {
         mon.target      = null;
         mon.targetAngle = 0;
     }
     isDamageFrame      = false;
     isAfterAttackFrame = false;
     canUsePassiveSkill = true;
     delay      = 0.0f;
     freezeTime = 0.0f;
 }
예제 #16
0
    public UnitData getRareUnitData(UnitData bd)
    {
        isCombineData = true;
        isRare        = true;

        //id = rd.id;
        //name = rd.name;
        //ud.level = rd.level;
        cooltime        += bd.cooltime;
        maxSummonAtOnce += bd.maxSummonAtOnce;
        sp += bd.sp;

        attackType.type = bd.attackType.type;
        attackType.attr = Util.intArrayMerger(bd.attackType.attr, attackType.attr);

        speed     += bd.speed;     // + rd.speed;
        atkRange  += bd.atkRange;  // + rd.atkRange;
        atkSpeed  += bd.atkSpeed;  // + rd.atkSpeed;
        atkPhysic += bd.atkPhysic; // + rd.atkPhysic;
        atkMagic  += bd.atkMagic;  // + rd.atkMagic;
        defPhysic += bd.defPhysic; // + rd.defPhysic;
        defMagic  += bd.defMagic;  // + rd.defMagic;
        hp        += bd.hp;
        unitType   = bd.unitType;  // 공중 지상

        //resource = bd.resource;

        skill = Util.concatStringArray(bd.skill, skill);

        effectType = bd.effectType;

        //rareSkill = rd.rareSkill;
        //description = rd.description;

        //baseUnitId = rd.baseUnitId;
        //rareLevel = rd.rareLevel;
        //code = rd.code;

        return(this);
    }
예제 #17
0
    public virtual void setData(Monster monster, GameIDData heroSkillInfo, UIPlaySkillSlot inputUiSlot = null)
    {
        uiSlot   = inputUiSlot;
        mon      = monster;
        exeCount = 0;
        player   = null;

        if (heroSkillInfo != null)
        {
            skillInfo = heroSkillInfo;

            if (mon.isPlayer && heroSkillInfo.transcendData != null)
            {
                skillData = heroSkillInfo.skillData.clone();
                heroSkillInfo.transcendData.apply(skillData, heroSkillInfo.transcendLevel);
            }
            else
            {
                skillData = heroSkillInfo.skillData;
                skillData.exeData.init(AttackData.AttackerType.Hero, AttackData.AttackType.Skill, skillData);
            }

            useMp = skillData.mp;

            if (skillData.coolTime <= 0.1f)
            {
                maxCoolTime = 0.0f;
            }
            else
            {
                maxCoolTime = skillData.coolTime;
            }

            coolTime = maxCoolTime;

            chargingTimeLimit = skillData.getChargingTime(heroSkillInfo.reinforceLevel);
        }
    }
예제 #18
0
    public void start(bool isPlayerBullet, Monster attacker, float totalDistanceLimit, float distanceLimitA, float distanceLimitB, int maxConnection, float connectionDelay, int damagePer, int skillLevel, int applyInforceLevel, BaseSkillData sd = null)
    {
        if (damagePer <= 0)
        {
            damagePer = 100;
        }

        if (damagePer < 100)
        {
            _damageOffsetPerConnectionLevel = ((float)damagePer) / 100.0f / (float)maxConnection;
        }
        else
        {
            _damageOffsetPerConnectionLevel = 0.0f;
        }


        isDeleteObject = false;
        _skillData     = sd;
        _attacker      = attacker;
        _delay         = 0.0f;
        _totalDistanceLimit.Set(totalDistanceLimit);
        _distanceLimitA.Set(distanceLimitA);
        _distanceLimitB.Set(distanceLimitB);
        _maxConnection       = maxConnection;
        _connectionDelay     = connectionDelay;
        _nowConnectionNum    = 0;
        _canMore             = true;
        _restoreCharacterAni = false;
        _timeSinceBeginning  = 0.0f;
        _isPlayerBullet      = isPlayerBullet;
        _firstRemove         = true;
        _nextDelay           = 0.3f;
        _applyInforceLevel   = applyInforceLevel;
        _skillLevel          = skillLevel;

        getNextTarget(_isPlayerBullet);
    }
예제 #19
0
 void parseStat(object rawData, out Xfloat[] val, int typeDicIndex)
 {
     if (rawData is String)
     {
         if (((string)rawData).Contains(","))
         {
             val = Util.stringToXFloatArray((string)rawData, ',');
             valueTypeDic[typeDicIndex] = GameValueType.Type.Fixed;
         }
         else
         {
             val = new Xfloat[1];
             Util.parseObject(rawData, out val[0], true, 0);
             valueTypeDic[typeDicIndex] = GameValueType.Type.Single;
         }
     }
     else
     {
         val = new Xfloat[1];
         Util.parseObject(rawData, out val[0], true, 0);
         valueTypeDic[typeDicIndex] = GameValueType.Type.Single;
     }
 }
예제 #20
0
    sealed public override void setData(List <object> l, Dictionary <string, int> k)
    {
        base.setData(l, k);

        int g = 1;

        Util.parseObject(l[k["GRADE"]], out g, true, 1);
        grade = g;


        /*
         * if((l[k["CHARGINGTIME"]].ToString()).Contains("/"))
         * {
         *      float[] ct = Util.stringToFloatArray( (string)l[k["CHARGINGTIME"]], '/');
         *      maxChargingTime = ct[0];
         * }
         * else
         * {
         *      Util.parseObject(l[k["CHARGINGTIME"]], out maxChargingTime, true, 1.0f);
         * }
         */

        float[] ct = Util.stringToFloatArray((l[k["CHARGINGTIME"]].ToString()), ',');

        minChargingTime = ct[0];
        if (ct.Length > 1)
        {
            maxChargingTime      = ct[1];
            isChargingTimeSingle = false;
        }
        else
        {
            isChargingTimeSingle = true;
        }

        float tempCoolTime = 0;

        Util.parseObject(l[k["COOLTIME"]], out tempCoolTime, true, 0);
        coolTime    = tempCoolTime;
        hasCoolTime = true;

        float tmp = 0;

        Util.parseObject(l[k["MP"]], out tmp, true, 0);
        mp = tmp;


        isMonsterSkill = (l[k["MP"]].ToString() == "Y");

        switch ((l[k["ATTACHED_EFF"]]).ToString())
        {
        case "B":
            hasShotEffect = true;
            colorEffectId = E_SHOT_BLUE01;
            break;

        case "Y":
            hasShotEffect = true;
            colorEffectId = E_SHOT_YELLOW01;
            break;

        case "V":
            hasShotEffect = true;
            colorEffectId = E_SHOT_VIOLET01;
            break;

        case "G":
            hasShotEffect = true;
            colorEffectId = E_SHOT_GREEN01;
            break;

        case "R":
            hasShotEffect = true;
            colorEffectId = E_SHOT_RED01;
            break;
        }

        isBook = (l[k["BOOK"]].ToString() == "Y");

        if (isBase)
        {
            string r = ((l[k["RESOURCE"]]).ToString()).ToString();

            if (string.IsNullOrEmpty(r) == false)
            {
                if (r.Contains(":"))
                {
                    linkResourceType = LinkResourceType.UnitSkill;
                    linkResource     = r.Substring(2);
                }
                else
                {
                    linkResourceType = LinkResourceType.HeroSkill;
                    linkResource     = r;
                }
            }
            else
            {
                linkResourceType = LinkResourceType.Default;
            }


#if UNITY_EDITOR
            //Debug.Log(id);
#endif

            baseIdWithoutRare = id.Substring(0, id.IndexOf("_")) + id.Substring(id.IndexOf("_") + 2);
        }


#if UNITY_EDITOR
        bool hasWrongTargeting = false;

        switch (exeType)
        {
        case 0:
            break;

        case 1:
            break;

        case 2:

            break;

        case 3:
        case 4:
        case 5:
            if (targeting != 2 && targeting != 3)
            {
                hasWrongTargeting = true;
            }
            break;

        case 6:
        case 7:
        case 8:
        case 9:
        case 10:
        case 11:
            if (targeting != 1 && targeting != 2)
            {
                hasWrongTargeting = true;
            }
            break;

        case 12:
            if (targeting != 3)
            {
                hasWrongTargeting = true;
            }
            break;

        case 15:
            if (targeting != 2)
            {
                hasWrongTargeting = true;
            }
            break;

        case 16:
            if (targeting != 0)
            {
                hasWrongTargeting = true;
            }
            break;

        case 17:
            if (targeting != 1)
            {
                hasWrongTargeting = true;
            }
            break;

        case 18:
            if (targeting != 2 && targeting != 3)
            {
                hasWrongTargeting = true;
            }
            break;
        }

        if (hasWrongTargeting)
        {
            Debug.LogError(id + " targeting: " + +targeting + "    atkType : " + exeType);
            error.Add(id + " targeting: " + +targeting + "    atkType : " + exeType);
        }
#endif
    }
예제 #21
0
 public static bool lessThan(Xfloat a, float b)
 {
     return(a.GetCompareValue() < (long)Math.Round(b * FACTOR));
 }
예제 #22
0
 public static bool lessThan(float a, Xfloat b)
 {
     return((long)Math.Round(a * FACTOR) < b.GetCompareValue());
 }
예제 #23
0
 public static bool lessThan(Xint a, Xfloat b)
 {
     return(a < b);
 }
예제 #24
0
 public static bool lessThan(IFloat a, Xfloat b)
 {
     return(a.Value < b.GetCompareValue());
 }
예제 #25
0
 public static bool lessThan(Xfloat a, IFloat b)
 {
     return(a.GetCompareValue() < b.Value);
 }
예제 #26
0
 public static bool lessEqualThan(Xint a, Xfloat b)
 {
     return(a <= b);
 }
예제 #27
0
 public static bool greaterThan(Xfloat a, float b)
 {
     return(a.GetCompareValue() > (long)Math.Round(b * FACTOR));
 }
예제 #28
0
 public static bool greaterThan(float a, Xfloat b)
 {
     return((long)Math.Round(a * FACTOR) > b.GetCompareValue());
 }
예제 #29
0
 public static bool greaterThan(Xint a, Xfloat b)
 {
     return(a > b);
 }
예제 #30
0
 public static bool greaterThan(IFloat a, Xfloat b)
 {
     return(a.Value > b.GetCompareValue());
 }