구름들 관리 스크립트
Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 /// <summary>
 /// Proceed sanity check of inserted values.
 /// </summary>
 /// <param name="errors">Found errors.</param>
 /// <param name="warnings">Found warnings.</param>
 public override void SanityCheck(ref List <string> errors, ref List <string> warnings)
 {
     Wind?.SanityCheck(ref errors, ref warnings);
     Visibility?.SanityCheck(ref errors, ref warnings);
     Phenomena?.SanityCheck(ref errors, ref warnings);
     Clouds?.SanityCheck(ref errors, ref warnings);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns item in code string.
        /// </summary>
        /// <returns></returns>
        public override string ToCode()
        {
            StringBuilder ret = new StringBuilder();

            ret.AppendPreSpaced(Type.ToString());
            Times.ForEach(
                i => ret.AppendPreSpaced(i.ToCode()));
            if (Wind != null)
            {
                ret.AppendPreSpaced(Wind.ToCode());
            }
            if (Visibility != null)
            {
                ret.AppendPreSpaced(Visibility.ToCode());
            }
            if (Phenomena != null)
            {
                ret.AppendPreSpaced(Phenomena.ToCode());
            }
            if (Clouds != null)
            {
                ret.AppendPreSpaced(Clouds.ToCode());
            }

            return(ret.ToString().TrimEnd());
        }
Ejemplo n.º 3
0
    // Prepares the stage for playing
    // Also begins a new game if one hasn't been started yet for easier debugging
    public void SetupStage()
    {
        // Make sure simulation parameters is loaded
        if (SimulationParameters.Instance == null)
        {
            GD.PrintErr("Something bad happened with SimulationParameters loading");
        }

        // Make sure settings is loaded
        if (Settings.Instance == null)
        {
            GD.PrintErr("Settings load problem");
        }

        spawner.Init();
        Clouds.Init(FluidSystem);

        if (CurrentGame == null)
        {
            StartNewGame();
        }

        CreatePatchManagerIfNeeded();

        StartMusic();
    }
Ejemplo n.º 4
0
        public void SaveNullShouldNotTryAddToDatabase()
        {
            //Arrange
            WeatherMain expecWeatherMain = new WeatherMain()
            {
                Humidity       = 0,
                Pressure       = 0,
                Temperature    = 0,
                TemperatureMin = 0,
                TemperatureMax = 0,
            };
            Wind expectedWind = new Wind()
            {
                Direction = 0,
                Speed     = 0
            };
            PredictionDate expectedPredictionDate = new PredictionDate()
            {
                Time = DateTime.Now,
            };
            Clouds expectedClouds = new Clouds()
            {
                All = 0
            };
            Forecast expectedForecast = new Forecast()
            {
                Clouds      = expectedClouds,
                WeatherMain = expecWeatherMain,
                Wind        = expectedWind,
                Time        = expectedPredictionDate,
                CityId      = 0
            };
            ForecastEntity expectedEntity = new ForecastEntity()
            {
                WeatherMain    = expecWeatherMain,
                Wind           = expectedWind,
                PredictionDate = expectedPredictionDate,
                Clouds         = expectedClouds,
                CityServiceId  = 0,
                Forecast       = expectedForecast
            };

            var weatherContextMock = new Mock <WeatherDataContext>();

            weatherContextMock.Setup(x => x.Forecast.Add(It.IsAny <Forecast>())).Returns((Forecast f) => f);
            weatherContextMock.Setup(x => x.City.Add(It.IsAny <City>())).Returns((City f) => f);
            weatherContextMock.Setup(x => x.Clouds.Add(It.IsAny <Clouds>())).Returns((Clouds f) => f);
            weatherContextMock.Setup(x => x.PredictionDate.Add(It.IsAny <PredictionDate>())).Returns((PredictionDate f) => f);
            weatherContextMock.Setup(x => x.WeatherMain.Add(It.IsAny <WeatherMain>())).Returns((WeatherMain f) => f);
            weatherContextMock.Setup(x => x.Wind.Add(It.IsAny <Wind>())).Returns((Wind f) => f);
            WeatherManager weather = new WeatherManager(weatherContextMock.Object);

            //Act

            var savedEntities = weather.SaveForecastEntity(expectedEntity).Result;

            //Assert
            Assert.Equal(1, savedEntities);
            weatherContextMock.Verify(x => x.SaveChangesAsync(), Times.Never);
        }
Ejemplo n.º 5
0
    /// <summary>Create the level.</summary>
    /// <param name="levelIndex">The index of the level.</param>
    public Level(int levelIndex)
    {
        // load the backgrounds
        GameObjectList backgrounds = new GameObjectList(0, "backgrounds");
        SpriteGameObject background_main = new SpriteGameObject("Backgrounds/spr_sky");
        background_main.Position = new Vector2(0, GameEnvironment.Screen.Y - background_main.Height);
        backgrounds.Add(background_main);

        Add(new GameObjectList(1, "waterdrops"));
        Add(new GameObjectList(2, "enemies"));

        LoadTiles("Content/Levels/" + levelIndex + ".txt");

        // add a few random mountains
        for (int i = 0; i < 5; i++)
        {
            SpriteGameObject mountain = new SpriteGameObject("Backgrounds/spr_mountain_" + (GameEnvironment.Random.Next(2) + 1), 1, "", 0, SpriteGameObject.Backgroundlayer.background);
            mountain.Position = new Vector2((float)GameEnvironment.Random.NextDouble() * (width * cellWidth) - mountain.Width / 2,
                (height * cellHeight) - mountain.Height);
            backgrounds.Add(mountain);
        }

        Clouds clouds = new Clouds(2, "", this);
        backgrounds.Add(clouds);
        Add(backgrounds);

        SpriteGameObject timerBackground = new SpriteGameObject("Sprites/spr_timer", 100);
        timerBackground.Position = new Vector2(10, 10);
        Add(timerBackground);
        
        quitButton = new Button("Sprites/spr_button_quit", 100);
        quitButton.Position = new Vector2(GameEnvironment.Screen.X - quitButton.Width - 10, 10);
        Add(quitButton);
        
    }
Ejemplo n.º 6
0
    public Level(int levelIndex)
    {
        GameObjectList   backgrounds     = new GameObjectList(0, "backgrounds");
        SpriteGameObject background_main = new SpriteGameObject("Backgrounds/spr_sky");

        background_main.Position = new Vector2(0, GameEnvironment.Screen.Y - background_main.Sprite.SheetHeight);
        backgrounds.Add(background_main);

        for (int i = 0; i < 5; i++)
        {
            SpriteGameObject mountain = new SpriteGameObject("Backgrounds/spr_mountain_" + (GameEnvironment.Random.Next(2) + 1), 1);
            mountain.Position = new Vector2((float)GameEnvironment.Random.NextDouble() * GameEnvironment.Screen.X - mountain.Sprite.SheetWidth / 2, GameEnvironment.Screen.Y - mountain.Sprite.SheetHeight);
            backgrounds.Add(mountain);
        }

        Clouds clouds = new Clouds(2);

        backgrounds.Add(clouds);
        this.Add(backgrounds);

        QuitButton          = new Button("Sprites/spr_button_back", 100);
        QuitButton.Position = new Vector2(10, 10);
        this.Add(QuitButton);

        this.Add(new GameObjectList(1, "ZenyS"));

        this.LoadTiles("Content/Levels/" + levelIndex + ".txt");

        GameObjectList ZenyS = this.Find("ZenyS") as GameObjectList;

        GameScore          = new Score(ZenyS);
        GameScore.Position = new Vector2(GameEnvironment.Screen.X - 60, 10);
        this.Add(GameScore);
    }
Ejemplo n.º 7
0
        public void SaveClouds()
        {
            var settings = Properties.Settings.Default;

            settings.Clouds = new CloudInfoCollection(Clouds.Select(c => c.CloudInfo));
            settings.Save();
        }
Ejemplo n.º 8
0
    public Level(int levelIndex)
    {
        // load the backgrounds
        GameObjectList   backgrounds   = new GameObjectList(0, "backgrounds");
        SpriteGameObject backgroundSky = new SpriteGameObject("Backgrounds/spr_sky", 1);

        backgroundSky.Position = new Vector2(0, GameEnvironment.Screen.Y - backgroundSky.Height);
        backgrounds.Add(backgroundSky);

        // add a few random mountains
        for (int i = 0; i < 5; i++)
        {
            SpriteGameObject mountain = new SpriteGameObject("Backgrounds/spr_mountain_" + (GameEnvironment.Random.Next(2) + 1), (GameEnvironment.Random.Next(3, 5)));
            mountain.Position = new Vector2((float)GameEnvironment.Random.NextDouble() * GameEnvironment.Screen.X - mountain.Width / 2,
                                            GameEnvironment.Screen.Y - mountain.Height);
            backgrounds.Add(mountain);
        }

        Clouds clouds = new Clouds(4);

        backgrounds.Add(clouds);
        Add(backgrounds);

        quitButton          = new Button("Sprites/spr_button_quit", 100);
        quitButton.Position = new Vector2(GameEnvironment.Screen.X - quitButton.Width - 10, 10);
        Add(quitButton);

        Add(new GameObjectList(6, "waterdrops"));
        Add(new GameObjectList(7, "enemies"));

        LoadTiles("Content/Levels/" + levelIndex + ".txt");
    }
Ejemplo n.º 9
0
        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();
        }
Ejemplo n.º 10
0
    /// <summary>
    ///   Updates CompoundsAtMouse and MicrobesAtMouse
    /// </summary>
    private void UpdateMouseHover()
    {
        CompoundsAtMouse = Clouds.GetAllAvailableAt(Camera.CursorWorldPos);

        var microbes = GetTree().GetNodesInGroup(Constants.AI_TAG_MICROBE);

        foreach (var microbe in MicrobesAtMouse)
        {
            microbe.IsHoveredOver = false;
        }

        MicrobesAtMouse.Clear();

        foreach (Microbe entry in microbes)
        {
            var distance = (entry.GlobalTransform.origin - Camera.CursorWorldPos).Length();

            // Find only cells that have the mouse
            // position within their membrane
            if (distance > entry.Radius + Constants.MICROBE_HOVER_DETECTION_EXTRA_RADIUS)
            {
                continue;
            }

            entry.IsHoveredOver = true;
            MicrobesAtMouse.Add(entry);
        }
    }
Ejemplo n.º 11
0
 void Start()
 {
     mapGenerator   = GetComponent <MapGenerator>();
     cloudGenerator = GameObject.Find("Clouds").GetComponent <Clouds>();
     brushScript    = Camera.main.GetComponent <Brush>();
     menuOpened     = false;
 }
Ejemplo n.º 12
0
        public WaveTrend_Oscillator()
            : base()
        {
            #region Initialization
            Credentials.ProjectName = "WaveTrend Oscillator";
            #endregion

            Lines.Set("Channel Length");
            Lines["Channel Length"].Color = Color.Red;
            Lines["Channel Length"].Style = LineStyle.Dot;

            Lines.Set("Average Length");
            Lines["Average Length"].Color = Color.LimeGreen;

            Thresholds.Set("Over Bought Level 1");
            Thresholds["Over Bought Level 1"].Level = 60;
            Thresholds["Over Bought Level 1"].Color = Color.Gray;

            Thresholds.Set("Over Bought Level 2");
            Thresholds["Over Bought Level 2"].Level = 53;
            Thresholds["Over Bought Level 2"].Color = Color.Gray;

            Thresholds.Set("Over Sold Level 1");
            Thresholds["Over Sold Level 1"].Level = -60;
            Thresholds["Over Sold Level 1"].Color = Color.Gray;

            Thresholds.Set("Over Sold Level 2");
            Thresholds["Over Sold Level 2"].Level = -53;
            Thresholds["Over Sold Level 2"].Color = Color.Gray;

            Clouds.Set("Cloud", GradientMode.Simple, Color.CadetBlue, Color.CadetBlue);


            SeparateWindow = true;
        }
Ejemplo n.º 13
0
 public Weather()
 {
     Precipitation = new Precipitation();
     Wind = new Wind();
     Temperature = new Temperature();
     Pressure = new Pressure();
     Humidity = new Humidity();
     Clouds = new Clouds();
 }
Ejemplo n.º 14
0
 public CurrentWeatherConditions()
 {
     weather = new List <Weather>();
     wind    = new Wind();
     coord   = new Coord();
     main    = new Main();
     clouds  = new Clouds();
     sys     = new Sys();
 }
Ejemplo n.º 15
0
 void Awake()
 {
     Instance = this;
     cloudmat = GetComponent <Renderer>().sharedMaterial;
     people   = new Vector4[10];
     for (int i = 0; i < people.Length; i++)
     {
         people[i] = new Vector4(float.MaxValue, float.MaxValue, float.MaxValue, 1);
     }
 }
Ejemplo n.º 16
0
    public override void Start()
    {
        // We setup our scene, main camera and viewport
        _viewport = GetSubsystem <Renderer>().GetViewport(0);
        _scene    = new Scene();
        _scene.CreateComponent <Octree>().SetSize(new BoundingBox(1, 100), 3);
        _viewport.Scene       = _scene;
        _camera               = _scene.CreateChild("Camera").CreateComponent <Camera>();
        _camera.Node.Position = new Vector3(50, 10, -1);
        _camera.Orthographic  = true;
        _camera.OrthoSize     = 26;
        _viewport.Camera      = _camera;

        // We create a sound source for the music and the music
        SoundSource musicSource = _scene.CreateComponent <SoundSource>();
        Sound       music       = Cache.Get <Sound>("music/Happy_Bee.ogg");

        music.SetLooped(true);
        musicSource.Play(music);
        musicSource.SetSoundType("Music");

        // We don't need a sound listener for the above, but we add one for the sounds and adjust the music gain
        Audio audioSystem = GetSubsystem <Audio>();

        audioSystem.SetListener(_camera.Node.CreateComponent <SoundListener>());
        audioSystem.SetMasterGain("Music", 0.3f);

        // We create a background node which is a child of the camera so it won't move relative to it
        Node           bg    = _camera.Node.CreateChild("Background");
        StaticSprite2D bgspr = bg.CreateComponent <StaticSprite2D>();

        bgspr.SetSprite(Cache.Get <Sprite2D>("scenarios/grasslands/bg.png"));
        bg.SetPosition(new Vector3(0, 0, 100));
        bg.SetScale2D(Vector2.One * 5);

        // We add a physics world so we can simulate physics, and enable CCD
        PhysicsWorld2D pw = _scene.CreateComponent <PhysicsWorld2D>();

        pw.SetContinuousPhysics(true);

        // We create a terrain, vehicle and cloud system
        _terrain = new Terrain(_scene);
        _vehicle = CreateVehicle(new Vector2(50, 10));
        _clouds  = new Clouds(50, 5, 40, 16, 40);

        // We subscribe to the PostUpdateEvent
        SubscribeToEvent <PostUpdateEvent>(PostUpdate);

        // If we're building a debug release, we draw debug data
        #if DEBUG
        DebugRenderer dbr = _scene.CreateComponent <DebugRenderer>();
        pw.SetDrawCenterOfMass(true); pw.SetDrawJoint(true); pw.SetDrawPair(true); pw.SetDrawShape(true);
        SubscribeToEvent <PostRenderUpdateEvent>(e => { _scene.GetComponent <PhysicsWorld2D>().DrawDebugGeometry(dbr, false); });
        #endif
    }
Ejemplo n.º 17
0
 /// <summary>
 /// Removes a cloud from the server and any clients that can see it.
 /// </summary>
 /// <param name="cloud">The cloud to remove.</param>
 public void DeleteCloud(Cloud cloud)
 {
     foreach (PlayerEntity player in Players)
     {
         if (player.ShouldSeePosition(cloud.Position))
         {
             player.Network.SendPacket(new RemoveCloudPacketOut(cloud.CID));
         }
     }
     Clouds.Remove(cloud);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Removes a cloud from the server and any clients that can see it.
 /// </summary>
 /// <param name="cloud">The cloud to remove.</param>
 public void DeleteCloud(Cloud cloud)
 {
     foreach (PlayerEntity player in Players)
     {
         if (player.VisibleClouds.Contains(cloud.CID))
         {
             player.Network.SendPacket(new RemoveCloudPacketOut(cloud.CID));
         }
     }
     Clouds.Remove(cloud);
 }
Ejemplo n.º 19
0
 public ViewDitailsViewModel(Rain rain, Wind wind, Clouds clouds, Weather[] weather, Main main)
 {
     OnClickedBackCommand = new Command(async() =>
     {
         await Application.Current.MainPage.Navigation.PopModalAsync();
     });
     WindSpeed   = wind.speed.ToString();
     Pressure    = main.pressure.ToString();
     HumidityTxt = main.humidity.ToString();
     Rainfall    = (rain == null) ? "No rain" : rain._3h.ToString();
 }
Ejemplo n.º 20
0
 protected override void OnQueryChanged(string oldValue, string newValue)
 {
     base.OnQueryChanged(oldValue, newValue);
     if (string.IsNullOrWhiteSpace(newValue))
     {
         ItemsSource = null;
     }
     else
     {
         ItemsSource = Clouds
                       .Where(cloud => cloud.Name.ToLower().Contains(newValue.ToLower())).ToList <Cloud>();
     }
 }
Ejemplo n.º 21
0
 public record Forecast(
     Coord coord,
     Weather[] weather,
     Main main,
     int visibility,
     Wind wind,
     Clouds clouds,
     long dt,
     Sys sys,
     int timezone,
     int id,
     string name,
     int cod);
Ejemplo n.º 22
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            soldier = new soldiers(Content.Load <Texture2D>("Devilman"), Content.Load <Texture2D>("Swordsman"), Content.Load <SoundEffect>("Explosion"));
            effects = new Effects(Content.Load <Texture2D>("svart"));
            menu    = new Menu(Content.Load <Texture2D>("Button"), Content.Load <SpriteFont>("basic"), Content.Load <SoundEffect>("Select"));
            road    = new Road(Content.Load <Texture2D>("svart"));
            map     = new Map(Content.Load <Texture2D>("Castle"), Content.Load <Texture2D>("Tavern"), Content.Load <Texture2D>("svart"), Content.Load <SpriteFont>("basic"));
            clouds  = new Clouds(Content.Load <Texture2D>("Cloud"));
            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 23
0
        public Environment(int skyLayers, GraphicsDeviceManager graphicsDeviceManager, float resolutionRatio)
        {
            Time = new Time();

            initializeAmbientalLightShader();

            sky   = new Sky(graphicsDeviceManager);
            stars = new Stars(graphicsDeviceManager, resolutionRatio, Time);
            moon  = new Moon(graphicsDeviceManager, resolutionRatio);
            sun   = new Sun(graphicsDeviceManager, resolutionRatio);

            clouds = new Clouds(skyLayers, graphicsDeviceManager, resolutionRatio);
        }
Ejemplo n.º 24
0
 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;
     }
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Proceed sanity check of inserted values.
 /// </summary>
 /// <param name="errors">Found errors.</param>
 /// <param name="warnings">Found warnings.</param>
 public void SanityCheck(ref List <string> errors, ref List <string> warnings)
 {
     Date.SanityCheck(ref errors, ref warnings);
     Wind.SanityCheck(ref errors, ref warnings);
     Visibility.SanityCheck(ref errors, ref warnings);
     if (Phenomens != null)
     {
         if (Phenomens.IsEmpty())
         {
             warnings.Add("Phenomens are used but are empty.");
         }
         Phenomens.SanityCheck(ref errors, ref warnings);
     }
     if (Clouds != null)
     {
         if (Clouds.IsEmpty())
         {
             warnings.Add("Clouds are used but are empty.");
         }
         Clouds.SanityCheck(ref errors, ref warnings);
     }
     Pressure.SanityCheck(ref errors, ref warnings);
     if (RePhenomens != null)
     {
         if (RePhenomens.IsEmpty())
         {
             warnings.Add("Re-phenomens are used but are empty.");
         }
         RePhenomens.SanityCheck(ref errors, ref warnings);
     }
     if (WindShears != null)
     {
         if (WindShears.IsEmpty())
         {
             warnings.Add("Windshears are used but are empty.");
         }
         WindShears.SanityCheck(ref errors, ref warnings);
     }
     if (RunwayConditions != null)
     {
         if (RunwayConditions.IsEmpty())
         {
             warnings.Add("Runway conditions are used but are empty.");
         }
         RunwayConditions.SanityCheck(ref errors, ref warnings);
     }
     if (Trend != null)
     {
         Trend.SanityCheck(ref errors, ref warnings);
     }
 }
Ejemplo n.º 26
0
    private void ApplyPropertiesFromSave(MicrobeStage savedMicrobeStage)
    {
        SaveApplyHelper.CopyJSONSavedPropertiesAndFields(this, savedMicrobeStage, new List <string>()
        {
            "spawner",
            "Player",
            "Camera",
            "Clouds",
        });

        spawner.ApplyPropertiesFromSave(savedMicrobeStage.spawner);
        Clouds.ApplyPropertiesFromSave(savedMicrobeStage.Clouds);
        Camera.ApplyPropertiesFromSave(savedMicrobeStage.Camera);
    }
Ejemplo n.º 27
0
 /// <summary>
 /// initForecastObjects init and allocate all forecast objects
 /// </summary>
 private void initForecastObjects()
 {
     this.location      = new Location();
     this.sunRise       = new SunRise();
     this.temperature   = new Temperature();
     this.humidity      = new Humidity();
     this.pressure      = new Pressure();
     this.windSpeed     = new WindSpeed();
     this.windDirection = new WindDirection();
     this.clouds        = new Clouds();
     this.precipitation = new Precipitation();
     this.weather       = new Weather();
     this.lastupdate    = new Lastupdate();
 }
Ejemplo n.º 28
0
    public Level(int levelIndex)
    {
        // load the backgrounds
        GameObjectList   backgrounds   = new GameObjectList(0, "backgrounds");
        SpriteGameObject backgroundSky = new SpriteGameObject("Backgrounds/spr_sky");

        backgroundSky.CameraFollow = false;                                                         //blijft staan ten opzichte van de camera
        backgroundSky.Position     = new Vector2(0, GameEnvironment.Screen.Y - backgroundSky.Height);
        backgrounds.Add(backgroundSky);

        // add a few random mountains
        for (int i = 0; i < 5; i++)
        {
            SpriteGameObject mountain = new SpriteGameObject("Backgrounds/spr_mountain_" + (GameEnvironment.Random.Next(2) + 1), i);
            mountain.Position = new Vector2((float)GameEnvironment.Random.NextDouble() * GameEnvironment.Screen.X - mountain.Width / 2,
                                            GameEnvironment.Screen.Y - mountain.Height);
            mountain.ParallaxFollow = true;                     //layers bergen bewegen anders ten opzichte van elkaar
            backgrounds.Add(mountain);
        }

        Clouds clouds = new Clouds(2);

        backgrounds.Add(clouds);

        Add(backgrounds);

        SpriteGameObject timerBackground = new SpriteGameObject("Sprites/spr_timer", 100);

        timerBackground.Position     = new Vector2(10, 10);
        timerBackground.CameraFollow = false;                       //timer blijft staan
        Add(timerBackground);


        quitButton              = new Button("Sprites/spr_button_quit", 100);
        quitButton.Position     = new Vector2(GameEnvironment.Screen.X - quitButton.Width - 10, 10);
        quitButton.CameraFollow = false;                            //quite button blijft staan
        Add(quitButton);


        Add(new GameObjectList(1, "waterdrops"));
        Add(new GameObjectList(2, "enemies"));
        Add(new GameObjectList(2, "bullets"));                      //nieuwe bullet Lis aan maken, op Layer twee, aangezien de enemies daar ook zitten.

        LoadTiles("Content/Levels/" + levelIndex + ".txt");
        TimerGameObject timer = new TimerGameObject(time, 101, "timer");        //initialize new timerGameObject

        timer.Position = new Vector2(25, 30);                                   //new time Object position
        Add(timer);
    }
Ejemplo n.º 29
0
    // Prepares the stage for playing
    // Also begins a new game if one hasn't been started yet for easier debugging
    public void SetupStage()
    {
        // Make sure simulation parameters is loaded
        if (SimulationParameters.Instance == null)
        {
            GD.PrintErr("Something bad happened with SimulationParameters loading");
        }

        // Make sure settings is loaded
        if (Settings.Instance == null)
        {
            GD.PrintErr("Settings load problem");
        }

        if (!IsLoadedFromSave)
        {
            spawner.Init();

            if (CurrentGame == null)
            {
                StartNewGame();
            }
        }

        if (CurrentGame == null)
        {
            throw new InvalidOperationException("current game is not set");
        }

        tutorialGUI.EventReceiver = TutorialState;
        pauseMenu.GameProperties  = CurrentGame;

        Clouds.Init(FluidSystem);

        CreatePatchManagerIfNeeded();

        StartMusic();

        if (IsLoadedFromSave)
        {
            HUD.OnEnterStageTransition(false);
            UpdatePatchSettings(true);
        }
        else
        {
            HUD.OnEnterStageTransition(true);
            TutorialState.SendEvent(TutorialEventType.EnteredMicrobeStage, EventArgs.Empty, this);
        }
    }
Ejemplo n.º 30
0
    // Start is called before the first frame update
    void Start()

    {
        minMax          = new int[] { int.MaxValue, 0 };
        temp            = new float[resolution * resolution];
        clouds          = FindObjectOfType <Clouds>();
        threadGroupSize = Mathf.CeilToInt(resolution / numThreads);

        RenderTexture tex = CreateTexture(texture, resolution);

        //RenderTexture tex2D = CreateTexture2D(texture2D, resolution);
        //CSMain
        Vector3[] cellData = CreateNoise(noiseResolution, new System.Random(5));
        CreateComputeBuffer(cellData, sizeof(float) * 3, 0, "points");//applies data to a buffer and attaches it to compute buffer
        ComputeBuffer minMaxBuffer = CreateComputeBuffer(minMax, sizeof(int), 0, "minMax");

        computeShader.SetTexture(0, "Result", tex);
        //Delete it
        //computeShader.SetTexture(0, "Result2D", tex2D);
        computeShader.SetInt("resolution", resolution);
        computeShader.SetInt("numCells", noiseResolution);
        computeShader.Dispatch(0, threadGroupSize, threadGroupSize, threadGroupSize);

        int[] arrays = new int[2];
        minMaxBuffer.GetData(arrays);
        bool csNormalize = false;

        if (csNormalize)
        {
            CopyTexture(tex, ref tex3d, resolution);
            Debug.Log("Min= " + arrays[0] + " max = " + arrays[1]);
            //CSNormalize
            computeShader.SetBuffer(1, "minMax", minMaxBuffer);
            computeShader.SetTexture(1, "ResultA", tex);
            computeShader.SetTexture(1, "tempTex", tex3d);

            computeShader.Dispatch(1, threadGroupSize, threadGroupSize, threadGroupSize);
        }
        //now setting 2d texture to material, replace later

        //clouds.mat.SetTexture("_cloudNoise", tex);
        clouds.mat.SetTexture("_cloudNoise", tex);
        clouds.mat.SetFloat("densityThreshold", densityThreshold);

        clouds.mat.SetFloat("lightAbsorptionThroughCloud", lightAbsorptionThroughCloud);
        clouds.mat.SetFloat("lightAbsorptionTowardSun", lightAbsorptionTowardSun);
        clouds.mat.SetVector("phaseParams", phaseParams);
        clouds.mat.SetFloat("densityMultiplier", densityMultiplier);
    }
Ejemplo n.º 31
0
        protected override void InitializeData()
        {
            Messenger.Default.Send(new NotificationMessageAction <Guid>(Messages.SetPushAppData,
                                                                        (id) =>
            {
                this.SelectedCloud = Clouds.SingleOrDefault(i => i.ID == id);
            }));

            Messenger.Default.Send(new NotificationMessageAction <string>(Messages.SetPushAppDirectory,
                                                                          (directory) =>
            {
                this.PushFromDirectory  = directory;
                this.CanChangeDirectory = false;
            }));
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Returns true if Forecast instances are equal
        /// </summary>
        /// <param name="other">Instance of Forecast to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Forecast other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                     ) &&
                 (
                     Pressure == other.Pressure ||
                     Pressure != null &&
                     Pressure.Equals(other.Pressure)
                 ) &&
                 (
                     Humidity == other.Humidity ||
                     Humidity != null &&
                     Humidity.Equals(other.Humidity)
                 ) &&
                 (
                     WindSpeed == other.WindSpeed ||
                     WindSpeed != null &&
                     WindSpeed.Equals(other.WindSpeed)
                 ) &&
                 (
                     Clouds == other.Clouds ||
                     Clouds != null &&
                     Clouds.Equals(other.Clouds)
                 ) &&
                 (
                     Temperature == other.Temperature ||
                     Temperature != null &&
                     Temperature.Equals(other.Temperature)
                 ) &&
                 (
                     Weather == other.Weather ||
                     Weather != null &&
                     Weather.Equals(other.Weather)
                 ));
        }
Ejemplo n.º 33
0
    public Level(int levelIndex)
    {
        // load the backgrounds
        GameObjectList backgrounds = new GameObjectList(0, "backgrounds");
        SpriteGameObject background_main = new SpriteGameObject("Backgrounds/spr_sky");
        background_main.Position = new Vector2(0, GameEnvironment.Screen.Y - background_main.Height);
        backgrounds.Add(background_main);
        SpriteGameObject background_extended = new SpriteGameObject("Backgrounds/spr_sky");
        background_extended.Position = new Vector2(background_main.Width, GameEnvironment.Screen.Y - background_main.Height);
        backgrounds.Add(background_extended);

        // add a few random mountains
        for (int i = 0; i < 10; i++)
        {
            SpriteGameObject mountain = new SpriteGameObject("Backgrounds/spr_mountain_" + (GameEnvironment.Random.Next(2) + 1), GameEnvironment.Random.Next(4)+3);
            mountain.Position = new Vector2((float)GameEnvironment.Random.NextDouble() * (2 * background_main.Width) - mountain.Width / 2, GameEnvironment.Screen.Y - mountain.Height);
            backgrounds.Add(mountain);
        }

        Clouds clouds = new Clouds(4);
        backgrounds.Add(clouds);
        this.Add(backgrounds);

        SpriteGameObject timerBackground = new SpriteGameObject("Sprites/spr_timer", 100);
        timerBackground.Position = new Vector2(10, 10);
        timerBackground.Meebewegen();
        this.Add(timerBackground);
        TimerGameObject timer = new TimerGameObject(101, "timer");
        timer.Position = new Vector2(25, 30);
        this.Add(timer);

        quitButton = new Button("Sprites/spr_button_quit", 100);
        quitButton.Position = new Vector2(GameEnvironment.Screen.X - quitButton.Width - 10, 10);
        this.Add(quitButton);

        this.Add(new GameObjectList(1, "waterdrops"));
        this.Add(new GameObjectList(2, "enemies"));

        this.LoadTiles("Content/Levels/" + levelIndex + ".txt");
    }
 /// <summary>
 /// initForecastObjects init and allocate all forecast objects
 /// </summary>
 private void initForecastObjects()
 {
     this.location = new Location();
     this.sunRise = new SunRise();
     this.temperature = new Temperature();
     this.humidity = new Humidity();
     this.pressure = new Pressure();
     this.windSpeed = new WindSpeed();
     this.windDirection = new WindDirection();
     this.clouds = new Clouds();
     this.precipitation = new Precipitation();
     this.weather = new Weather();
     this.lastupdate = new Lastupdate();
 }