Пример #1
0
    // Updates currentblock and checks for collisions with diseases
    void OnTriggerEnter2D(Collider2D other)
    {
        if (diseasesabsorbed >= MAX_DISEASE_ABSORBED)
        {
            return;
        }

        if (nextBlock && other.gameObject.name == nextBlock.gameObject.name)
        {
            currentBlock = nextBlock;
        }
        else if (other.gameObject.tag == "Disease")
        {
            Disease disease = other.gameObject.GetComponent <Disease> ();
            if (!disease.captured)
            {
                disease.captured = true;
                disease.BeenCapturedBy(this.gameObject);
                capture.Add(disease);
                diseasesabsorbed++;
                --gameControl.numDiseaseCells;
                disease.currentBlock.diseases.Remove(disease);
            }
        }
    }