コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        oneflag = true;
        string cur = gameObject.name;

        myx      = int.Parse(cur[0].ToString());
        myy      = int.Parse(cur[2].ToString());
        instance = GameObject.Find("slime").GetComponent <ansslime>();

        render = GetComponent <SpriteRenderer>();
    }
コード例 #2
0
ファイル: JsonTest.cs プロジェクト: huiung/oneShot
    // Start is called before the first frame update
    void Awake()
    {
        instance = GameObject.Find("slime").GetComponent <ansslime>();

        if (Application.platform == RuntimePlatform.Android)
        {
            string oriPath = Path.Combine(Application.streamingAssetsPath, stage + ".json");

            WWW reader = new WWW(oriPath);
            while (!reader.isDone)
            {
            }

            string str   = reader.text;
            Data   data2 = JsonUtility.FromJson <Data>(str);

            for (int i = 0; i < data2.num.Count; i++)
            {
                int first  = int.Parse(data2.num[i][0].ToString());
                int second = int.Parse(data2.num[i][1].ToString());

                instance.myList.Add(new KeyValuePair <int, int>(first, second));
            }
        }
        else
        {
            string str   = File.ReadAllText(Application.dataPath + "/StreamingAssets/" + stage + ".json");
            Data   data2 = JsonUtility.FromJson <Data>(str);
            for (int i = 0; i < data2.num.Count; i++)
            {
                int first  = int.Parse(data2.num[i][0].ToString());
                int second = int.Parse(data2.num[i][1].ToString());

                instance.myList.Add(new KeyValuePair <int, int>(first, second));
            }
        }
    }
コード例 #3
0
ファイル: ansblock.cs プロジェクト: huiung/oneShot
 void Start()
 {
     instance = GameObject.Find("slime").GetComponent<ansslime>();
     spriteRenderer = GetComponent<SpriteRenderer>();
 }