递增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;