[英]Increment a Y and X axis Unity C#
我如何在C#中增加Y軸
例如我有這個數據(預制)
P = Player B = Boss T = Travern
如下所示:
目前我可以在我的代碼中做什么:
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);
}
這是
他們都集中在一個地方。 有人可以嗎
o.transform.localPosition=new Vector3 (o.transform.localPosition.x,o.transform.localPosition.y+i,o.transform.localPosition.z);
應該只將y軸增加i;
抱歉回復晚了 。 這就是我所做的。
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;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.