Ejemplo n.º 1
0
    public void crashShip()
    {
        if((Time.timeSinceLevelLoad - lastCrashed) < crashLimit) return;

        gameManager = getGameManager();
        Vector3 newPos = new Vector3(transform.position.x, 20, transform.position.z);
        gameManager.decrementLives();
        GameObject explosion = (GameObject) Instantiate(Resources.Load("Explosion"), newPos, transform.rotation);
        if(gameManager.getCurrentLives() > 0) {
            gameObject.transform.position = Vector3.zero;
            gameObject.rigidbody.velocity = Vector3.zero;
            lastCrashed = Time.timeSinceLevelLoad;
        } else {
            DestroyObject(this.gameObject);
        }
    }