public override void OnInspectorGUI() { DrawDefaultInspector(); IVIStarSystem sys = target as IVIStarSystem; if (GUILayout.Button("Enter Parent now!")) { sys.EnterParent(); } if (GUILayout.Button("Enter Child now!")) { sys.EnterChild(sys.NextCurrentStar); } }
public void ResetDistanceAndScale(int level, IVIStarSystem sys) { if (level == 0) { return; } Scale = (level == 1 ? sys.L1_Scale : sys.L2R_Scale); OrbitDistance = (level == 1 ? sys.L1_OrbitDistance : sys.L2R_OrbitDistance); OrbitSpeed = Random.Range(.5f, .8f); OrbitAngleZ = Random.Range(-20f, 20f); OrbitUpOffsetHack = sys.L0_Scale * Random.Range(-0.1f, 0.1f); RevolutionSpeed = Random.Range(1f, 20f); RevolutionUpVector = Random.rotation * Vector3.up; }
public void GenerateNextLevel(int depth, IVIStarSystem sys, List <IVIStar> addTo) { if (depth != 1) { return; } if (Entry is IVIFile) { return; } Entry = new IVIDirectory(Entry.FullPath, 1); // XXX FIXME !! It's ugly ! This is done in two places. DoRecursively(s => s.RegenerateChildren(depth, sys.transform)); DoRecursively(s => s.PlaceChildrenAround()); DoRecursively(ComputedDepth, (s, d) => s.ResetDistanceAndScale(level: 2, sys: sys)); // XXX Hack !! DoRecursively(s => s.SetMaterial()); DoRecursively(s => s.SetLight()); DoRecursively(s => addTo.Add(s)); addTo.Remove(this); }
void Start() { IVISession.SecondaryHand.gestureThrowingForward.MaxBeginDistanceFromUser = MaxBeginDistanceFromUser; IVISession.SecondaryHand.gestureThrowingForward.MinVelocityToThrow = MinVelocityToThrow; TrashDirectory = new IVIDirectory(GetTrashPath(), 0); Debug.Log("Trash path : " + TrashDirectory.FullPath); // Créer un GameObject "Selection" qui est un StarSystem. // On ne fait ça qu'une fois. selection = new GameObject("Selection"); selection.transform.SetParent(transform); selection_star_system = selection.AddComponent <IVIStarSystem>(); #if TEST_WITH_FAKE_ENTRIES selection_star_system.InitialPath = @"C:\Users\Documents\test_clipboard"; #else selection_star_system.InitialPath = null; selection_star_system.InitialDir = new IVIDirectory(new List <IVIEntry>()); #endif // On fait Instantiate pour ne pas prendre le Prefab par référence // (on disable son trailrenderer) selection_star_system.StarPrefab = Instantiate(SourceStarSystem.StarPrefab, selection_star_system.transform); selection_star_system.StarPrefab.name = "ClipboardStarPrefab"; selection_star_system.StarPrefab.GetComponent <TrailRenderer> ().enabled = false; selection_star_system.StarPrefab.SetActive(false); selection_star_system.AllowEnteringStars = false; selection_star_system.AllowSweepingStars = false; selection_star_system.L0_Scale = 0.2f /*/8f*/; selection_star_system.L1_Scale = 0.06f /*/8f*/; selection_star_system.L2R_Scale = selection_star_system.L1_Scale / 6f; selection_star_system.L1_OrbitDistance = 0; selection_star_system.L2R_OrbitDistance = 0; // Le clipboard est une hiérarchie "plate", grâce à la façon // dont l'acte de sélection est géré. selection_star_system.Depth = 1; selection_star_system.VisualDepth = 1; }