public override void TodoOnDeath() { //Free a PoulpiSnow MovePattern mp = new MovePattern(); switch (this.Flip) { case SpriteEffects.FlipHorizontally: mp.AddPoint((int)this.location.X, (int)TGPAContext.Instance.ScreenHeight / 2); mp.AddPoint((int)TGPAContext.Instance.ScreenWidth + 1, (int)TGPAContext.Instance.ScreenHeight / 2); break; case SpriteEffects.None: mp.AddPoint((int)this.location.X, (int)TGPAContext.Instance.ScreenHeight / 2); mp.AddPoint(-500, (int)TGPAContext.Instance.ScreenHeight / 2); break; } Snow s = new Snow(this.location, RandomMachine.GetRandomVector2(-100f, 20f, 50f, -300f), 800f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(s, false); PoulpiSnow ps = new PoulpiSnow(this.location, this.scrollValue, null, mp, this.Flip, this.flagsOnDeath); TGPAContext.Instance.AddEnemy(ps); //base.TodoOnDeath(); }
IEnumerator Start() { while (true) { yield return(new WaitForSeconds(0.2f)); // TODO Vector3[] corners = new Vector3[4]; bounds.GetLocalCorners(corners); float bottomY = corners[0].y; List <int> removes = new List <int>(); for (int i = 0; i < snows.Count; i++) { Snow snow = snows[i]; if (snow.transform.localPosition.y < bottomY - 100) { removes.Add(i); } } removes.Reverse(); foreach (int i in removes) { Snow snow = snows[i]; Destroy(snow.gameObject); snows.RemoveAt(i); } if (snows.Count < settings.count) { snows.Add(CreateRandomSnow()); } } }
// Use this for initialization void Start() { rain = GetComponentsInChildren <Rain>(true)[0]; fog = GetComponentsInChildren <Fog>(true)[0]; snow = GetComponentsInChildren <Snow>(true)[0]; windZone = GetComponentsInChildren <WindZone>(true)[0]; }
private void AddWatermarks(bool bCheckLicence, bool bAdd_qQ_ToOrigSc) { bool flag1; Snow snow1; uint[] numArray1; int num1; int num2; if (bCheckLicence) { flag1 = false; snow1 = new Snow(); snow1.LoadKey(41869, Rect.serial[0], 1, 0); numArray1 = new uint[3]; for (num1 = 0; (num1 < 3); num1 += 1) { numArray1[num1] = Rect.serial[(num1 + 1)]; } snow1.EncryptDecrypt(ref numArray1); flag1 = ((bool)(((((numArray1[0] ^ numArray1[1]) ^ numArray1[2]) & (Circle.productType & 44933)) != (Circle.productType & 44933)) ? 0 : (numArray1[0] == numArray1[1]))); if (flag1) { return; } } WTM_Stamper stamper1 = new WTM_Stamper(this, false, bAdd_qQ_ToOrigSc); for (num2 = 0; (num2 < base.Pages.Count); num2 += 1) { stamper1.AddWatermarks(base.Pages[num2]); } }
/// <summary> /// /// </summary> /// <param name="tempF">int</param> /// <param name="wind">Wind</param> /// <param name="rain">Rain</param> /// <param name="snow">Snow</param> /// <param name="fog">Fog</param> public Weather(int tempF, Wind wind, Rain rain, Snow snow, Fog fog) { this.tempF = tempF; this.tempC = ConvertFToC(); this.wind = wind; this.rain = rain; this.snow = snow; this.fog = fog; }
public override void Update(GameTime gameTime) { this.visualRotation += 0.15f; this.rotation -= RandomMachine.GetRandomFloat(0.001f, 0.01f); Snow s = new Snow(this.location, RandomMachine.GetRandomVector2(-10f, 10f, -10f, 10f), 1f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(s, true); base.Update(gameTime); }
void createBlock(Vector3 blockPos) { int y = (int)blockPos.y; if (y < -128) { return; } // plain 2 int heightScale = 20; // 40+ float detailScale = 70.0f; int p_y = (int)(Mathf.PerlinNoise((blockPos.x + this.seed) / detailScale, (blockPos.z + this.seed) / detailScale) * heightScale); Block block; if (y > p_y /*42*/) { return; // air } else if (y > 38) { block = new Snow(); } else if (y > 5 && y == p_y) { block = new Grass(); /* * if (UnityEngine.Random.Range (0, 10) <= 2) { * addBlock (blockPos + new Vector3 (0, 1, 0), new Fern ()); * } else if (UnityEngine.Random.Range (0, 50) <= 2) { * addBlock (blockPos + new Vector3 (0, 1, 0), new Rose ()); * } */ } else if (y > 5) { block = new Dirt(); } else if (y == -128) { block = new BedRock(); } else { block = new Sand(); } addBlock(blockPos, block); }
[SerializeField] public int typeOfParticle; //whichever class we want to use, the Snow: Snow class or Confetti: Snow clas // Start is called before the first frame update void Start() { j = RonnieIterate.first(); //set j to first of the iterator objs = new GameObject[numOfObjects]; //an array of new gameobjects (obj) //which particle type do we want to use (1 for snow, 2 for confetti) if (typeOfParticle == 1) { particleClass = new Snow(); //super class } else if (typeOfParticle == 2) { particleClass = new Confetti(); //sub class } }
void CreateSnow() { GameObject empty = new GameObject(); //Clean up hierachy empty.name = "Snow"; for (int i = 0; i <= 20; i++) { GameObject snow = GameObject.CreatePrimitive(PrimitiveType.Sphere); snow.AddComponent <Snow> (); Snow snowflakes = snow.GetComponent <Snow> (); snowflakes.Setsnow(Random.Range(screenLeft, screenRight), Random.Range(screenBottom, screenTop), Random.Range(0.05f, 0.1f), Random.Range(0.05f, 0.1f), 0f, 0.1f); snow.transform.parent = empty.transform; } }
// 服务器通知天气变化 S2CWeatherChange public void ChangeWeather(WeatherType weatherType) { if (!IsUseWeatherEffect) { return; } if (weatherType == WeatherType.Rain) { if (null != _Snow) { _Snow.enabled = false; } if (null == _Rain) { _Rain = this.gameObject.AddComponent <Rain>(); } if (null != _Rain) { _Rain.enabled = true; } } else if (weatherType == WeatherType.Snow) { if (null == _Snow) { _Snow = this.gameObject.AddComponent <Snow>(); } if (null != _Snow) { _Snow.enabled = true; } if (null != _Rain) { _Rain.enabled = false; } } else if (weatherType == WeatherType.None) { if (null != _Snow) { _Snow.enabled = false; } if (null != _Rain) { _Rain.enabled = false; } } DynamicEffectManager.Instance.EnterWeatherDynamicEffect(weatherType); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.CompareTag("HeavySnow") && volume <= maxVolume) { Snow snow = collision.gameObject.GetComponent <Snow>(); volume += snow.fillAmount; snowFillImage.UpdateFillAmount(volume); Destroy(collision.gameObject); } if (collision.collider.CompareTag("Snow") && volume <= maxVolume) { Snow snow = collision.gameObject.GetComponent <Snow>(); volume += snow.fillAmount; snowFillImage.UpdateFillAmount(volume); Destroy(collision.gameObject); } }
private static async void Snow(IWorld world, Direction?direction) { // Create grass and put a snowy layer on top of it // to create a snowy grass block. var playerPosition = await world.Player.GetTilePositionAsync(); var awayFromPlayer = playerPosition.Towards(direction.Value, 3); await world.SetBlockAsync <Grass>(awayFromPlayer); for (var thickness = 0; thickness <= 8; thickness++) { await Task.Delay(1000); var snowLayer = new Snow(thickness); await world.SetBlockAsync(snowLayer, awayFromPlayer + new Vector3(0, 1, 0)); } }
/// <summary> /// Returns a specific Weather class based on the value of parameter iRange /// </summary> /// <param name="iRange">Specific choice of Weather Object</param> /// <returns>wTempWeather</returns> public Weather RandomWeatherRange(int iRange) { Weather wTempWeather = new Weather(); switch (iRange) { case 0: //Rain wTempWeather = new Sunny(); return(wTempWeather); case 1: //Sunny wTempWeather = new Rain(); return(wTempWeather); case 2: //Cloudy wTempWeather = new Cloudy(); return(wTempWeather); case 3: //Snow wTempWeather = new Snow(); return(wTempWeather); case 4: //Windy wTempWeather = new Windy(); return(wTempWeather); case 5: //Thunderstorm wTempWeather = new Thunderstorm(); return(wTempWeather); case 6: //Hail wTempWeather = new Hail(); return(wTempWeather); case 7: //Fog wTempWeather = new Fog(); return(wTempWeather); case 8: //HeatWave wTempWeather = new HeatWave(); return(wTempWeather); } return(wTempWeather); }
Snow CreateRandomSnow() { Snow snow = Instantiate(snowPrefab); Vector3[] corners = new Vector3[4]; bounds.GetLocalCorners(corners); float topY = corners[2].y; float minX = corners[0].x; float maxX = corners[2].x; snow.transform.SetParent(bounds); RectTransform rect = (RectTransform)snow.transform; rect.pivot = rect.anchorMin = rect.anchorMax = Vector2.one * 0.5f; snow.transform.localScale = Vector3.one; snow.Settings = settings.GetSnowDropSettings(UnityEngine.Random.Range(minX, maxX), topY + 100); return(snow); }
static void Main(string[] args) { /* * Jag testade bara lite för jag råkade förvirra mig själv * Hero test = new Hero(); * string testnamn = Console.ReadLine(); * test.name = testnamn; * Console.WriteLine(test.name); * Console.WriteLine(test.Hp); * test.Hp = 75; * Console.WriteLine(test.Hp); * Console.ReadLine(); */ bool ok = false; Console.WriteLine("Hej och välkommen till Superhero Academy! Vilken sorts hjälte vill du köra som?"); Console.WriteLine("1 = Eld"); Console.WriteLine("2 = Snö"); Console.WriteLine("3 = Vatten"); string ans = Console.ReadLine(); if (ans == "1") { Fire player = new Fire(); } if (ans == "2") { Snow player = new Snow(); } if (ans == "3") { Water player = new Water(); } else { Console.WriteLine("Då du inte valde något av alternativen så blir du skräp"); Trash player = new Trash(); } }
public override void SaveAs(Stream strm, string header, IEncryption encrypt) { int num1; this.UpdateInfo(); bool flag1 = false; Snow snow1 = new Snow(); snow1.LoadKey(41869, Rect.serial[0], 1, 0); uint[] numArray1 = new uint[3]; for (num1 = 0; (num1 < 3); num1 += 1) { numArray1[num1] = Rect.serial[(num1 + 1)]; } snow1.EncryptDecrypt(ref numArray1); flag1 = ((bool)(((((numArray1[0] ^ numArray1[1]) ^ numArray1[2]) & (Circle.productType & 44933)) != (Circle.productType & 44933)) ? 0 : (numArray1[0] == numArray1[1]))); if (!flag1 && (encrypt != null)) { throw new SecurityException("Ecnryption is unsupported in the trial version"); } PDFDict dict1 = this.mTrailer; ArrayList list1 = ((ArrayList)this.mXRef.Clone()); this.mTrailer = ((PDFDict)dict1.Clone()); this.mTrailer["Info"] = dict1["Info"]; string text1 = Encoding.ASCII.GetString(this.GenerateFileId(this.mPath)); string[] textArray1 = new string[2]; textArray1[0] = text1; textArray1[1] = text1; this.mTrailer["ID"] = PDF.O(textArray1); PDFDict dict2 = encrypt.CreateEncryptionDict(this); this.mTrailer["Encrypt"] = this.Indirects.New(dict2); this.mWriter.Encryption = encrypt; this.SaveAs(strm, header); this.mWriter.Encryption = null; this.mXRef = list1; this.mTrailer = dict1; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { player = new Player { Speed = 100f, Position = new Vector2(0, 0) }; snow = new Snow { Speed = 0f, Position = new Vector2(150, 150) }; world = new World { Width = graphics.PreferredBackBufferWidth, Height = graphics.PreferredBackBufferHeight }; physics = new GamePhysics(); base.Initialize(); // TODO: Add your initialization logic here }
public void setNextDestroy(GameObject snow) { Snow s = snow.GetComponent <Snow>(); if (!s.next2Destory) { gameOver = true; Debug.Log("game end"); if (GameController.instance.highest_scores < points) { GameController.instance.highest_scores = points; } GameController.instance.scores = points; GameController.Save(); SceneManager.LoadScene(2, LoadSceneMode.Additive); return; } points++; point_animator.SetTrigger("add"); screen_animator.SetTrigger("shake"); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //Snow Effect Will Be generated Every 20milisecond //L'effet neige sera generer chaque 20miliseconde snow = new Snow(this, 20); //Create Fire Effect In Disaable Mode //Creer Effet feu en mode desactivé fire = new Fire(this, 0); //Generate Plasma Effect Every right click mouse boutton //generer l'effet plasma a chaque clique sur le bouton droit de la sourie plasma = new Plasma(this, Chimera.Graphics.Effects.Particles.Engine.Controllers.MouseController.MouseButtons.Right); //Fire Effect Will Be Generated After each die of plasma particle //L'effect feu sera generé apres chaque mort d'une particule plasma fire.ApplyEffect(plasma); //Select Default texture for fire effect //Selectione la texture par defaut pour l'effet feu fire.SetDefaultTexture(this); /*For The Default texture you have to inculde resource floder see the second tutorial*/ /*Pour les texture par defaut vous avez a inclure le dossier resource lisez le seconde cours*/ ///Create parameters effect with 300 particle ///Creer les parametre de l'effet avec 300 particule parameters param = new parameters(300); param.direction = 2; ///Create Fire Line Effect Every 100 Milisecond With The Param parameter ///Creer leffet feu sous forme de ligne chaque 100 milisecond avec comme parametre param fireline = new Fire(this, 100, Chimera.Graphics.Enumeration.EParticleType.Line, param); fireline.Position = new Vector2(400, 500); fireline.SetDefaultTexture(this); }
static void MatchOnly(DataTable dt, DataTable dt1, string Company, string StartDate, string EndDate, string ProcName, OdbcConnection Conn, int TableId) { string TestResult; string TestName = Company + "_" + StartDate + "_" + EndDate; string Today = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss"); string RowName = "RowCount"; double SnowTime = Convert.ToDouble(dt1.Rows[0]["SnowTime"]); double SqlTime = Convert.ToDouble(dt.Rows[0]["SqlTime"]); if (dt.Rows.Count == dt1.Rows.Count) { TestResult = "Pass"; } else { TestResult = "Fail"; } Console.WriteLine(TestResult); string OdbcComm = "Insert into UnitTests Values('" + TestName + "','" + RowName + "','" + dt1.Rows.Count + "','" + dt.Rows.Count + "','" + TestResult + "','" + Today + "','" + ProcName + "','" + TableId + "','" + SnowTime + "','" + SqlTime + "')"; OdbcCommand Ins = new OdbcCommand(OdbcComm, Conn); Ins.ExecuteNonQuery(); /* var Inner = from Snow in dt1.AsEnumerable() * join * Sql in dt.AsEnumerable() on * Snow.Field<string>("hash") equals Sql.Field<string>("hash") * select Snow; */ /*Snowflake only datarows*/ var OnlySnow = from Snow in dt1.AsEnumerable() join Sql in dt.AsEnumerable() on Snow.Field <string>("hash") equals Sql.Field <string>("hash") into x from Sql in x.DefaultIfEmpty() where Sql == null select Snow; foreach (var Snow in OnlySnow) { List <string> lists = new List <string>(); foreach (DataColumn col in Snow.Table.Columns) { if (col.ColumnName.Contains("DATE")) { string Data = Snow[col].ToString(); Console.WriteLine(Data + " " + Data.GetType()); string[] Dates = Data.ToString().Split(new char[0]); string Date = Dates[0]; Console.WriteLine(Date); lists.Add(Date); } else { lists.Add(Snow[col].ToString()); } } string Hash = Snow["hash"].ToString(); lists.RemoveAt(lists.Count - 1); var rec = string.Join("','", lists); Console.WriteLine(rec); string InsertHash = "Insert into UnitTests Values('" + TestName + "','" + "RowHash" + "','" + Hash + "','" + " " + "','" + "Fail" + "','" + Today + "','" + ProcName + "','" + TableId + "','" + SnowTime + "','" + SqlTime + "')"; OdbcCommand InsertH = new OdbcCommand(InsertHash, Conn); InsertH.ExecuteNonQuery(); string Insert = "Insert into " + ProcName + " Values('" + rec + "','" + Today + "','" + TestName + "')"; Console.WriteLine(Insert); OdbcCommand InsertData = new OdbcCommand(Insert, Conn); InsertData.ExecuteNonQuery(); } /*Sql only datarows*/ var OnlySql = from Sql in dt.AsEnumerable() join Snow in dt1.AsEnumerable() on Sql.Field <string>("hash") equals Snow.Field <string>("hash") into x from Snow in x.DefaultIfEmpty() where Snow == null select Sql; foreach (var Sql in OnlySql) { List <string> lists = new List <string>(); foreach (DataColumn col in Sql.Table.Columns) { if (col.ColumnName.Contains("Date") || col.ColumnName.Contains("DATE")) { string Data = Sql[col].ToString(); Console.WriteLine(Data + " " + Data.GetType()); string[] Dates = Data.ToString().Split(new char[0]); string Date = Dates[0]; lists.Add(Date); } else { lists.Add(Sql[col].ToString()); } } string Hash = Sql["hash"].ToString(); lists.RemoveAt(lists.Count - 1); var rec = string.Join("','", lists); Console.WriteLine(rec); string InsertHash = "Insert into UnitTests Values('" + TestName + "','" + "RowHash" + "','" + " " + "','" + Hash + "','" + "Fail" + "','" + Today + "','" + ProcName + "','" + TableId + "','" + SnowTime + "','" + SqlTime + "')"; OdbcCommand InsertH = new OdbcCommand(InsertHash, Conn); InsertH.ExecuteNonQuery(); string Insert = "Insert into " + ProcName + " Values('" + rec + "','" + Today + "','" + TestName + "')"; OdbcCommand InsertData = new OdbcCommand(Insert, Conn); InsertData.ExecuteNonQuery(); } }
static void MatchOnly(DataTable dt, DataTable dt1, string Company, string StartDate, string EndDate, string ProcName, OdbcConnection Conn, int TableId, double sfexec) { string TestResult; string TestName = Company + "_" + StartDate + "_" + EndDate; string Today = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss"); string RowName = "RowCount"; double SnowTime = sfexec; double SqlTime = Convert.ToDouble(dt.Rows[0]["SqlTime"]); if (dt.Rows.Count == dt1.Rows.Count) { TestResult = "Pass"; } else { TestResult = "Fail"; } Console.WriteLine(TestResult); string OdbcComm = "Insert into UnitTests Values('" + TestName + "','" + RowName + "','" + dt1.Rows.Count + "','" + dt.Rows.Count + "','" + TestResult + "','" + Today + "','" + ProcName + "','" + TableId + "','" + SnowTime + "','" + SqlTime + "')"; OdbcCommand Ins = new OdbcCommand(OdbcComm, Conn); Ins.ExecuteNonQuery(); /* var Inner = from Snow in dt1.AsEnumerable() * join * Sql in dt.AsEnumerable() on * Snow.Field<string>("hash") equals Sql.Field<string>("hash") * select Snow; */ /*Snowflake only datarows*/ var OnlySnow = from Snow in dt1.AsEnumerable() join Sql in dt.AsEnumerable() on Snow.Field <string>("hash") equals Sql.Field <string>("hash") into x from Sql in x.DefaultIfEmpty() where Sql == null select Snow; foreach (var Snow in OnlySnow) { string Hash = Snow["hash"].ToString(); var rec = string.Join("','", Snow.ItemArray.ToArray()); Console.WriteLine(Hash); string InsertHash = "Insert into UnitTests Values('" + TestName + "','" + "RowHash" + "','" + Hash + "','" + " " + "','" + "Fail" + "','" + Today + "','" + ProcName + "','" + TableId + "','" + SnowTime + "','" + SqlTime + "')"; OdbcCommand InsertH = new OdbcCommand(InsertHash, Conn); InsertH.ExecuteNonQuery(); string Insert = "Insert into " + ProcName + " Values('" + rec + "','" + Today + "','" + TestName + "')"; OdbcCommand InsertData = new OdbcCommand(Insert, Conn); InsertData.ExecuteNonQuery(); } /*Sql only datarows*/ var OnlySql = from Sql in dt.AsEnumerable() join Snow in dt1.AsEnumerable() on Sql.Field <string>("hash") equals Snow.Field <string>("hash") into x from Snow in x.DefaultIfEmpty() where Snow == null select Sql; foreach (var Sql in OnlySql) { /* foreach (DataColumn col in Sql.Table.Columns) * { * Console.WriteLine(col.ColumnName + " " + Sql[col].GetType()); * } */ string Hash = Sql["hash"].ToString(); var rec = string.Join("','", Sql.ItemArray.ToArray()); Console.WriteLine(Hash); string InsertHash = "Insert into UnitTests Values('" + TestName + "','" + "RowHash" + "','" + " " + "','" + Hash + "','" + "Fail" + "','" + Today + "','" + ProcName + "','" + TableId + "','" + SnowTime + "','" + SqlTime + "')"; OdbcCommand InsertH = new OdbcCommand(InsertHash, Conn); InsertH.ExecuteNonQuery(); string Insert = "Insert into " + ProcName + " Values('" + rec + "','" + Today + "','" + TestName + "')"; OdbcCommand InsertData = new OdbcCommand(Insert, Conn); InsertData.ExecuteNonQuery(); } }
void CreateSnow() { var snow = Snow.CreateRandom(this); _snows[snow.Id] = snow; }
public override void Update(GameTime gameTime) { //Kill avalanche if flag is set if (TGPAContext.Instance.Map.Flags.GetFlag("endAvalanche")) { this.endLevel = true; } //Get the nearest player float locP1 = TGPAContext.Instance.Player1.Location.X; Player player = TGPAContext.Instance.Player1; if (TGPAContext.Instance.Player2 != null) { float locP2 = TGPAContext.Instance.Player2.Location.X; if (locP2 < locP1) { player = TGPAContext.Instance.Player2; } } if (!endLevel) { if ((player.DstRect.Left < TGPAContext.Instance.ScreenWidth / 3) || (firstStepPassed == false)) { this.location.X += 1f; if (this.location.X > 0) { this.location.X = 0; if (firstStepPassed == false) { this.wpn = new SnowballLauncher(); this.firstStepPassed = true; } } } else if ((player.DstRect.Left > TGPAContext.Instance.ScreenWidth / 3) && (firstStepPassed)) { this.location.X -= 1f; if (this.location.X < -256) { this.location.X = -256; } } } else { this.location.X -= 5f; } //Particules for (int i = 0; i < 10; i++) { Snow s = new Snow(new Vector2(this.location.X + (i * (this.DstRect.Width / 10)) + (this.DstRect.Width / 10), this.location.Y + this.DstRect.Height), RandomMachine.GetRandomVector2(-100f, 20f, 50f, -300f), 2f, RandomMachine.GetRandomInt(0, 4)); TGPAContext.Instance.ParticleManager.AddParticle(s, false); } base.Update(gameTime); }
public static async Task MainAsync(string[] args) { if (args.Length != 1) { Console.WriteLine(@"Minecraft.Scratch - a console app using Minecraft.Client Modify the source if you want to make it do anything useful. usage: minecraft.client <raspberry pi ip>"); return; } try { using (var world = JavaWorld.Connect(args[0])) { await world.PostToChatAsync("Hello from C# and .NET Core!"); var player = world.Player; while (true) { Console.WriteLine(@" Available commands: P = Get current position T = Transport to a given position M = Move towards north/south/east/west C = Build a castle I = Render a picture H = Height under the player S = Add snow Press ESC to quit "); Vector3 playerPosition = new Vector3(); Direction?direction; var cmd = Console.ReadKey(); Console.WriteLine(); switch (cmd.Key) { case ConsoleKey.Escape: return; case ConsoleKey.P: playerPosition = await player.GetTilePositionAsync(); Console.WriteLine($"Player is on {playerPosition}."); break; case ConsoleKey.T: Console.WriteLine("Where do you want to go? Enter X,Y,Z coordinates and press Enter:"); var destCoord = Console.ReadLine().ParseCoordinates(); await player.SetPositionAsync(destCoord); playerPosition = await player.GetTilePositionAsync(); Console.WriteLine($"Player is now at {playerPosition}"); break; case ConsoleKey.M: direction = GetDirection(); if (direction.HasValue) { playerPosition = await player.GetTilePositionAsync(); await player.SetPositionAsync(playerPosition.Towards(direction.Value)); playerPosition = await player.GetTilePositionAsync(); Console.WriteLine($"Player moved {direction} to {playerPosition}"); } break; case ConsoleKey.C: direction = GetDirection(); if (direction.HasValue) { playerPosition = await player.GetTilePositionAsync(); new Castle(world, playerPosition.Towards(direction.Value, 30)).Build(); } break; case ConsoleKey.I: direction = GetDirection(); if (direction.HasValue) { playerPosition = await player.GetTilePositionAsync(); var imageBuilder = new ImageBuilder(world); imageBuilder.DrawImage( Path.Combine(".", "Media", "Minecraft.gif"), playerPosition.Towards(direction.Value, 20)); } break; case ConsoleKey.H: var height = world.GetHeight(playerPosition); Console.WriteLine($"Height under the player is {height}"); break; case ConsoleKey.S: playerPosition = await player.GetTilePositionAsync(); // Create grass and put a snowy layer on top of it // to create a snowy grass block. var grass = new Grass(); world.SetBlock(grass, playerPosition + new Vector3(0, 0, 3)); var snowLayer = new Snow(); world.SetBlock(snowLayer, playerPosition + new Vector3(0, 1, 3)); Console.WriteLine("Snow added"); break; } } } } catch (FailedToConnectToMinecraftEngine e) { Console.WriteLine(e.Message); } }
protected void ChangeLevel( string levelName ) { EntityManager.Clear(); EntityManager.Load(Game.Instance.ContentManager.Load <LevelData>(levelName)); Camera = new Camera(this); LightManager = new LightManager(this); // recreate the lava fires system using the new level parameters if (explosionSystem != null) { explosionSystem.UnloadResources(); } explosionSystem = new LavaExplosion(this, Game.Instance.ContentManager, device, entityManager["lavafire"].GetFloat("size"), entityManager["lavafire"].GetFloat("rgb_multiplier"), entityManager["lavafire"].GetFloat("dot_multiplier")); for (int i = 0; i < 50; ++i) { explosionSystem.AddEmitter(new ProjectMagma.Renderer.ParticleSystem.Emitter.LavaExplosionEmitter()); } // recreate the snow system using the new level parameters if (snowSystem != null) { snowSystem.UnloadResources(); } snowSystem = new Snow(this, Game.Instance.ContentManager, device, entityManager["snow"].GetFloat("particle_lifetime"), entityManager["snow"].GetFloat("max_alpha"), entityManager["snow"].GetFloat("base_size"), entityManager["snow"].GetFloat("random_size_modification"), entityManager["snow"].GetFloat("melting_start"), entityManager["snow"].GetFloat("melting_end")); snowSystem.AddEmitter(new SnowEmitter(EntityManager["snow"].GetFloat("particles_per_second"))); for (int i = 0; i < 1000; ++i) { snowSystem.Update(-30d / 1000d + i * -30d / 1000d, -30d / 1000d + i * -30d / 1000d + 30d / 1000d); } if (iceExplosionSystem != null) { iceExplosionSystem.UnloadResources(); } iceExplosionSystem = new IceExplosion(this, Game.Instance.ContentManager, device); if (fireExplosionSystem != null) { fireExplosionSystem.UnloadResources(); } fireExplosionSystem = new FireExplosion(this, Game.Instance.ContentManager, device); if (flamethrowerSystem != null) { flamethrowerSystem.UnloadResources(); } flamethrowerSystem = new Flamethrower(this, Game.Instance.ContentManager, device); if (iceSpikeSystem != null) { iceSpikeSystem.UnloadResources(); } iceSpikeSystem = new IceSpike(this, Game.Instance.ContentManager, device); }
public override void SaveAs(Stream str, string header) { int num1; byte[] numArray2; UserAccessPermissions permissions1; PDFDict dict2; PDFArray array1; PDFStream stream1; Stream stream2; int num4; this.UpdateInfo(); PDFDict dict1 = ((PDFDict)this.mTrailer.Clone()); string text1 = Encoding.ASCII.GetString(this.GenerateFileId(this.mPath)); string[] textArray1 = new string[2]; textArray1[0] = text1; textArray1[1] = text1; this.mTrailer["ID"] = PDF.O(textArray1); bool flag1 = false; Snow snow1 = new Snow(); snow1.LoadKey(41869, Rect.serial[0], 1, 0); uint[] numArray1 = new uint[3]; for (num1 = 0; (num1 < 3); num1 += 1) { numArray1[num1] = Rect.serial[(num1 + 1)]; } snow1.EncryptDecrypt(ref numArray1); flag1 = ((bool)(((((numArray1[0] ^ numArray1[1]) ^ numArray1[2]) & (Circle.productType & 44933)) != (Circle.productType & 44933)) ? 0 : (numArray1[0] == numArray1[1]))); DateTime time1 = DateTime.Now; Random random1 = new Random(time1.Millisecond); if (!flag1) { this.AddWatermarks(false, false); numArray2 = new byte[32]; random1.NextBytes(numArray2); permissions1 = -1340; this.mWriter.Encryption = EncryptionStandard.Create(Encoding.ASCII.GetString(numArray2), "", permissions1, 128, true); dict2 = this.mWriter.Encryption.CreateEncryptionDict(this); this.mTrailer["Encrypt"] = this.Indirects.New(dict2); } else { array1 = Library.CreateArray(1); array1[0] = Library.CreateName("FlateDecode"); foreach (PDFIndirect indirect1 in this.Indirects) { if (((indirect1 == null) || (indirect1.Direct == null)) || (indirect1.Direct.PDFType != PDFObjectType.tPDFStream)) { continue; } stream1 = (indirect1.Direct as PDFStream); if (stream1 == null) { continue; } stream2 = stream1.Decode(); stream1.Dict["Filter"] = base.CloneObject(array1); stream1.Dict.Remove("DecodeParms"); stream1.Encode(stream2); } } if (this.mWriter == null) { this.mWriter = new PDFWriter(); } this.mWriter.AttachToStream(str); this.mWriter.WriteRaw(header); this.mWriter.WriteEOL(); string text2 = "%\u00cd\u00ce\u00cf\u00ff"; this.mWriter.WriteRaw(text2); this.mWriter.WriteEOL(); Hashtable hashtable1 = new Hashtable(); this.mTrailer.Remove("Prev"); if (this.mTrailer["Root"] != null) { this.EnqeueIndirects(hashtable1, this.mTrailer["Root"]); } if (this.mTrailer["Info"] != null) { this.EnqeueIndirects(hashtable1, this.mTrailer["Info"]); } if (this.mTrailer["Encrypt"] != null) { this.EnqeueIndirects(hashtable1, this.mTrailer["Encrypt"]); } this.mToSaveQueue = new Queue(); int num2 = 1; ArrayList list1 = this.mXRef; this.mXRef = new ArrayList(); XRefEntry entry1 = new XRefEntry(); entry1.dirty = false; entry1.type = 0; entry1.generation = 65535; entry1.indirect = null; entry1.offset = ((long)0); this.mXRef.Add(entry1); foreach (DictionaryEntry entry2 in hashtable1) { ((CorePDFIndirect)entry2.Key).mId = num2; entry1 = new XRefEntry(); entry1.dirty = true; entry1.type = 1; entry1.generation = 0; entry1.indirect = ((CorePDFIndirect)entry2.Key); entry1.offset = ((long)-1); this.mXRef.Add(entry1); num2 += 1; this.mToSaveQueue.Enqueue(entry2.Key); } num2 = 0; foreach (PDFIndirect indirect2 in this.mToSaveQueue) { num2 += 1; this.SaveIndirect(((XRefEntry)this.mXRef[num2]), indirect2); } long num3 = this.mWriter.Position; this.mWriter.WriteRaw("xref"); this.mWriter.WriteEOL(); this.mWriter.WriteXRefSection(this.mXRef, 0, 0, this.mXRef.Count); this.mWriter.WriteRaw("trailer"); this.mWriter.WriteEOL(); this.mTrailer["Root"] = this.mRoot.Indirect; if (this.mInfo != null) { this.mTrailer["Info"] = this.mInfo.Indirect; } if (this.mEncrypt != null) { this.mTrailer["Encrypt"] = this.mEncrypt.Indirect; } this.mTrailer["Size"] = new CorePDFInteger(((long)this.mXRef.Count)); this.mWriter.WriteLn(this.mTrailer); this.mWriter.WriteRaw("startxref"); this.mWriter.WriteEOL(); this.mWriter.Write(num3); this.mWriter.WriteEOL(); this.mWriter.WriteRaw("%%EOF"); this.mWriter.WriteEOL(); this.mWriter.Flush(); this.mTrailer = dict1; this.mXRef = list1; for (num4 = 0; (num4 < this.mXRef.Count); num4 += 1) { entry1 = ((XRefEntry)this.mXRef[num4]); if (entry1.indirect != null) { ((CorePDFIndirect)entry1.indirect).mId = num4; } } }
void createBlock(Vector3 blockPos) { int y = (int)blockPos.y; if (y < -128) return; // plain 2 int heightScale = 20; // 40+ float detailScale = 70.0f; int p_y = (int)(Mathf.PerlinNoise ((blockPos.x + this.seed)/detailScale, (blockPos.z + this.seed)/detailScale) * heightScale); Block block; if (y > p_y /*42*/) { return; // air } else if (y > 38) { block = new Snow (); } else if (y > 5 && y == p_y) { block = new Grass (); /* if (UnityEngine.Random.Range (0, 10) <= 2) { addBlock (blockPos + new Vector3 (0, 1, 0), new Fern ()); } else if (UnityEngine.Random.Range (0, 50) <= 2) { addBlock (blockPos + new Vector3 (0, 1, 0), new Rose ()); } */ } else if (y > 5) { block = new Dirt (); } else if (y == -128) { block = new BedRock (); } else { block = new Sand (); } addBlock(blockPos, block); }