Exemplo n.º 1
0
    private static void checkPrefabForSaveableEnvironment(string s, bool onlyValidateCurrentlyUnchecked)
    {
        GameObject         current       = getPrefabFromPath(s);
        SaveablePrefabRoot saveBehaviour = current.GetComponent <SaveablePrefabRoot>();

        if (saveBehaviour != null)
        {
            checkPrefab(s, saveBehaviour, onlyValidateCurrentlyUnchecked);
        }
        PrefabUtility.UnloadPrefabContents(current);
    }
Exemplo n.º 2
0
 public void TeleportPlayer(Transform player)
 {
     if (isActive)
     {
         SaveablePrefabRoot root = player.parent.GetComponent <SaveablePrefabRoot>();
         SaveablePrefabRoot boat = player.GetComponent <PlayerSailor>().boat?.GetComponent <SaveablePrefabRoot>();
         if (boat != null)
         {
             root.transform.GetChild(0).position = new Vector3(spawnPosition.x, spawnPosition.y + 3, spawnPosition.z); // new Vector3(234, 4, -128);-317 0.5 127.5
             boat.transform.eulerAngles          = spawnRotation;                                                      // new Vector3(0, 180, 0);
                                                                                                                       // boat.getComponent<Boat>().SetSailsTo(0);
             boat.GetComponent <WaterRigidBody>().Velocity = Vector3.zero;
             boat.transform.position = spawnPosition;
             SceneSwitcher.EnterScene(nextSceneName, saveCurrent, loadNext, root, boat);
         }
     }
 }
Exemplo n.º 3
0
    private static void checkPrefab(string path, SaveablePrefabRoot saveablePrefab, bool onlyValidateCurrentlyUnchecked = true)
    {
        string relativePrefabPath = path;

        ///only move the prefab when its not already located in a "Resources" folder
        if (!saveablePrefab.GetReferencer().WasAlreadyValidated || !onlyValidateCurrentlyUnchecked)
        {
            checkAsset(path, saveablePrefab,
                       p => p.gameObject.name,
                       (p, s) =>
            {
                PrefabStage prefabStage = PrefabStageUtility.GetPrefabStage(saveablePrefab.gameObject);
                if (prefabStage != null)
                {
                    EditorSceneManager.MarkSceneDirty(prefabStage.scene);
                }
                PrefabUtility.SaveAsPrefabAsset(saveablePrefab.gameObject, s);
            });
        }
    }