} // H public override void OnDeath(Container c) { base.OnDeath(c); Mobile killer = this.LastKiller; if (killer != null) { if (killer is BaseCreature) { killer = ((BaseCreature)killer).GetMaster(); } if (killer is PlayerMobile) { if (GetPlayerInfo.LuckyKiller(killer.Luck) && Utility.RandomMinMax(1, 4) == 1) { LootChest MyChest = new LootChest(Server.Misc.IntelligentAction.FameBasedLevel(this)); MyChest.Name = "sapphire chest"; MyChest.Hue = 0x495; c.DropItem(MyChest); } } } Item sand = new Sand(); sand.Amount = Utility.RandomMinMax(1, 5); c.DropItem(sand); }
public void SetCube(Vector3 pos, CubeType type) { int x = (int)pos.x; int y = (int)pos.y; int z = (int)pos.z; if (OutOfBound(x, y, z)) { return; } if (type == CubeType.Stone) { cubes[x, y, z] = new Stone(pos, world); } else if (type == CubeType.Sand) { cubes[x, y, z] = new Sand(pos, world); } else if (type == CubeType.Ice) { cubes[x, y, z] = new Ice(pos, world); } else if (type == CubeType.Mud) { cubes[x, y, z] = new Mud(pos, world); } else if (type == CubeType.Cloud) { cubes[x, y, z] = new Cloud(pos, world); } }
public void OnMouseDown() { //print("Right Clicked"); if (!Physics2D.OverlapCircle(new Vector3(transform.position.x + gridSize, transform.position.y, transform.position.z), 0.2f, movementBlock)) { if (Physics2D.OverlapCircle(new Vector3(transform.position.x + gridSize, transform.position.y, transform.position.z), 0.3f, sandMask)) { sand = Physics2D.OverlapCircle(new Vector3(transform.position.x + gridSize, transform.position.y, transform.position.z), 0.3f, sandMask).GetComponent <Sand>(); sand.SandRightCheck(); if (sand == null) { print("Sand not got"); } if (sand.sandMove == true) { slidingBlock.RightTrigger(); } } else { slidingBlock.RightTrigger(); } } else { FindObjectOfType <AudioManager>().Play("pieceStopped"); } }
public virtual void updateParticle(GameWindow window, List <Particle> particlesBellow, Dictionary <int[], int> dictionary) { if (myMaterial == Material.sand) { Sand sand = (Sand)this; } }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("ConcreteSolid", true, out subEle); subEle.Value = ConcreteSolid.ToHex(); ele.TryPathTo("ConcreteBroken", true, out subEle); subEle.Value = ConcreteBroken.ToHex(); ele.TryPathTo("MetalSolid", true, out subEle); subEle.Value = MetalSolid.ToHex(); ele.TryPathTo("MetalHollow", true, out subEle); subEle.Value = MetalHollow.ToHex(); ele.TryPathTo("MetalSheet", true, out subEle); subEle.Value = MetalSheet.ToHex(); ele.TryPathTo("Wood", true, out subEle); subEle.Value = Wood.ToHex(); ele.TryPathTo("Sand", true, out subEle); subEle.Value = Sand.ToHex(); ele.TryPathTo("Dirt", true, out subEle); subEle.Value = Dirt.ToHex(); ele.TryPathTo("Grass", true, out subEle); subEle.Value = Grass.ToHex(); ele.TryPathTo("Water", true, out subEle); subEle.Value = Water.ToHex(); }
public void GenerateCubes() { for (int x = 0; x < worldWidth; x++) { for (int y = 0; y < worldHeight; y++) { for (int z = 0; z < worldWidth; z++) { if (cubeDatas[x, y, z] != null) { if (cubeDatas[x, y, z].cubeType == CubeType.Stone) { cubes[x, y, z] = new Stone(new Vector3(x, y, z), world); } else if (cubeDatas[x, y, z].cubeType == CubeType.Sand) { cubes[x, y, z] = new Sand(new Vector3(x, y, z), world); } else if (cubeDatas[x, y, z].cubeType == CubeType.Ice) { cubes[x, y, z] = new Ice(new Vector3(x, y, z), world); } cubeCount++; } } } } }
static void t_Tick(object sender, EventArgs e) { var square = Utility.MakeSquare(new Point(64, 64), 2); foreach (Point point in square) { var powder = new Sand {x = point.X, y = point.Y}; Simulator.AddPowderSafe(powder); } }
public override void OnDeath(Container c) { base.OnDeath(c); Item sand = new Sand(); sand.Amount = Utility.RandomMinMax(1, 2); c.DropItem(sand); }
private static GTile _readTile(byte[] arr, ref int pos) { GTile Tile = null; float x = ReadFloat(arr, ref pos); float y = ReadFloat(arr, ref pos); int type = ReadInt32(arr, ref pos); Directions dir = (Directions)ReadInt32(arr, ref pos); if (type == TileType.GRASS) { Tile = new Grass(x, y); } if (type == TileType.GRAVEL) { Tile = new Gravel(x, y); } if (type == TileType.METAL) { Tile = new Metal(x, y); } if (type == TileType.SAND) { Tile = new Sand(x, y); } if (type == TileType.WATER) { Tile = new Water(x, y); } if (type == TileType.D_FLOWER) { Tile = new Flower(x, y); } if (type == TileType.D_GRASS_SHORE) { Tile = new GrassShore(x, y, dir); } if (type == TileType.D_GRAVEL_SHORE) { Tile = new GravelShore(x, y, dir); } if (type == TileType.D_SAND_SHORE) { Tile = new SandShore(x, y, dir); } if (type == TileType.D_SAND_TRACE) { Tile = new SandTrace(x, y, dir); } if (type == 0) { Tile = new GTile(x, y, true); } return(Tile); }
public void AddSand(Sand pSand) { pSand.gameObject.transform.SetParent(TargetPlane.transform); sand.Add(pSand); if (sand.Count > _MaxSand) { int sandIndex = Random.Range(0, sand.Count - (_MaxSand / 10)); Destroy(sand[sandIndex].gameObject); sand.RemoveAt(sandIndex); } }
public void Text(Player player, string text, string fontName = "Arial", int pxSize = 10) { var font = new Font("SketchFlow Print", 20, GraphicsUnit.Pixel); SizeF size; // First measure the size of the text using (Graphics g = Graphics.FromImage(new Bitmap(1, 1))) { g.PageUnit = GraphicsUnit.Pixel; g.SmoothingMode = SmoothingMode.None; size = g.MeasureString(text, font); } Bitmap bitmap = new Bitmap((int)size.Width, (int)size.Height); RectangleF rectf = new RectangleF(0, 0, size.Width, size.Height); using (Graphics g = Graphics.FromImage(bitmap)) { g.SmoothingMode = SmoothingMode.None; //g.SmoothingMode = SmoothingMode.AntiAlias; //g.InterpolationMode = InterpolationMode.HighQualityBicubic; //g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.DrawString(text, font, Brushes.Black, rectf); g.Flush(); BlockCoordinates coords = (BlockCoordinates)player.KnownPosition; int i = 0; for (int h = bitmap.Height - 1; h > 0; h--) { for (int w = 0; w < bitmap.Width; w++) { Color color = bitmap.GetPixel(w, h); BlockCoordinates tc = new BlockCoordinates(0, i, w); if (color.A == 255) { var block = new Sand { Coordinates = tc + coords }; Log.Debug($"Pixel at {tc + coords}, {color}"); EditSession.SetBlock(block); } else { //Log.Debug($"NO Pixel at {tc + coords}, {color}"); } } i++; } } }
public override void GenerateResources() { Random rnd = new Random(); //Si pas de ressource, on regenère de 0 if (Resources.Count == 0) { Sand s = new Sand(rnd.Next(50, 100)); base.Resources.Add(s); } //Desert, que du sable ! }
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); }
public static Map GenerateFilled(int width, int height) { var tiles = new Tile[width, height]; for (var x = 0; x < width; x++) { for (var y = 0; y < height; y++) { tiles[x, y] = new Sand(new Vector2Int(x, y)); } } return(new Map(tiles)); }
static void Main(string[] args) { var wareHouse = new Warehouse(5); var sand = new Sand("Pesok", 300); var wire = new Wire("Metal", 100); wareHouse.Products.Add(sand); wareHouse.Products.Add(wire); foreach (Goods good in wareHouse.Products) { Console.WriteLine(good.ExpiredDate(DateTime.Now)); } Console.ReadKey(); }
public void BenchmarkTest() { var map = ConstantMapGenerator.GenerateFilled(100, 100); var random = new Random(); /*for (var i = 500_00000; i > 0; i--) * { * var x = random.Next(9999); * var y = random.Next(9999); * map[x, y] = new Brick(x, y); * }*/ var start = new Sand(0, 0); var end = new Sand(99, 99); Console.WriteLine(Test(() => map.GetPath(start, end))); }
public bool Equals(FootstepMaterial other) { if (System.Object.ReferenceEquals(this, other)) { return(true); } if (((object)this == null) || ((object)other == null)) { return(false); } return(ConcreteSolid.SequenceEqual(other.ConcreteSolid) && ConcreteBroken.SequenceEqual(other.ConcreteBroken) && MetalSolid.SequenceEqual(other.MetalSolid) && MetalHollow.SequenceEqual(other.MetalHollow) && MetalSheet.SequenceEqual(other.MetalSheet) && Wood.SequenceEqual(other.Wood) && Sand.SequenceEqual(other.Sand) && Dirt.SequenceEqual(other.Dirt) && Grass.SequenceEqual(other.Grass) && Water.SequenceEqual(other.Water)); }
public static GameObject BuildGameObject(XmlElement element) { string type = element.GetAttribute("type"); switch (type) { case "money": return(Money.Build(element)); case "wood": return(Wood.Build(element)); case "weapon": return(Weapon.Build(element)); case "coal": return(Coal.Build(element)); case "copper": return(Copper.Build(element)); case "gold": return(Gold.Build(element)); case "iron": return(Iron.Build(element)); case "silver": return(Silver.Build(element)); case "leather": return(Leather.Build(element)); case "meat": return(Meat.Build(element)); case "sand": return(Sand.Build(element)); case "stone": return(Stone.Build(element)); case "water": return(Water.Build(element)); case "wheat": return(Wheat.Build(element)); default: return(null); } }
public void OnMouseDown() { if (!Physics2D.OverlapCircle(new Vector3(transform.position.x, transform.position.y + gridSize, transform.position.z), 0.2f, movementBlock)) { if (Physics2D.OverlapCircle(new Vector3(transform.position.x, transform.position.y + gridSize, transform.position.z), 0.2f, sandMask)) { sand = Physics2D.OverlapCircle(new Vector3(transform.position.x, transform.position.y + gridSize, transform.position.z), 0.2f, sandMask).GetComponent <Sand>(); sand.SandUpCheck(); if (sand.sandMove == true) { slidingBlock.UpTrigger(); } } else { slidingBlock.UpTrigger(); } } else { FindObjectOfType <AudioManager>().Play("pieceStopped"); } }
public ActionResult Add(AddSandViewModel model) { try { if (ModelState.IsValid) { // create new sand info object var newSand = new Sand(); newSand.SandName = model.SandName; newSand.ProviderPrice = model.ProviderPrice; newSand.CustomerPrice = model.CustomerPrice; newSand.TransportPrice = model.TransportPrice; newSand.Description = model.Description; db.Sands.Add(newSand); // save new sand info db.SaveChanges(); // Write action log string actionLogData = "sandId:" + newSand.SandId + ", name:" + newSand.SandName; ActionLog.WriteLog(ActionLog.ADD_SAND_INFO, actionLogData, User.Identity.Name, Request.ServerVariables["REMOTE_ADDR"]); return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Thông tin sản phẩm cát không hợp lệ!"); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } return(View(model)); }
public KeyValuePair <GameObject[, ], int> ParseFromFile(string fileName) { var lineCount = File.ReadLines(fileName).Count(); var linesLength = -1; using (var fs = new StreamReader(fileName)) { fs.ReadLine(); var line = fs.ReadLine(); if (line is null) { return(new KeyValuePair <GameObject[, ], int>()); } linesLength = line.Length; } var lvl = new GameObject[lineCount - 1, linesLength]; int diamondsToNextLvl; using (var fs = new StreamReader(fileName)) { var isPlayerDefined = false; diamondsToNextLvl = Int32.Parse(fs.ReadLine() ?? throw new DataException( "1st row in file should be amount of diamonds to next lvl")); var row = 0; while (true) { // Читаем строку из файла во временную переменную. var lvlString = fs.ReadLine(); // Если достигнут конец файла, прерываем считывание. if (lvlString is null) { break; } for (int i = 0, col = 0; i < lvlString.Length; i++) { if (lvlString[i] == '\r' || lvlString[i] == '\n') { continue; } // ['#'] = new Wall(), // ['_'] = new Empty(), // ['S'] = new Stone(), // ['D'] = new CommonDiamond(), // ['E'] = new Exit(), // ['I'] = Player.Instance GameObject newGameObject = null; switch (lvlString[i]) { case '.': newGameObject = new Sand(); break; case '#': newGameObject = new Wall(); break; case '_': newGameObject = new Empty(); break; case 'S': newGameObject = new Stone(); break; case 'D': newGameObject = new CommonDiamond(); break; case 'B': newGameObject = new Butterfly(row, col); break; case 'E': newGameObject = new Exit(); break; case 'I': if (isPlayerDefined) { throw new DataException("Player is already defined"); } newGameObject = Player.Instance; isPlayerDefined = true; break; } lvl[row, col++] = newGameObject ?? throw new DataException($"Boulder dash hasn't got value for symbol {lvlString[i]} at position {i}"); } row++; } } return(new KeyValuePair <GameObject[, ], int>(lvl, diamondsToNextLvl)); }
public override void Visit(Sand sand) { spriteBatch.Draw(texture, drawRectangle, new Rectangle(GameConfig.TILE_SAND * GameConfig.TILE_DIM, GameConfig.TILE_START_Y, GameConfig.TILE_DIM, GameConfig.TILE_DIM), Color.White); }
public LobbyState(Sand game) : base(game) { }
// Update is called once per frame void Update() { transform.position = Vector3.MoveTowards(transform.position, movePoint.position, moveSpeed * Time.deltaTime); if (movementEnabled == true) { if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))//Left { if (!Physics2D.OverlapCircle(new Vector3(movePoint.position.x - gridSize, movePoint.position.y, movePoint.position.z), 0.2f, movementBlock)) { if (Physics2D.OverlapCircle(new Vector3(movePoint.position.x - gridSize, movePoint.position.y, movePoint.position.z), 0.2f, sandMask)) { sand = Physics2D.OverlapCircle(new Vector3(movePoint.position.x - gridSize, movePoint.position.y, movePoint.position.z), 0.2f, sandMask).GetComponent <Sand>(); if (sand != null) { sand.SandLeftCheck(); canSandMove = sand.sandMove; if (canSandMove == true) { FindObjectOfType <AudioManager>().Play("objectSlide"); movePoint.position = new Vector3(movePoint.position.x - gridSize, movePoint.position.y, movePoint.position.z); } } } else { FindObjectOfType <AudioManager>().Play("objectSlide"); movePoint.position = new Vector3(movePoint.position.x - gridSize, movePoint.position.y, movePoint.position.z); FindObjectOfType <DialogueManager>().objectMoveTrigger(); } } else { FindObjectOfType <AudioManager>().Play("pieceStopped"); } if (onCorrectForm == true) { partManager.numOfParts++; onCorrectForm = false; } } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) //Down { if (!Physics2D.OverlapCircle(new Vector3(movePoint.position.x, movePoint.position.y - gridSize, movePoint.position.z), 0.2f, movementBlock)) { if (Physics2D.OverlapCircle(new Vector3(movePoint.position.x, movePoint.position.y - gridSize, movePoint.position.z), 0.2f, sandMask)) { sand = Physics2D.OverlapCircle(new Vector3(movePoint.position.x, movePoint.position.y - gridSize, movePoint.position.z), 0.2f, sandMask).GetComponent <Sand>(); if (sand != null) { sand.SandDownCheck(); canSandMove = sand.sandMove; if (canSandMove == true) { FindObjectOfType <AudioManager>().Play("objectSlide"); movePoint.position = new Vector3(movePoint.position.x, movePoint.position.y - gridSize, movePoint.position.z); } } } else { FindObjectOfType <AudioManager>().Play("objectSlide"); movePoint.position = new Vector3(movePoint.position.x, movePoint.position.y - gridSize, movePoint.position.z); FindObjectOfType <DialogueManager>().objectMoveTrigger(); } } else { FindObjectOfType <AudioManager>().Play("pieceStopped"); } if (onCorrectForm == true) { partManager.numOfParts++; onCorrectForm = false; } } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) //Right { if (!Physics2D.OverlapCircle(new Vector3(movePoint.position.x + gridSize, movePoint.position.y, movePoint.position.z), 0.2f, movementBlock)) { if (Physics2D.OverlapCircle(new Vector3(movePoint.position.x + gridSize, movePoint.position.y, movePoint.position.z), 0.2f, sandMask)) { sand = Physics2D.OverlapCircle(new Vector3(movePoint.position.x + gridSize, movePoint.position.y, movePoint.position.z), 0.2f, sandMask).GetComponent <Sand>(); if (sand != null) { sand.SandRightCheck(); canSandMove = sand.sandMove; if (canSandMove == true) { FindObjectOfType <AudioManager>().Play("objectSlide"); movePoint.position = new Vector3(movePoint.position.x + gridSize, movePoint.position.y, movePoint.position.z); } } } else { FindObjectOfType <AudioManager>().Play("objectSlide"); movePoint.position = new Vector3(movePoint.position.x + gridSize, movePoint.position.y, movePoint.position.z); FindObjectOfType <DialogueManager>().objectMoveTrigger(); } } else { FindObjectOfType <AudioManager>().Play("pieceStopped"); } if (onCorrectForm == true) { partManager.numOfParts++; onCorrectForm = false; } } else if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) //Up { if (!Physics2D.OverlapCircle(new Vector3(movePoint.position.x, movePoint.position.y + gridSize, movePoint.position.z), 0.2f, movementBlock)) { if (Physics2D.OverlapCircle(new Vector3(movePoint.position.x, movePoint.position.y + gridSize, movePoint.position.z), 0.2f, sandMask)) { sand = Physics2D.OverlapCircle(new Vector3(movePoint.position.x, movePoint.position.y + gridSize, movePoint.position.z), 0.2f, sandMask).GetComponent <Sand>(); if (sand != null) { sand.SandUpCheck(); canSandMove = sand.sandMove; if (canSandMove == true) { FindObjectOfType <AudioManager>().Play("objectSlide"); movePoint.position = new Vector3(movePoint.position.x, movePoint.position.y + gridSize, movePoint.position.z); } } } else { FindObjectOfType <AudioManager>().Play("objectSlide"); movePoint.position = new Vector3(movePoint.position.x, movePoint.position.y + gridSize, movePoint.position.z); FindObjectOfType <DialogueManager>().objectMoveTrigger(); } } else { FindObjectOfType <AudioManager>().Play("pieceStopped"); } if (onCorrectForm == true) { partManager.numOfParts++; onCorrectForm = false; } } } if (Physics2D.OverlapCircle(transform.position, 0.2f, correctLayer)) { onCorrectForm = true; } else { onCorrectForm = false; } if (onCorrectForm == true && victoryNoiseTrigger == false) { FindObjectOfType <AudioManager>().Play("correctSlot"); victoryNoiseTrigger = true; } else if (onCorrectForm == false) { //print("false triggered"); victoryNoiseTrigger = false; } }
public TutorialState(Sand game) : base(game) { }
public ReadyWaitState(Sand game) : base(game) { }
public WinState(Sand game) : base(game) { }
public LoadingState(Sand game) : base(game) { }
internal void _setEntity(int lx, int ly) { if (!(lx >= 0 && ly >= 0 && lx < _parent.LevelWidth && ly < _parent.LevelHeight) || _parent._isBorder(lx, ly)) { return; } int x = lx * GTile.WIDTH; int y = ly * GTile.HEIGHT; GEntity r; switch (_brushIndex) { case 0: r = new Wall(x, y); _parent._setTopEntity(lx, ly, r); break; case 1: r = new Metal(x, y); _parent._setTopEntity(lx, ly, r); break; case 2: r = new Sand(x, y); _parent._setTopTile(lx, ly, r); break; case 3: r = new Water(x, y); _parent._setTopTile(lx, ly, r); break; case 4: r = new Gravel(x, y); _parent._setTopTile(lx, ly, r); break; case 5: r = new Grass(x, y); _parent._setTopTile(lx, ly, r); break; case 6: if (_parent._isOutsideBorder(lx, ly)) { break; } r = new Flag(x, y, Teams.Red); _parent._setFlag((Flag)r); break; case 7: if (_parent._isOutsideBorder(lx, ly)) { break; } r = new Flag(x, y, Teams.Blu); _parent._setFlag((Flag)r); break; case 8: if (_parent._isOutsideBorder(lx, ly)) { break; } r = new Spawner(x, y, Teams.Red); _parent._setSpawner((Spawner)r); break; case 9: if (_parent._isOutsideBorder(lx, ly)) { break; } r = new Spawner(x, y, Teams.Blu); _parent._setSpawner((Spawner)r); break; } }
/// <summary> /// ギミック設置 /// by柏 SE実装 2016.12.14 /// </summary> /// <param name="mapdata">マップデータの二元配列</param> /// <param name="MapThings">マップ上の物のList</param> public static void CreateGimmicks(int[,] mapdata, List <GameObject> MapThings, Sound sound) { for (int i = 0; i < mapdata.GetLength(0); i++) { for (int j = 0; j < mapdata.GetLength(1); j++) { switch (mapdata[i, j]) { case (int)GimmickType.ICE: { Ice ice = new Ice(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(ice); break; } case (int)GimmickType.IRON: { Iron iron = new Iron(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(iron); break; } case (int)GimmickType.LIGHT: { Light light = new Light(new Vector2(j * 64, i * 64)); MapThings.Add(light); break; } case (int)GimmickType.STRAW: { Straw straw = new Straw(new Vector2(j * 64, i * 64)); MapThings.Add(straw); break; } case (int)GimmickType.COAL: { Coal coal = new Coal(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(coal); break; } case (int)GimmickType.GOAL: { Goal goal = new Goal(new Vector2(j * 64, i * 64), sound); MapThings.Add(goal); break; } case (int)GimmickType.WATER: { Water water = new Water(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(water); break; } case (int)GimmickType.WOOD: { Wood wood = new Wood(new Vector2(j * 64, i * 64)); MapThings.Add(wood); break; } case (int)GimmickType.TREE: { Tree tree = new Tree(new Vector2(j * 64, i * 64)); MapThings.Add(tree); break; } case (int)GimmickType.SAND: { Sand sand = new Sand(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(sand); break; } case (int)GimmickType.BALLOON: { Balloon balloon = new Balloon(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(balloon); break; } //葉梨竜太 case (int)GimmickType.HIGHLIGHT3: { MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2(j * 64, (i + 3) * 64), Parameter.MoveLightSpeed); MapThings.Add(moveLight); break; } case (int)GimmickType.SIDELIGHT3: { MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2((j + 3) * 64, i * 64), Parameter.MoveLightSpeed); MapThings.Add(moveLight); break; } case (int)GimmickType.HIGHLIGHT5: { MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2(j * 64, (i + 5) * 64), Parameter.MoveLightSpeed); MapThings.Add(moveLight); break; } case (int)GimmickType.SIDELIGHT5: { MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2((j + 5) * 64, i * 64), Parameter.MoveLightSpeed); MapThings.Add(moveLight); break; } case (int)GimmickType.JSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.JSIGN); MapThings.Add(sign); break; } //葉梨竜太 11/30 case (int)GimmickType.BOMB: { Bomb bomb = new Bomb(new Vector2(j * 64, i * 64), sound, Vector2.Zero); MapThings.Add(bomb); break; } //葉梨竜太 case (int)GimmickType.IGNITER_UR: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_UR); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_UL: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_UL); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_DR: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_DR); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_DL: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_DL); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_HIGHT: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_HIGHT); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_SIDE: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_SIDE); MapThings.Add(igniter); break; } //葉梨竜太 case (int)GimmickType.MSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.MSIGN); MapThings.Add(sign); break; } case (int)GimmickType.RSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.RSIGN); MapThings.Add(sign); break; } case (int)GimmickType.LSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.LSIGN); MapThings.Add(sign); break; } case (int)GimmickType.CSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.CSIGN); MapThings.Add(sign); break; } // 1/13 葉梨竜太 case (int)GimmickType.ROCK: { Stone stone = new Stone(new Vector2(j * 64, i * 64)); MapThings.Add(stone); break; } } } } }
public PlayState(Sand game) : base(game) { }
//by木材追加 長谷川修一 10/27 /// <summary> /// ギミック設置 /// </summary> /// <param name="mapdata">マップデータの二元配列</param> /// <param name="MapThings">マップ上の物のList</param> public static void CreateGimmicks(int[,] mapdata, List <GameObject> MapThings) { for (int i = 0; i < mapdata.GetLength(0); i++) { for (int j = 0; j < mapdata.GetLength(1); j++) { switch (mapdata[i, j]) { case (int)GimmickType.ICE: { Ice ice = new Ice(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(ice); break; } case (int)GimmickType.IRON: { Iron iron = new Iron(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(iron); break; } case (int)GimmickType.LIGHT: { Light light = new Light(new Vector2(j * 64, i * 64)); MapThings.Add(light); break; } case (int)GimmickType.STRAW: { Straw straw = new Straw(new Vector2(j * 64, i * 64)); MapThings.Add(straw); break; } case (int)GimmickType.COAL: { Coal coal = new Coal(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(coal); break; } case (int)GimmickType.GOAL: { Goal goal = new Goal(new Vector2(j * 64, i * 64)); MapThings.Add(goal); break; } case (int)GimmickType.WATER: { Water water = new Water(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(water); break; } case (int)GimmickType.WOOD: { Wood wood = new Wood(new Vector2(j * 64, i * 64)); MapThings.Add(wood); break; } case (int)GimmickType.TREE: { Tree tree = new Tree(new Vector2(j * 64, i * 64)); MapThings.Add(tree); break; } case (int)GimmickType.SAND: { Sand sand = new Sand(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(sand); break; } case (int)GimmickType.BALLOON: { Balloon balloon = new Balloon(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(balloon); break; } } } } }
public BeginState(Sand game) : base(game) { }
public InitialReadyState(Sand game) : base(game) { }
public ChooseMapState(Sand game) : base(game) { }
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); }
public static List <GEntity> GetLevelDetails(List <GEntity> Tiles) { List <GEntity> Details = new List <GEntity>(); int xt, yt; int NxLeft, NyLeft, NxRight, NyRight, NxUp, NyUp, NxDown, NyDown; GEntity LeftTile, RightTile, UpTile, DownTile; foreach (GEntity T in Tiles) { xt = T.iX / GTile.WIDTH; yt = T.iY / GTile.HEIGHT; NxLeft = T.iX - GTile.WIDTH + 2; NyLeft = T.iY; NxRight = T.iX + GTile.WIDTH - 2; NyRight = T.iY; NxUp = T.iX; NyUp = T.iY - GTile.HEIGHT + 2; NxDown = T.iX; NyDown = T.iY + GTile.HEIGHT - 2; LeftTile = GameLevel.GetTile(xt - 1, yt); RightTile = GameLevel.GetTile(xt + 1, yt); UpTile = GameLevel.GetTile(xt, yt - 1); DownTile = GameLevel.GetTile(xt, yt + 1); if (T.Type == TileType.SAND) { if (Sand.IsTraceAcceptable(LeftTile)) { Details.Add(new SandTrace(NxLeft, NyLeft, Directions.Left)); } if (Sand.IsTraceAcceptable(RightTile)) { Details.Add(new SandTrace(NxRight, NyRight, Directions.Right)); } if (Sand.IsTraceAcceptable(UpTile)) { Details.Add(new SandTrace(NxUp, NyUp, Directions.Up)); } if (Sand.IsTraceAcceptable(DownTile)) { Details.Add(new SandTrace(NxDown, NyDown, Directions.Down)); } if (Sand.IsShoreAcceptable(LeftTile)) { Details.Add(new SandShore(NxLeft, NyLeft, Directions.Left)); } if (Sand.IsShoreAcceptable(RightTile)) { Details.Add(new SandShore(NxRight, NyRight, Directions.Right)); } if (Sand.IsShoreAcceptable(UpTile)) { Details.Add(new SandShore(NxUp, NyUp, Directions.Up)); } if (Sand.IsShoreAcceptable(DownTile)) { Details.Add(new SandShore(NxDown, NyDown, Directions.Down)); } } if (T.Type == TileType.GRAVEL) { if (Gravel.IsShoreAcceptable(LeftTile)) { Details.Add(new GravelShore(NxLeft, NyLeft, Directions.Left)); } if (Gravel.IsShoreAcceptable(RightTile)) { Details.Add(new GravelShore(NxRight, NyRight, Directions.Right)); } if (Gravel.IsShoreAcceptable(UpTile)) { Details.Add(new GravelShore(NxUp, NyUp, Directions.Up)); } if (Gravel.IsShoreAcceptable(DownTile)) { Details.Add(new GravelShore(NxDown, NyDown, Directions.Down)); } } if (T.Type == TileType.GRASS) { if (Grass.IsShoreAcceptable(LeftTile)) { Details.Add(new GrassShore(NxLeft, NyLeft, Directions.Left)); } if (Grass.IsShoreAcceptable(RightTile)) { Details.Add(new GrassShore(NxRight, NyRight + 1, Directions.Right)); } if (Grass.IsShoreAcceptable(UpTile)) { Details.Add(new GrassShore(NxUp, NyUp, Directions.Up)); } if (Grass.IsShoreAcceptable(DownTile)) { Details.Add(new GrassShore(NxDown, NyDown, Directions.Down)); } if (Program.Rand.Next(128) < 48) { Details.Add(new Flower((int)T.X + Program.Rand.Next(30 - Flower.WIDTH), (int)T.Y + Program.Rand.Next(30 - Flower.HEIGHT))); } } } return(Details); }
protected GameState(Sand game) { Game = game; }
private static object[] _parseLevel(BinaryReader br) { List <GEntity> ParsedTiles = new List <GEntity>(); List <GEntity> ParsedEntities = new List <GEntity>(); List <GEntity> ParsedSpawners = new List <GEntity>(); int TileWidth = GTile.WIDTH; int TileHeight = GTile.HEIGHT; int Cx = 0; int Cy = 0; int width = br.ReadInt32(); int height = br.ReadInt32(); MapEntity mp; GEntity tTile = null; GEntity tEntity = null; GEntity tSpawner = null; for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { Cx = x * TileWidth; Cy = y * TileHeight; tTile = null; tEntity = null; tSpawner = null; mp = (MapEntity)br.ReadByte(); switch (mp) { case MapEntity.WallOnGravel: tTile = new Gravel(Cx, Cy); tEntity = new Wall(Cx, Cy); break; case MapEntity.WallOnWater: tTile = new Water(Cx, Cy); tEntity = new Wall(Cx, Cy); break; case MapEntity.WallOnSand: tTile = new Sand(Cx, Cy); tEntity = new Wall(Cx, Cy); break; case MapEntity.WallOnGrass: tTile = new Grass(Cx, Cy); tEntity = new Wall(Cx, Cy); break; case MapEntity.Metal: tTile = new GTile(Cx, Cy, true); tEntity = new Metal(Cx, Cy); break; case MapEntity.Water: tTile = new Water(Cx, Cy); break; case MapEntity.Gravel: tTile = new Gravel(Cx, Cy); break; case MapEntity.Sand: tTile = new Sand(Cx, Cy); break; case MapEntity.Grass: tTile = new Grass(Cx, Cy); break; case MapEntity.RedSpawnerOnGravel: tTile = new Gravel(Cx, Cy); tSpawner = new Spawner(Cx, Cy, Teams.Red); break; case MapEntity.RedSpawnerOnWater: tTile = new Water(Cx, Cy); tSpawner = new Spawner(Cx, Cy, Teams.Red); break; case MapEntity.RedSpawnerOnSand: tTile = new Sand(Cx, Cy); tSpawner = new Spawner(Cx, Cy, Teams.Red); break; case MapEntity.RedSpawnerOnGrass: tTile = new Grass(Cx, Cy); tSpawner = new Spawner(Cx, Cy, Teams.Red); break; case MapEntity.BluSpawnerOnGravel: tTile = new Gravel(Cx, Cy); tSpawner = new Spawner(Cx, Cy, Teams.Blu); break; case MapEntity.BluSpawnerOnWater: tTile = new Water(Cx, Cy); tSpawner = new Spawner(Cx, Cy, Teams.Blu); break; case MapEntity.BluSpawnerOnSand: tTile = new Sand(Cx, Cy); tSpawner = new Spawner(Cx, Cy, Teams.Blu); break; case MapEntity.BluSpawnerOnGrass: tTile = new Grass(Cx, Cy); tSpawner = new Spawner(Cx, Cy, Teams.Blu); break; case MapEntity.BluFlagOnGravel: tTile = new Gravel(Cx, Cy); tEntity = new Flag(Cx, Cy, Teams.Blu); break; case MapEntity.BluFlagOnWater: tTile = new Water(Cx, Cy); tEntity = new Flag(Cx, Cy, Teams.Blu); break; case MapEntity.BluFlagOnSand: tTile = new Sand(Cx, Cy); tEntity = new Flag(Cx, Cy, Teams.Blu); break; case MapEntity.BluFlagOnGrass: tTile = new Grass(Cx, Cy); tEntity = new Flag(Cx, Cy, Teams.Blu); break; case MapEntity.RedFlagOnGravel: tTile = new Gravel(Cx, Cy); tEntity = new Flag(Cx, Cy, Teams.Red); break; case MapEntity.RedFlagOnWater: tTile = new Water(Cx, Cy); tEntity = new Flag(Cx, Cy, Teams.Red); break; case MapEntity.RedFlagOnSand: tTile = new Sand(Cx, Cy); tEntity = new Flag(Cx, Cy, Teams.Red); break; case MapEntity.RedFlagOnGrass: tTile = new Grass(Cx, Cy); tEntity = new Flag(Cx, Cy, Teams.Red); break; } if (tTile != null) { ParsedTiles.Add(tTile); } if (tEntity != null) { ParsedEntities.Add(tEntity); } if (tSpawner != null) { ParsedSpawners.Add(tSpawner); } } } return(new object[] { width, height, ParsedTiles, ParsedEntities, ParsedSpawners }); }
public MapEditor(InputHandler Input, int levelWidth, int levelHeight, int fillTile, Modes mapMode, MapEditorGuiScreen parent) { _parent = parent; _mode = mapMode; LevelWidth = levelWidth; LevelHeight = levelHeight; this.Input = Input; Tiles = new List <GEntity>(); Entities = new List <GEntity>(); Spawners = new List <GEntity>(); GEntity e, t; int tx, ty; for (int i = 0; i < LevelHeight; i++) { ty = i * GTile.HEIGHT; for (int j = 0; j < levelWidth; j++) { e = t = null; tx = j * GTile.WIDTH; if (_isBorder(j, i)) { Entities.Add(new Metal(tx, ty)); Tiles.Add(new GTile(tx, ty, true)); continue; } switch (fillTile) { case TileType.WALL: e = new Wall(tx, ty); t = new Gravel(tx, ty); break; case TileType.METAL: e = new Metal(tx, ty); break; case TileType.SAND: t = new Sand(tx, ty); break; case TileType.WATER: t = new Water(tx, ty); break; case TileType.GRAVEL: t = new Gravel(tx, ty); break; case TileType.GRASS: t = new Grass(tx, ty); break; } if (t == null) { t = new GTile(tx, ty, true); } Tiles.Add(t); Entities.Add(e); } } _endConstruct(); }
public LoadoutState(Sand game) : base(game) { }