团结 - 空闲游戏 - 第一步

时间:2014-06-15 08:10:47

标签: c# unity3d

我正在使用Unity的第一步和我在PHP / MySQL中进行大量编程之后我想尝试获得我的第一个"真正的"游戏和理解GUI处理以及如何工作不仅仅是每个新页面,我都想创建一个IDLE游戏。有很多可能扩展这样的游戏,这将是最好的开始。 (例如" Cookie Clicker"或" Anti Idle - The Game") 我也已经进行了一次小测试,但这种测试不像我想要的那样:

using UnityEngine;
using System.Collections;

public class CookieCounter1 : MonoBehaviour
{
    int currentCookieCounter;
    int cookiecounter;
    int showMin;
    int showSec;
    float m;
    float s;
    float timeCounter;
    float starttime;

    void Start()
    {
        starttime = Time.time;
    }
    void Update ()
    {
        timeCounter = Time.time - starttime;
        m = (timeCounter / 60f);
        showMin = (int)m;
        s = (timeCounter % 60f);
        showSec = (int)s;
        currentCookieCounter = showSec;
    }
    void OnGUI()
    {
        GUI.Label (new Rect (100, 100, 150, 50), "Cookie Counter"+"_" +currentCookieCounter);
        GUI.Label (new Rect (100, 150, 100, 50), "Sec"+"_" +showSec);
        GUI.Label (new Rect (100, 200, 100, 50), "Min"+"_" +showMin);

        if(GUI.Button(new Rect(20, 70, 80, 20), "COOKIE"))
        {
            //Einen Cookie hinzugefügt
            currentCookieCounter++;
        }
    }
}

但这只是反击...... 我想要实现的是以下内容: backgroundcounter,以毫秒为单位,不可见。 第一次尝试4"建筑物"。每栋建筑也都有可能升级。 如果你"买"每隔几秒钟,建筑物就会产生一定数量的金钱。您可以根据需要购买建筑物。升级将例如提高收入或缩短时间。

总而言之,这是一项简单的任务,但我从来没有在c#中做过什么。

0 个答案:

没有答案
相关问题