Created
January 10, 2013 02:48
-
-
Save mogeta/4498993 to your computer and use it in GitHub Desktop.
DeleteObject under DELETE_Y_POS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class CheckFallDelete : MonoBehaviour | |
{ | |
GameObject manager; | |
private const float sendParameter = 1; | |
private const float DELETE_Y_POS = -3; | |
// Use this for initialization | |
void Start () | |
{ | |
manager = GameObject.Find("Manager"); | |
} | |
// Update is called once per frame | |
void Update () | |
{ | |
if (transform.position.y < DELETE_Y_POS) | |
{ | |
manager.SendMessage("receiveFallObject",sendParameter); | |
//Destroy(this); //only delete component | |
Destroy(this.gameObject); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class GameManager : MonoBehaviour | |
{ | |
// Use this for initialization | |
void Start () | |
{ | |
} | |
void receiveFallObject(float param) | |
{ | |
Debug.Log(param); | |
} | |
// Update is called once per frame | |
void Update () | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment