Game Development Reference
In-Depth Information
case "xScale":
xScale =
Convert.ToSingle(eNode.InnerText);
break;
case "yScale":
yScale =
Convert.ToSingle(eNode.InnerText);
break;
case "zScale":
zScale =
Convert.ToSingle(eNode.InnerText);
break;
}
Enemies[e].name = name;
Enemies[e].transform.localPosition =
new Vector3(xPos, yPos, zPos);
Enemies[e].transform.localRotation =
new Quaternion(xRot, yRot, zRot, 0.00f);
Enemies[e].transform.localScale = new
Vector3(xScale, yScale, zScale);
}
}
}
}
}
Just as we did to load player data, we create placeholder variables. Next, we use a
for loop to iterate through the enemies' GameObject array and then check to see
whether that GameObject is null or not. After this, we go through the process of load-
ing our data.
First, we create the root node and then create the enemy node; these will be the
same as those in the EnemyData XML. To assign the enemy node, we assign to
the current child node within the root node. We match the child node with the enemy
GameObject by using the same iterator from the for loop.
Search WWH ::




Custom Search