Ejemplo n.º 1
0
    void OnCollisionEnter(Collision col)
    {
        if (this.gameOver)
        {
            return;
        }

        TerrainBlock block = col.gameObject.GetComponent <TerrainBlock> ();

        if (block == null)
        {
            return;
        }

        TerrainBlock.BlockType type = block.blockType;

        if (type == TerrainBlock.BlockType.Nature)
        {
            this.gameOver = true;
            StartCoroutine("WriteInfoTree");
        }
        else if (type == TerrainBlock.BlockType.Building)
        {
            this.gameOver = true;
            StartCoroutine("WriteInfoBuilding");
        }
        else if (type == TerrainBlock.BlockType.Ground)
        {
            if (this.cRigidbody.velocity.sqrMagnitude > this.squareVelocityThreshold)
            {
                this.gameOver = true;
                StartCoroutine("WriteInfoCrash");
            }
            else
            {
                this.gameOver = true;
                StartCoroutine("WriteInfoSuccess");
            }
        }
    }
Ejemplo n.º 2
0
    void OnTriggerEnter(Collider col)
    {
        if (this.gameOver)
        {
            return;
        }

        TerrainBlock block = col.gameObject.GetComponent <TerrainBlock> ();

        if (block == null)
        {
            return;
        }

        TerrainBlock.BlockType type = block.blockType;

        if (type == TerrainBlock.BlockType.Water)
        {
            this.gameOver = true;
            StartCoroutine("WriteInfoWater");
        }
    }