|
Java Code - Array
[Back]
Code:
//The Base Of Array
var test: int[];
var test: float[];
var test: String[];
var test: GameObject[ ];
var test: Texture[ ];
var test: GUIContent[];
//you can call what you want by .image - .text - .tooltip
test.image
or
//The [0, 0, 0,] Can go on to how many you want like [0,0,0,0,0,0,0,0,0,0,0,0,0]
var test: int[] = [0, 0, 0];
var test: float[] = [0, 0, 0];
var test: String[] = [Hi, Hello, What Up];
var test: GameObject[ ];
var test: Texture[ ];
//Here How to review it or add to a value
//So let say we got make a new script and name it (player)
//In Player we made a Var
//Player LV, Max HP, HP, MAX MP, MP, STR, INT, AGI, DEX, MAX XP, XP
static var info: int[] = [1, 100, 100, 50, 50, 5, 2, 10, 5, 100, 0];
//Now on Mouse Down (You going to Gain more XP)
function OnMouseDown()
{
//So first we going to get the name of our Script and that will be (Player)
//Then the Name of our Var and that will be (info)
//Then we will put what one we want to add to
[0] - LV,
[1] - Max HP,
[2] -HP,
[3] -MAX MP,
[4] -MP,
[5] - STR,
[6] INT,
[7] - AGI,
[8] - DEX,
[9] - MAX XP,
[10] - XP (It this one)
player.info.[10] += 1;
//So this will +1 XP to that var
}
//Get length of var by using other var
var test_int: int[] = [0, 0, 0];
var test: Texture[test_int.length];
var test: int[];
var test: float[];
var test: String[];
var test: GameObject[ ];
var test: Texture[ ];
var test: GUIContent[];
//you can call what you want by .image - .text - .tooltip
test.image
or
//The [0, 0, 0,] Can go on to how many you want like [0,0,0,0,0,0,0,0,0,0,0,0,0]
var test: int[] = [0, 0, 0];
var test: float[] = [0, 0, 0];
var test: String[] = [Hi, Hello, What Up];
var test: GameObject[ ];
var test: Texture[ ];
//Here How to review it or add to a value
//So let say we got make a new script and name it (player)
//In Player we made a Var
//Player LV, Max HP, HP, MAX MP, MP, STR, INT, AGI, DEX, MAX XP, XP
static var info: int[] = [1, 100, 100, 50, 50, 5, 2, 10, 5, 100, 0];
//Now on Mouse Down (You going to Gain more XP)
function OnMouseDown()
{
//So first we going to get the name of our Script and that will be (Player)
//Then the Name of our Var and that will be (info)
//Then we will put what one we want to add to
[0] - LV,
[1] - Max HP,
[2] -HP,
[3] -MAX MP,
[4] -MP,
[5] - STR,
[6] INT,
[7] - AGI,
[8] - DEX,
[9] - MAX XP,
[10] - XP (It this one)
player.info.[10] += 1;
//So this will +1 XP to that var
}
//Get length of var by using other var
var test_int: int[] = [0, 0, 0];
var test: Texture[test_int.length];