public void AddCloud(AvailableCloud selectedItem) { var name = selectedItem.Name; var letters = VirtualDriveWrapper.GetFreeDriveLettes(); if (letters.Count == 0) { throw new InvalidOperationException("No free letters"); } if (Clouds.Any(c => c.CloudInfo.Name == name)) { int i = 1; while (Clouds.Any(c => c.CloudInfo.Name == name + " " + i)) { i++; } name = name + " " + i; } var info = new CloudInfo { Id = Guid.NewGuid().ToString(), Name = name, ClassName = selectedItem.ClassName, AssemblyFileName = selectedItem.AssemblyFileName, DriveLetter = letters[0] }; var mount = new CloudMount(info, this); Clouds.Add(mount); SaveClouds(); }
private void ProcessCloudNotification(NotificationMessage <Models.Cloud> message) { if (message.Notification.Equals(Messages.OpenCloud)) { CloudViewModel selectedCloudViewModel = Clouds.SingleOrDefault((i) => i.Cloud.Equals(message.Content)); if (selectedCloudViewModel == null) { selectedCloudViewModel = new CloudViewModel(message.Content); Clouds.Add(selectedCloudViewModel); } SelectedCloudView = selectedCloudViewModel; } }
private void OpenApplication(Application application) { if (application.Parent != null) { CloudViewModel selectedCloudViewModel = Clouds.SingleOrDefault((i) => i.Cloud.Equals(application.Parent)); if (selectedCloudViewModel == null) { Models.Cloud currentCloud = provider.Clouds.SingleOrDefault((c) => c.Equals(application.Parent)); selectedCloudViewModel = new CloudViewModel(currentCloud); Clouds.Add(selectedCloudViewModel); } SelectedCloudView = selectedCloudViewModel; } SelectedCloudView.SelectedApplication = application; SelectedCloudView.IsApplicationViewSelected = true; }
public void Start() { World.MakeAnnouncement("A storm is coming!", null); switch (TypeofStorm) { case StormType.RainStorm: SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_rain_storm_alert, 0.15f); break; case StormType.SnowStorm: SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_snow_storm_alert, 0.15f); break; } BoundingBox bounds = World.ChunkManager.Bounds; Vector3 extents = bounds.Extents(); Vector3 center = bounds.Center(); Vector3 windNormalized = WindSpeed / WindSpeed.Length(); Vector3 offset = new Vector3(-windNormalized.X * extents.X + center.X, bounds.Max.Y + 5, -windNormalized.Z * extents.Z + center.Z); Vector3 perp = new Vector3(-windNormalized.Z, 0, windNormalized.X); int numClouds = (int)(MathFunctions.RandInt(10, 100) * Intensity); int numCloudLayers = MathFunctions.RandInt(1, 5); for (int layer = 0; layer < numCloudLayers; layer++) { for (int i = 0; i < numClouds; i++) { Vector3 cloudPos = offset + perp * 5 * (i - numClouds / 2) + MathFunctions.RandVector3Cube() * 10 + windNormalized * 2 * layer; Cloud cloud = new Cloud(World.ComponentManager, Intensity, 5, offset.Y + MathFunctions.Rand(-3.0f, 3.0f), cloudPos, TypeofStorm == StormType.RainStorm ? 0.15f : 0.0f) { Velocity = WindSpeed * 0.5f, TypeofStorm = TypeofStorm }; Clouds.Add(cloud); World.ComponentManager.RootComponent.AddChild(cloud); } } IsInitialized = true; }
//敵オブジェクト配置 void CreateObject(asd.Vector2DF position, int obj) { switch (obj) { case 0: Walls.Add(new Wall(position)); LayerOfMain.AddObject(Walls[Walls.Count - 1]); SetWallRainColligeData(Walls[Walls.Count - 1].Position); break; case 1: Clouds.Add(new Cloud(position, TypeOfCloud.Small)); LayerOfMain.AddObject(Clouds[Clouds.Count - 1]); break; case 2: Clouds.Add(new Cloud(position, TypeOfCloud.Medium)); LayerOfMain.AddObject(Clouds[Clouds.Count - 1]); break; case 3: Clouds.Add(new Cloud(position, TypeOfCloud.Large)); LayerOfMain.AddObject(Clouds[Clouds.Count - 1]); break; case 4: break; case 5: Healers.Add(new Healer(position)); LayerOfMain.AddObject(Healers[Healers.Count - 1]); break; case 6: Winds.Add(new Wind(position)); LayerOfMain.AddObject(Winds[Winds.Count - 1]); break; } }
public void TickClouds() { ActualWind = Wind * Math.Sin(GlobalTickTimeLocal * 0.6); for (int i = 0; i < Clouds.Count; i++) { Clouds[i].Position += Clouds[i].Velocity * Delta; for (int s = 0; s < Clouds[i].Sizes.Count; s++) { Clouds[i].Sizes[s] += 0.05f * (float)Delta; if (Clouds[i].Sizes[s] > Clouds[i].EndSizes[s]) { Clouds[i].Sizes[s] = Clouds[i].EndSizes[s]; } } } if (TheClient.CVars.r_extraclouds.ValueB) { while (Clouds.Count < 1000) { Location cloudPos = TheClient.Player.GetPosition() + new Location(Utilities.UtilRandom.NextDouble() - 0.5, Utilities.UtilRandom.NextDouble() - 0.5, 0) * 10000.0; cloudPos.Z = 100.0; if (Math.Max(Math.Abs(cloudPos.SmallestValue()), Math.Abs(cloudPos.BiggestValue())) < 500f) { continue; } Cloud cld = new Cloud(this, cloudPos) { CID = -1024 }; double size = Utilities.UtilRandom.NextDouble() * 16 + 16; cld.EndSizes.Add((float)size); cld.Sizes.Add((float)size); cld.Points.Add(new Location(0, 0, 0)); cld.Velocity = new Location(0, 0, 0); Clouds.Add(cld); } } }
/// <summary> /// Spawns a new cloud into the world. /// </summary> /// <param name="cloud">The cloud to spawn.</param> public void SpawnCloud(Cloud cloud) { cloud.CID = TheServer.AdvanceCloudID(); Clouds.Add(cloud); }