本文介绍了递增Y和X轴Unity C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中增加Y轴

例如,我有此数据(预制)

For Example i have this data(prefab)

P = Player B = Boss T = Travern

P = Player B = Boss T = Travern

显示如下:

目前我可以在我的代码中做什么:

What currently i can do in my code:

GameObject o = Instantiate(prefab_big_road[0]) as GameObject;
            o.transform.SetParent(pos_big_road[0]);
            o.transform.localScale = Vector3.one;
            o.transform.localPosition = new Vector3(2.0f,-5.0f,0f);
            //o.transform.localPosition = new Vector3(x * xl, y * yl, 0f);

            if (allchars.Contains(playerwinnopairboth))
            {
                o.GetComponent<UISprite>().spriteName = "layout_player_bigline-01";
                NGUITools.SetActive(o, true);
            }
            if (allchars.Contains(bankerwinnopairboth))
            {
                o.GetComponent<UISprite>().spriteName = "layout_banker_bigline-01";
                NGUITools.SetActive(o, true);
            }

这是

它们全都合而为一.有人可以

They are all in one spot. Could someone please

推荐答案

很抱歉,您的回答很晚.这就是我所做的.

Sorry for the late answer . Here's what i did.

string[,] table = new string[104, 6];

string newPreviousValue = "placeholder";
int xIndex = -1;
int yIndex = 0;

if (table.GetLength(0) < xIndex)
            {
                break;
            }

            if (previousValue.Equals(newPreviousValue) && yIndex < table.GetLength(1) - 1)
            {
                yIndex += 1;
                table[xIndex, yIndex] = previousValue;
            }
            else
            {
                xIndex += 1;
                yIndex = 0;
                table[xIndex, yIndex] = previousValue;
            }
            newPreviousValue = previousValue;

这篇关于递增Y和X轴Unity C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 09:19