Game Development Reference
In-Depth Information
private MissionMgr _missionMgr;
// Use this for initialization
void Start () {
_missionMgr =
GameObject.Find("Game").GetComponent<MissionMgr>();
}
// Update is called once per frame
void Update () {
for ( int i = 0 ; i <
_missionMgr.missions.Count; i++)
{
Mission m = _missionMgr.missions[i];
if (m.displayName == MissionName)
{
m.activated = setActivated;
m.visible = setVisible;
}
}
}
}
Creating the TriviaCardScript script
This helper script will be attached to all GUITexture pop ups used in this level, the
flaginfo cards, and the user pop ups that happen when the mission's complete. It
centers a texture on screen and scales it to the given dimensions.
1. To draw the texture centered on the screen, we start by calculating the center
of the screen, and then we offset by half the size of the texture. The reason
we do that is because we draw the texture relative to the upper-left corner.
2. The middle of the screen is assigned using the following code:
(ScreenWidth/2.0f, ScreenHeight/2.0f)
Search WWH ::




Custom Search