Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ALIVE_EnterState()
- {
- for(int fs = 0; fs < health; ++fs)
- {
- Debug.Log("Made a Heart!");
- int fsp = (fs % DEFAULT_HEALTHPERROW);
- int fsz = (int)Mathf.Floor(fs / DEFAULT_HEALTHPERROW);
- float posX = camera.transform.position.x + (-HEALTH_X + (fsp * DEFAULT_HEALTHOFFSET));
- float posY = camera.transform.position.y + (-HEALTH_Y + (fsz * DEFAULT_HEALTHOFFSET));
- Vector3 position = new Vector3(posX, posY, 0);
- GameObject heart = (GameObject)GameObject.Instantiate(healthSpritePrefab, position, Quaternion.identity); // GameObject(Clone) is created
- heart.name = "Heart "+fs;
- if(heart == null)
- {
- Debug.Log("Couldnt Create Heart :(");
- }
- else
- {
- heart.transform.parent = camera.transform;
- healthSprites.Add(heart); // Added to an List
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement