コード例 #1
0
ファイル: ResultEpicUI.cs プロジェクト: kimjunhwi/BlackSmith2
    public EpicOption EpicFactory(int _nIndex)
    {
        EpicOption resultOption = null;

        switch (_nIndex)
        {
        case (int)E_EPIC_INDEX.E_EPIC_MAGIC:                    resultOption = new MagicStick(); break;

        case (int)E_EPIC_INDEX.E_EPIC_KO_HAMMER:                resultOption = new KoHammer(); break;

        case (int)E_EPIC_INDEX.E_EPIC_GOLD_HAMMER:              resultOption = new GoldHammer(); break;

        case (int)E_EPIC_INDEX.E_EPIC_FREEZING_TUNA:    resultOption = new FreezingTuna(); break;

        case (int)E_EPIC_INDEX.E_EPIC_RUBBER_CHICKEN:   resultOption = new RubberChicken(); break;

        case (int)E_EPIC_INDEX.E_EPIC_ENGINE_HAMMER:    resultOption = new EngineHammer(); break;

        case (int)E_EPIC_INDEX.E_EPIC_ICEPUNCH:                 resultOption = new IcePunch(); break;

        case (int)E_EPIC_INDEX.E_EPIC_GOBLIN_HAMMER:    resultOption = new GoblinHammer(); break;

        case (int)E_EPIC_INDEX.E_EPIC_SLEDE_HAMMER:             resultOption = new SledeHammer(); break;

        default:
            break;
        }

        return(resultOption);
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: kimjunhwi/BlackSmith2
    //08.09
    //플레이어 제작
    public void SetCreatorWeapon(CreatorWeapon _weapon, EpicOption _EpicOption)
    {
        creatorWeapon = null;

        creatorWeapon = _weapon;

        epicOpion = _EpicOption;

        double dCurComplete;

        if (changeStats.nEnhanceRepaireLevel <= 10)
        {
            dCurComplete = _weapon.dRepair + changeStats.nEnhanceRepaireLevel;
        }
        else
        {
            dCurComplete = _weapon.dRepair * Math.Pow(1.022f, (Mathf.Floor((changeStats.nEnhanceRepaireLevel - 11) * 0.1f))) * (1 + ((changeStats.nEnhanceRepaireLevel - 10) * 0.03f));

            dCurComplete += changeStats.nEnhanceRepaireLevel;
        }

        SetBasicRepairPower(dCurComplete);

        PlayerStatsSetting();
    }
コード例 #3
0
ファイル: ResultEpicUI.cs プロジェクト: kimjunhwi/BlackSmith2
    public void CreateWeapon()
    {
        bIsCreate = true;

        int nDight     = 0;
        int nDightCost = playerData.GetDay();

        float fCostDay = (float)nDightCost;

        while (fCostDay > 10)
        {
            fCostDay -= 10;
            nDight++;
        }

        createWeapon = new CreatorWeapon();

        int   nDay        = playerData.GetDay();
        float fOriValue   = nDay + 10;
        float fMinusValue = Mathf.Floor((nDay + 10) * 0.1f) * 10;
        float result      = fOriValue - fMinusValue;

        double dCurComplete = 3 * Math.Max(Math.Pow(1.83, (Math.Floor((nDay + 20) * 0.1f))), 1) * (1 + (result) * 0.05f);

        dCalcMinRepair = dCurComplete - dCurComplete * 0.1f;

        int nPlusCount = 0;

        while (dCalcMinRepair >= 400000000)
        {
            dCalcMinRepair *= 0.1;
            dCurComplete   *= 0.1;

            nPlusCount++;
        }

        float fResult = UnityEngine.Random.Range((float)dCalcMinRepair, (float)dCurComplete);

        dCurComplete = fResult * Math.Pow(10, nPlusCount);

        RepairText.text = ScoreManager.ScoreInstance.ChangeMoney(dCurComplete);

        //수리력 설정
        createWeapon.dRepair = dCurComplete;

        int nOptionLength = 3;

        //리스트에서 지움
        LIST_OPTION.Clear();

        //추가 옵션 범위
        nCalcAddMinOption = Mathf.RoundToInt(m_nBasicMinOption + (float)(m_nBasicMinOption * nDight * 0.1f));
        nCalcAddMaxOption = Mathf.RoundToInt(m_nBasicMaxOption + (float)(m_nBasicMaxOption * nDight * 0.1f));

        //옵션 셋팅
        while (nOptionLength > 0)
        {
            int nInsertIndex = 0;

            nInsertIndex = UnityEngine.Random.Range((int)E_CREATOR.E_REPAIRPERCENT, (int)E_CREATOR.E_MAX);
            nInsertValue = UnityEngine.Random.Range(nCalcAddMinOption, nCalcAddMaxOption + 1);

            if (CheckData(createWeapon, nInsertIndex, nInsertValue))
            {
                nOptionLength--;
            }
        }

        //보스 옵션 셋팅
        for (int nIndex = 0; nIndex < BossSoulSlots.Length; nIndex++)
        {
            //만약 체크가 됐다면
            if (BossSoulSlots [nIndex].bIsCheck)
            {
                nInsertValue = UnityEngine.Random.Range(nCalcAddMinOption, nCalcAddMaxOption + 1);

                if (nIndex == (int)E_BOSSNAME.E_BOSSNAME_ICE)
                {
                    createWeapon.fIceBossValue = nInsertValue;
                }
                else if (nIndex == (int)E_BOSSNAME.E_BOSSNAME_SASIN)
                {
                    createWeapon.fSasinBossValue = nInsertValue;
                }
                else if (nIndex == 3)
                {
                    createWeapon.fFireBossValue = nInsertValue;
                }
                else if (nIndex == 2)
                {
                    createWeapon.fRusiuBossValue = nInsertValue;
                }

                CGameMainWeaponOption plusItem = new CGameMainWeaponOption();

                plusItem.nIndex           = nIndex + (int)E_CREATOR.E_BOSS_ICE;
                plusItem.strOptionName    = strBossExplains [nIndex];
                plusItem.nValue           = nInsertValue;
                plusItem.strOptionExplain = string.Format("{0} : {1}%", plusItem.strOptionName, plusItem.nValue);
                plusItem.bIsLock          = false;

                LIST_OPTION.Add(plusItem);
            }
        }

        //만약 전 에픽이 있을 경우 락을 했는지 안했는지 넣어 줌
        if (playerData.GetCreatorWeapon() != null)
        {
            createWeapon.bIsLock       = playerData.GetCreatorWeapon().bIsLock;
            createWeapon.nEpicIndex    = playerData.GetCreatorWeapon().nEpicIndex;
            createWeapon.nUnicodeIndex = playerData.GetCreatorWeapon().nUnicodeIndex;
        }

        //락이 아닐 경우 다시 에픽 확률을 계산 해서 넣어 줌
        if (createWeapon.bIsLock == false)
        {
            if (createEpic != null)
            {
                createEpic.Relive();
            }

            //특수 옵션 미정
            if (UnityEngine.Random.Range(0, 100) <= 10)
            {
                int nRandomIndex = (int)UnityEngine.Random.Range(0, (int)E_EPIC_INDEX.E_EPIC_MAX);

                createEpic = EpicFactory(nRandomIndex);

                createWeapon.nEpicIndex = nRandomIndex;

                createWeapon.nUnicodeIndex = nRandomIndex + 175;

                createWeapon.nCostDay = playerData.GetDay();

                createWeapon.strName = GameManager.Instance.cUnicodeData [createWeapon.nUnicodeIndex].strName;

                if (createEpic != null)
                {
                    createEpic.Init(playerData.GetDay(), playerData);
                }
            }
            else
            {
                createEpic = null;
            }
        }
        //락 일경우 추가 된 일차로 옵션 수치만 다시 설정 해준다.
        else
        {
            createEpic = EpicFactory(createWeapon.nEpicIndex);

            createEpic.Init(playerData.GetDay(), playerData);

            createWeapon.nCostDay = playerData.GetDay();

            createWeapon.strName = GameManager.Instance.cUnicodeData [createWeapon.nUnicodeIndex].strName;

            createWeapon.bIsLock = false;
        }

        if (createEpic != null)
        {
            //에픽 옵션 추가
            CGameMainWeaponOption EpicOption = new CGameMainWeaponOption();

            EpicOption.nIndex           = (int)E_CREATOR.E_EPIC;
            EpicOption.strOptionName    = createEpic.strExplain;
            EpicOption.nValue           = (int)createEpic.fValue;
            EpicOption.strOptionExplain = createEpic.strExplain;
            EpicOption.bIsLock          = false;
            createEpic.bIsLock          = false;

            LIST_OPTION.Add(EpicOption);

            createWeapon.WeaponSprite = Resources.Load <Sprite> ("Crafts/CreatorWeapon/" + createEpic.nIndex);

            SoundManager.instance.PlaySound(eSoundArray.ES_CraftSound_GreatFinish);
        }
        else
        {
            int nRandomWeaponIndex = (int)UnityEngine.Random.Range(184, 211);

            //184,211

            createWeapon.nEpicIndex = -1;

            createWeapon.nCostDay = playerData.GetDay();

            createWeapon.WeaponSprite = Resources.Load <Sprite> ("Crafts/CreatorWeapon/" + (nRandomWeaponIndex - 175).ToString());

            createWeapon.strName = GameManager.Instance.cUnicodeData [nRandomWeaponIndex].strName;

            createWeapon.nUnicodeIndex = nRandomWeaponIndex;

            SoundManager.instance.PlaySound(eSoundArray.ES_CraftSound_Finish);
        }

        createWeapon.nOptionChangeCount = 1;

        WeaponImage.sprite  = createWeapon.WeaponSprite;
        WeaponNameText.text = createWeapon.strName;
    }
コード例 #4
0
    void Awake()
    {
        playerData = GameManager.Instance.GetPlayer();
        MakingButton.onClick.AddListener(MakeWeapon);

        for (int nIndex = 0; nIndex < BossSoulSlots.Length; nIndex++)
        {
            BossSoulSlots [nIndex].SetUp(this, playerData, nIndex);
        }

        if (playerData.GetCreatorWeapon().dRepair == 0)
        {
            //playerData.SetDay (11);
            //MakeWeapon ();
        }
        else
        {
            BossSlotOne.sprite = null;
            BossSlotTwo.sprite = null;

            CreatorWeapon createWeapon = new CreatorWeapon();

            //저장 된 데이터를 미리 캐싱해 둔다
            CreatorWeapon LoadCreateWeapon = playerData.GetCreatorWeapon();

            #region SetCreateWeaponSetting

            createWeapon.dRepair = LoadCreateWeapon.dRepair;

            createWeapon.nOptionChangeCount = LoadCreateWeapon.nOptionChangeCount;

            createWeapon.bIsLock = LoadCreateWeapon.bIsLock;

            if (LoadCreateWeapon.fRepairPercent != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_REPAIRPERCENT, (int)LoadCreateWeapon.fRepairPercent);
            }

            if (LoadCreateWeapon.fArbaitRepair != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_ARBAIT, (int)LoadCreateWeapon.fArbaitRepair);
            }

            if (LoadCreateWeapon.fPlusHonorPercent != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_HONOR, (int)LoadCreateWeapon.fPlusHonorPercent);
            }

            if (LoadCreateWeapon.fPlusGoldPercent != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_GOLD, (int)LoadCreateWeapon.fPlusGoldPercent);
            }

            if (LoadCreateWeapon.fWaterPlus != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_WATERCHARGE, (int)LoadCreateWeapon.fWaterPlus);
            }

            if (LoadCreateWeapon.fCriticalChance != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_CRITICAL, (int)LoadCreateWeapon.fCriticalChance);
            }

            if (LoadCreateWeapon.fCriticalDamage != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_CRITICALD, (int)LoadCreateWeapon.fCriticalDamage);
            }

            if (LoadCreateWeapon.fBigSuccessed != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_BIGCRITICAL, (int)LoadCreateWeapon.fBigSuccessed);
            }

            if (LoadCreateWeapon.fAccuracyRate != 0)
            {
                CheckData(createWeapon, (int)E_CREATOR.E_ACCURACY, (int)LoadCreateWeapon.fAccuracyRate);
            }

            if (LoadCreateWeapon.fIceBossValue != 0)
            {
                createWeapon.fIceBossValue = LoadCreateWeapon.fIceBossValue;

                CGameMainWeaponOption plusItem = new CGameMainWeaponOption();

                plusItem.nIndex        = (int)E_CREATOR.E_BOSS_ICE;
                plusItem.strOptionName = strBossExplains [0];
                plusItem.nValue        = (int)LoadCreateWeapon.fIceBossValue;
                plusItem.bIsLock       = false;

                plusItem.strOptionExplain = string.Format("{0} : {1}%", plusItem.strOptionName, plusItem.nValue);


                LIST_OPTION.Add(plusItem);
            }

            if (LoadCreateWeapon.fRusiuBossValue != 0)
            {
                createWeapon.fRusiuBossValue = LoadCreateWeapon.fRusiuBossValue;

                CGameMainWeaponOption plusItem = new CGameMainWeaponOption();

                plusItem.nIndex        = (int)E_CREATOR.E_BOSS_RUSIU;
                plusItem.strOptionName = strBossExplains [1];
                plusItem.nValue        = (int)LoadCreateWeapon.fRusiuBossValue;
                plusItem.bIsLock       = false;

                plusItem.strOptionExplain = string.Format("{0} : {1}%", plusItem.strOptionName, plusItem.nValue);


                LIST_OPTION.Add(plusItem);
            }

            if (LoadCreateWeapon.fSasinBossValue != 0)
            {
                createWeapon.fSasinBossValue = LoadCreateWeapon.fSasinBossValue;

                CGameMainWeaponOption plusItem = new CGameMainWeaponOption();

                plusItem.nIndex        = (int)E_CREATOR.E_BOSS_SASIN;
                plusItem.strOptionName = strBossExplains [2];
                plusItem.nValue        = (int)LoadCreateWeapon.fSasinBossValue;
                plusItem.bIsLock       = false;

                plusItem.strOptionExplain = string.Format("{0} : {1}%", plusItem.strOptionName, plusItem.nValue);

                LIST_OPTION.Add(plusItem);
            }

            if (LoadCreateWeapon.fFireBossValue != 0)
            {
                createWeapon.fFireBossValue = LoadCreateWeapon.fFireBossValue;

                CGameMainWeaponOption plusItem = new CGameMainWeaponOption();

                plusItem.nIndex        = (int)E_CREATOR.E_BOSS_FIRE;
                plusItem.strOptionName = strBossExplains [3];
                plusItem.nValue        = (int)LoadCreateWeapon.fFireBossValue;
                plusItem.bIsLock       = false;

                plusItem.strOptionExplain = string.Format("{0} : {1}%", plusItem.strOptionName, plusItem.nValue);

                LIST_OPTION.Add(plusItem);
            }

            if (LoadCreateWeapon.fIceBossValue != 0)
            {
                BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/IceSoul");
            }

            if (LoadCreateWeapon.fSasinBossValue != 0)
            {
                if (BossSlotOne.sprite != null)
                {
                    BossSlotTwo.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/SasinSoul");
                }
                else
                {
                    BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/SasinSoul");
                }
            }

            if (LoadCreateWeapon.fRusiuBossValue != 0)
            {
                if (BossSlotOne.sprite != null)
                {
                    BossSlotTwo.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/DodomSoul");
                }
                else
                {
                    BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/DodomSoul");
                }
            }

            if (LoadCreateWeapon.fFireBossValue != 0)
            {
                if (BossSlotOne.sprite != null)
                {
                    BossSlotTwo.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/SkullSoul");
                }
                else
                {
                    BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/SkullSoul");
                }
            }

            if (BossSlotOne.sprite == null)
            {
                BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/crafts_bosssoul_slot_check_unactive");
            }

            if (BossSlotTwo.sprite == null)
            {
                BossSlotTwo.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/crafts_bosssoul_slot_check_unactive");
            }


            if (LoadCreateWeapon.nEpicIndex != (int)E_EPIC_INDEX.E_EPIC_FAIEL)
            {
                createWeapon.nEpicIndex = LoadCreateWeapon.nEpicIndex;

                createEpic = EpicFactory(createWeapon.nEpicIndex);

                createEpic.Init(LoadCreateWeapon.nCostDay, playerData);

                //에픽 옵션 추가
                CGameMainWeaponOption EpicOption = new CGameMainWeaponOption();

                EpicOption.nIndex           = (int)E_CREATOR.E_EPIC;
                EpicOption.strOptionName    = createEpic.strExplain;
                EpicOption.nValue           = (int)createEpic.fValue;
                EpicOption.strOptionExplain = createEpic.strExplain;
                EpicOption.bIsLock          = createWeapon.bIsLock;
                createEpic.bIsLock          = createWeapon.bIsLock;

                LIST_OPTION.Add(EpicOption);

                createWeapon.WeaponSprite = Resources.Load <Sprite> ("Crafts/CreatorWeapon/" + createEpic.nIndex);
            }
            else
            {
                createWeapon.WeaponSprite = Resources.Load <Sprite> ("Crafts/CreatorWeapon/" + (LoadCreateWeapon.nUnicodeIndex - 175).ToString());
            }

            createWeapon.nUnicodeIndex = LoadCreateWeapon.nUnicodeIndex;

            WeaponNameText.text = GameManager.Instance.cUnicodeData[LoadCreateWeapon.nUnicodeIndex].strName;

            createWeapon.strName = WeaponNameText.text;

            WeaponImage.sprite = createWeapon.WeaponSprite;

            PlayerWeaponImage.sprite = createWeapon.WeaponSprite;

            playerData.SetCreatorWeapon(createWeapon, createEpic);

            SpawnManager.Instance.SetDayInitInfo(playerData.GetDay());

            RefreshDisplay();

            SetShowText();


            #endregion
        }
    }
コード例 #5
0
    public void CreateWeapon(CreatorWeapon _weapon, EpicOption _epicOption, List <CGameMainWeaponOption> _List_Option)
    {
        BossSlotOne.sprite = null;
        BossSlotTwo.sprite = null;

        LIST_OPTION = _List_Option;

        WeaponNameText.text = _weapon.strName;

        WeaponImage.sprite = _weapon.WeaponSprite;

        PlayerWeaponImage.sprite = _weapon.WeaponSprite;

        playerData.SetCreatorWeapon(_weapon, _epicOption);

        repairUI.ChagneRepairData();

        if (_weapon.fIceBossValue != 0)
        {
            BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/IceSoul");
        }

        if (_weapon.fSasinBossValue != 0)
        {
            if (BossSlotOne.sprite != null)
            {
                BossSlotTwo.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/SasinSoul");
            }
            else
            {
                BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/SasinSoul");
            }
        }

        if (_weapon.fRusiuBossValue != 0)
        {
            if (BossSlotOne.sprite != null)
            {
                BossSlotTwo.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/DodomSoul");
            }
            else
            {
                BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/DodomSoul");
            }
        }

        if (_weapon.fFireBossValue != 0)
        {
            if (BossSlotOne.sprite != null)
            {
                BossSlotTwo.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/SkullSoul");
            }
            else
            {
                BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/SkullSoul");
            }
        }

        if (BossSlotOne.sprite == null)
        {
            BossSlotOne.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/crafts_bosssoul_slot_check_unactive");
        }

        if (BossSlotTwo.sprite == null)
        {
            BossSlotTwo.sprite = ObjectCashing.Instance.LoadSpriteFromCache("Crafts/crafts_bosssoul_slot_check_unactive");
        }



        SpawnManager.Instance.SetDayInitInfo(playerData.GetDay());

        RefreshDisplay();

        SetShowText();
    }