Exemple #1
0
    void OnRespawn(Vector3 spawnPosition, Quaternion spawnRotation)
    {
        transform.position = spawnPosition;
        transform.rotation = spawnRotation;

        SetVisibility(true);
        m_Health = 50;
        OnHealthChanged();

        //The OnRespawn functions of other components make sure that all values are properly reset to their initial values again
        ShipMovement.OnRespawn(spawnRotation.eulerAngles.y);
        ShipVisuals.OnRespawn();

        if (GetComponent <ShipInput>() != null)
        {
            GetComponent <ShipInput>().OnRespawn();
        }

        CameraShipFollow cameraFollow = Camera.main.GetComponent <CameraShipFollow>();

        if (cameraFollow != null && cameraFollow.GetTarget() == this)
        {
            cameraFollow.OnRespawn();
        }
    }