Exemplo n.º 1
0
    // Use this for initialization
    void Awake()
    {
        if (transformVariable == null)
        {
            return;
        }
        if (!transformVariable.loaded)
        {
            transformVariable.OnAfterDeserialize();
        }

        if (saveObject != null)
        {
            saveObject.LoadData();
        }

        if (spawnPoint == null)
        {
            transform.position = transformVariable.RuntimePosition;
            transform.Rotate(transformVariable.RuntimeRotation);
            transform.localScale = transformVariable.RuntimeScale;
        }
        else
        {
            spawnPoint.transform.position = transformVariable.RuntimePosition;
            spawnPoint.transform.Rotate(transformVariable.RuntimeRotation);
            spawnPoint.transform.localScale = transformVariable.RuntimeScale;
            vp_PlayerRespawner playerRespawn = GetComponent <vp_PlayerRespawner>();
            //playerRespawn.Respawn();
        }
        loaded = true;
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        TransformVariable transformVariable = (TransformVariable)target;

        if (Application.isEditor && !Application.isPlaying)
        {
            transformVariable.OnAfterDeserialize();
        }
        GUILayout.Label("Runtime Values:");
        GUILayout.Label("Position: " + transformVariable.RuntimePosition.ToString());
        GUILayout.Label("Rotation: " + transformVariable.RuntimeRotation.ToString());
        GUILayout.Label("Scale: " + transformVariable.RuntimeScale.ToString());
    }