예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (tapCount > 31535999)
        {
            timeText.text = "Time: " +
                            tapCount.ToYears() + " Y : " +
                            tapCount.ToDays() + " D : " +
                            tapCount.ToHours() + " H : " +
                            tapCount.ToMinutes() + " M";
        }
        else
        {
            timeText.text = "Time: " +
                            tapCount.ToDays() + " D : " +
                            tapCount.ToHours() + " H : " +
                            tapCount.ToMinutes() + " M : " +
                            tapCount.ToSeconds() + " S";
        }

        goldText.text = "Gold: " + gold.CurrentGold;


        int touchCount = Input.touchCount;

        if (touchCount <= 0)
        {
            return;
        }

        for (int i = 0; i < touchCount; i++)
        {
            if (EventSystem.current.IsPointerOverGameObject(i))
            {
                continue;
            }

            TouchPhase phase = Input.GetTouch(i).phase;

            if (!phase.Is(TouchPhase.Began))
            {
                continue;
            }

            if (onTapPrefab)
            {
                Vector3 position = Camera.main.ScreenToWorldPoint(Input.GetTouch(i).position);
                position.z += 10;
                GameObject text = Instantiate(onTapPrefab, position, Quaternion.identity).gameObject;
                text.GetComponent <TextMeshPro>().text = "+" + tapValue + "s";
                Destroy(text, 1);
            }

            tapCount += tapValue;
            gold.AddGold(tapValue);
        }
    }
예제 #2
0
 public void sellFish(BigInteger amount)
 {
     if (fish.Weight >= amount)
     {
         fish.Weight -= amount;
         var dAmount = (double)amount;
         var result  = dAmount * marketPrice;
         Gold.AddGold(new BigInteger(result));
     }
 }
예제 #3
0
 public void Click()
 {
     Gold.AddGold(Converters.StringToBigInt(goldToAddOnClick));
 }