Ejemplo n.º 1
0
    /**
     * 상점에서 스킬확률 변경시 확률변경 및 UI 변경 함수
     */
    private void SetStat()
    {
        float persent = (1.0f / DATA.getData().ALLSTAT) * 100;

        float fPersent = (Mathf.Round(((DATA.getData().FASTSTAT *persent) / 0.01f)) * 0.01f);
        float sPersent = (Mathf.Round(((DATA.getData().SHILDESTAT *persent) / 0.01f)) * 0.01f);
        float mPersent = (Mathf.Round(((DATA.getData().MAGNETSTAT *persent) / 0.01f)) * 0.01f);

        TextUtills.ReflashPersentText(Fast, fPersent, "%");
        TextUtills.ReflashPersentText(Shilde, sPersent, "%");
        TextUtills.ReflashPersentText(Magnet, mPersent, "%");
    }
Ejemplo n.º 2
0
    /**
     * 에너지 추가되는 시간 체크하는 함수
     */
    void EnergyTimeCheck()
    {
        DATA   data          = DATA.getData();  // PlayerPrefs 데이터를 관리하는 함수를 가져옴
        string nowTimeString = data.ENERGYTIME; // 에너지가 사용되는 마지막 시간을 가져옴

        // 에너지사용마지막 시간이 비어있거나, 에너지가 가득 자있을 경우 반환한다.
        if (nowTimeString.Equals("") || energy >= 7)
        {
            return;
        }


        System.DateTime saveTime = System.Convert.ToDateTime(nowTimeString); // 마지막 시간의 문자열을 시간형태로 변환
        System.DateTime nowTime  = System.DateTime.Now;                      // 현재시간을 가져옴

        System.TimeSpan timeCal = nowTime - saveTime;                        // 두 시간 차를 구함

        int timeCalDay  = timeCal.Days;                                      // 날짜 차이
        int timeCalHour = timeCal.Hours;                                     // 시간 차이
        int timeCalMin  = timeCal.Minutes;                                   // 분 차이

        // 하루 이상 또는 1시간 이상 일 경우 풀에너지
        if (timeCalDay > 0 || timeCalHour > 0)
        {
            data.ENERGY     = DATA.MAXENERGY;
            data.ENERGYTIME = "";
        }
        else  // 분단위 일 경우 확인작업
        {
            int addEnergy = timeCalMin / 3; // 지나간 시간의 에너지 개수

            if ((energy + addEnergy) >= 7)  // 에너지 개수가 맥스일 경우
            {
                energy          = DATA.MAXENERGY;
                data.ENERGY     = DATA.MAXENERGY;
                data.ENERGYTIME = "";
            }
            else                            // 아닐 경우 시간 확인 및 타이머
            {
                // 에너지 추가 및 데이터 저장
                energy     += addEnergy;
                data.ENERGY = energy;

                // 추가된 에너지만큼의 시간 추가 및 마지막 시간 저장
                saveTime        = saveTime.AddMinutes(addEnergy * 3);
                data.ENERGYTIME = TextUtills.DateTimeToString(saveTime);

                // 이후 남은 시간 카운팅코르틴 시작
                StartCoroutine(EnergyChargeText());
            }
        }
    }
Ejemplo n.º 3
0
    // 스코어 점수 올라가는 룰렛 실행
    IEnumerator ScoreAnimation()
    {
        int scoreview = 0;

        yield return(new WaitForSeconds(1.3f));

        for (int i = 0; i < 20; i++)
        {
            scoreview     += score / 20;
            scoretext.text = TextUtills.NumberToCommaText(scoreview);
            yield return(new WaitForSeconds(0.05f));
        }
        scoretext.text = TextUtills.NumberToCommaText(score);
    }
Ejemplo n.º 4
0
    /**
     * 플레이어 이동 거리 확인 및 TextUI변경 코루틴
     */
    IEnumerator PlayerTravelDistance()
    {
        while (true)
        {
            distance += GetGameSpeed() * (Time.deltaTime * 10);             // 시간 경과에 따라 플레이어 이동거리 추가
            TextUtills.ReflashCommaText(distanceText, (int)distance, " M"); // 이동거리 변경에 따라 UI Text 변경

            if (backgroundColorFlag != (int)(distance * 0.01) % 3)          // 현재 컬러와 이동거리가 다를경우 백그라운드 색 변경
            {
                BackgroundColorChange();
            }

            yield return(new WaitForEndOfFrame());
        }
    }
Ejemplo n.º 5
0
    /**
     * 확인창의 버튼 클릭시에 따른 이벤트처리함수
     */
    public void PlusButton(int value) // 0번이 행동력 1번이 돈
    {
        AudioSource.Play();
        switch (value)
        {
        case 0:     // 에너지 추가 버튼 클릭시
            Plus.gameObject.SetActive(true);
            TextUtills.ReflashText(PlusText, "행동력을 충전 : Money -100");
            plus = 1;
            break;

        case 1:     // 골드 추가 버튼 클릭시
            Plus.gameObject.SetActive(true);
            TextUtills.ReflashText(PlusText, "골드를 충전하시겠습니까 ? ");
            plus = 2;
            break;

        case 2:     // 확인창의 확인버튼 클릭시
            if (plus == 1)
            {
                if (DATA.getData().MONEY >= 100)
                {
                    energy += DATA.MAXENERGY;
                    money  -= 100;

                    DATA.getData().MONEY  = money;
                    DATA.getData().ENERGY = energy;

                    ReflashEnergyText();
                }
            }
            else if (plus == 2)
            {
                DATA.getData().MONEY += 9999;
            }

            StartCoroutine(MoneyAnimation());
            Plus.gameObject.SetActive(false);
            plus = 0;
            break;

        case 3:     // 확인창의 취소버튼 클릭시
            Plus.gameObject.SetActive(false);
            plus = 0;
            break;
        }
    }
Ejemplo n.º 6
0
    /**
     * 플레이어 돈이 변경되는 애니메이션 코르틴함수
     */
    IEnumerator MoneyAnimation()
    {
        int saveMoney = DATA.getData().MONEY;

        while (money <= saveMoney)
        {
            yield return(new WaitForSeconds(0.016f));

            int addMoney = money - saveMoney;
            for (int i = 1; addMoney != 0; i += 10)
            {
                money    += 1 * i;
                addMoney /= 10;
            }
            TextUtills.ReflashCommaText(Money, money);
        }
    }
Ejemplo n.º 7
0
    /**
     * 게임 플레이 버튼 이벤트함수
     */
    public void StartButton()
    {
        int energy = DATA.getData().ENERGY;

        if (energy > 0)
        {
            AudioSource.Play();
            energy -= 1;
            DATA.getData().ENERGY = energy;
            if (energy < 7)
            {
                if (DATA.getData().ENERGYTIME.Equals(""))
                {
                    DATA.getData().ENERGYTIME = TextUtills.GetNowDateTime();
                }
            }
            SceneManager.LoadScene("Game");
        }
    }
Ejemplo n.º 8
0
    AudioSource AudioSource;        // BGM 관리 오디오

    void Start()
    {
        // 변수 초기화 및 데이터 불러오기
        AudioSource = GetComponent <AudioSource>();
        money       = DATA.getData().MONEY;
        energy      = DATA.getData().ENERGY;
        int bestScore    = DATA.getData().BESTSCORE;
        int bestDistance = DATA.getData().MAXDISTANCE;

        // 에너지 시간 체크
        EnergyTimeCheck();

        // TextUI text 추가
        ReflashEnergyText();
        TextUtills.ReflashCommaText(Money, money);
        TextUtills.ReflashCommaText(BestScore, bestScore);
        TextUtills.ReflashCommaText(BestDistance, bestDistance, " M");

        // 설정창 프레임표시 확인 및 적용
        initSettingMenu();
    }
Ejemplo n.º 9
0
 /**
  * 스코어 추가 함수
  */
 public void AddScore()
 {
     score += 10;
     TextUtills.ReflashCommaText(ScoreText, score);
 }