Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (timeToLive > 0)
        {
            timeToLive -= Time.deltaTime;
        }
        else
        {
            modifyTerrain.Explode(targetLocation, 2);
            Instantiate(explosion, targetLocation, Quaternion.identity);
            Destroy(gameObject);
        }

        float   t = Mathf.Clamp(timeToLive / explosionTime, 0, 1);
        Vector3 p = Vector3.Lerp(targetLocation, throwLocation, t);

        //Debug.Log("t: " + t + "; " + "p: " + p);
        transform.position = p;
    }