示例#1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.name == "Beam") {
         m_beam = other.GetComponent<BeamBehavior>();
         //Debug.Log(this + " is beaming");
     }
 }
示例#2
0
 void OnTriggerExit2D(Collider2D other)
 {
     if (other.gameObject.name == "Beam") {
         m_beam = null;
         //Debug.Log(this + " is not beaming");
     }
 }
示例#3
0
    // Use this for initialization
    void Start()
    {
        m_body = GetComponent<Rigidbody2D>();
        m_beam = transform.Find("Beam").GetComponent<BeamBehavior>();

        //m_engineFlame = transform.Find("EngineFlame").GetComponent<ParticleSystem>();
        m_engine = transform.FindChild("EngineFlame").gameObject;
        if (m_engine == null)
            Debug.LogError("No EngineFlame");

        if (WinSound == null)
            Debug.LogError("WinSound null");

        m_humans = GameObject.FindGameObjectsWithTag("Human");
        Debug.Log(string.Format("{0} humans, game will end at {1} score", m_humans.Length, m_humans.Length * 100));

        m_scoreText = GameObject.Find("Score").GetComponent<Text>();
        if (m_scoreText == null)
            Debug.LogError("No game object named Score found");
        AddScore(0);
    }