// Constructor public LevelsSolidTiles(Solidity solids, Delegate update) { this.solids = solids; this.update = update; InitializeComponent(); RefreshPhysicalTile(); SearchSolidTile = new SearchSolidTile(this, solidityTiles); }
public SolidityVisitor() { Solidity = new Solidity { Contracts = new List <Solidity.Contract>(), Imports = new List <string>() }; }
/// <summary> /// /// </summary> /// <param name="id">The type of this tile.</param> /// <param name="solidityType"></param> /// <param name="textureSourceRectangle">The appropriate source rectangle to use. see <c>SourceRects</c>.</param> /// <param name="drawColor"></param> public Tile(TileId id, Solidity solidityType, Rectangle textureSourceRectangle, Color drawColor, TileSide tileSide) { this.Id = id; this.SolidityType = solidityType; this.SourceRectangle = textureSourceRectangle; this.DrawColor = drawColor; this.Side = tileSide; }
private async void OnPurchaseButton(object sender, EventArgs args) { await Task.Run(() => { Solidity.PurchaseCard(Solidity.MyAddress, Solidity.MyPrivateKey); }); await DisplayAlert("Gratz", "Bought! Refresh to see.", "Yay!"); }
public void HealNotWorksOnDeathObject() { var deathSolidity = new Solidity(_MAX_HEALTH, _DEFENCE, 0, 0); var expectedHealth = 0; deathSolidity.Heal(10); Assert.AreEqual(expectedHealth, deathSolidity.CurrentHealth); }
public void HealWorksOnAliveObject() { var health = 10; var aliveSolidity = new Solidity(_MAX_HEALTH, _DEFENCE, 0, health); var healPoints = 30; var expectedHealth = healPoints + health; aliveSolidity.Heal(healPoints); Assert.AreEqual(expectedHealth, aliveSolidity.CurrentHealth); }
public TileData(string _name, Solidity _solidity, int _id, ContentManager content, TileBehaviour _behaviour = null, Category _category = Category.NONE) { name = _name; id = _id; if (File.Exists("Content/Tiles/" + name + ".xnb")) { texture = content.Load <Texture2D>("Tiles/" + _name); } solidity = _solidity; behaviour = _behaviour; category = _category; }
private async void HandleSend(object sender, string address) { SendPopup.AddressEvent -= HandleSend; if (Solidity.MyAddress.Equals(address, StringComparison.CurrentCultureIgnoreCase)) { await DisplayAlert("Bad address", "You can't send to yourself!", "OK"); await PopupNavigation.Instance.RemovePageAsync(popup); return; } await Task.Run(() => { Device.BeginInvokeOnMainThread(() => { popup.SendButton.IsVisible = false; }); Solidity.ApproveForMe(Card.Token); Solidity.SafeTransferFromMe(address, Card.Token); }); await PopupNavigation.Instance.RemovePageAsync(popup); }
/// <summary> /// Returns true if the given direction's face is solid /// </summary> /// <param name="dir">The direction to check</param> /// <returns></returns> public bool IsSolid(OrdinalDirections dir) { return(Solidity.GetBoolForDir(dir)); }
/// <inheritdoc cref="Arc(Nvg, float, float, float, float, float, Winding)"/><br/> public static void Arc(this Nvg nvg, float cx, float cy, float r, float a0, float a1, Solidity solidity) => Arc(nvg, new Vector2D <float>(cx, cy), r, a0, a1, (Winding)solidity);
/// <inheritdoc cref="Arc(Nvg, Vector2D{float}, float, float, float, Winding)"/><br/> public static void Arc(this Nvg nvg, Vector2D <float> c, float r, float a0, float a1, Solidity solidity) => Arc(nvg, c, r, a0, a1, (Winding)solidity);
/// <inheritdoc cref="PathWinding(Nvg, Winding)"/><br/> public static void PathWinding(this Nvg nvg, Solidity sol) => PathWinding(nvg, (Winding)sol);
//possible efficiency increaser: create a combined get+change block function /// <summary> /// NOT FULLY IMPLEMENTED: Does not use the x/z size. Or the direction, for that matter. /// ALSO, does not wrap outside of the chunk. /// </summary> /// <param name="chunkBase">The chunk containing the entity</param> /// <param name="posInChunk">The entity's position in the chunk</param> /// <param name="direction">The direction the entity is facing, for bounding-box purposes</param> /// <param name="size">The size of the entity</param> /// <returns></returns> public Solidity[][][] detectCollision(IntVector3 chunkBase, Vector3 posInChunk, Vector3 direction, IntVector3 size) { IntVector3 mappedChunk = chunkBase - mapOffset; if (posInChunk.X < 0) { posInChunk.X += 16; mappedChunk = mappedChunk + new IntVector3(-1, 0, 0); } if (posInChunk.X > 16) { posInChunk.X -= 16; mappedChunk = mappedChunk + new IntVector3(1, 0, 0); } if (posInChunk.Y < 0) { posInChunk.Y += 16; mappedChunk = mappedChunk + new IntVector3(0, -1, 0); } if (posInChunk.Y > 16) { posInChunk.Y -= 16; mappedChunk = mappedChunk + new IntVector3( 0, 1,0); } if (posInChunk.Z < 0) { posInChunk.Z += 16; mappedChunk = mappedChunk + new IntVector3(0, 0, -1); } if (posInChunk.Z < 0) { posInChunk.Z += 16; mappedChunk = mappedChunk + new IntVector3(0, 0, 1); } Chunk chunk = map.get(mappedChunk); Solidity[][][] collidingWith = new Solidity[1][][]; for (int i = 0; i < collidingWith.Length; i++) { collidingWith[i] = new Solidity[size.Y + 1][]; for (int j = 0; j < collidingWith[i].Length; j++) { collidingWith[i][j] = new Solidity[1]; } } //well that is a mess, but I can't really think of a better way to actually pass the dimensions... for (int y = 0; y < size.Y + 1; y++) { if (posInChunk.Y + y > 15) { collidingWith[0][y][0] = Solidity.vacuum; //Chunk temp = map.get(mappedChunk + new IntVector3(0,1,0)); //collidingWith[0][y][0] = temp.getBlock((int)Math.Floor(posInChunk.X), (int)Math.Floor(posInChunk.Y) + y - 16, (int)Math.Floor(posInChunk.Z)); } else { Block got = chunk.getBlock((int)Math.Floor(posInChunk.X), (int)Math.Floor(posInChunk.Y) + y, (int)Math.Floor(posInChunk.Z)); if (got == null) collidingWith[0][y][0] = Solidity.vacuum; else collidingWith[0][y][0] = got.solidity; } } return collidingWith; }
public void BuildChunk(TileChunk chunk, bool isLayerOne) { if (isLayerOne) { if (chunk.HeightBlocks1.Truthy()) return; var hb1 = chunk.HeightBlocks1 = new Solidity[128][]; var ab1 = chunk.AngleMap1 = new int[8][]; for (var _1 = 0; _1 < 128; _1++) { hb1[_1] = new Solidity[128]; } for (var _1 = 0; _1 < 8; _1++) { ab1[_1] = new int[8]; } for (var _y = 0; _y < 8; _y++) { for (var _x = 0; _x < 8; _x++) { var tp = chunk.TilePieces[_x][_y]; ab1[_x][_y] = tp.GetLayer1Angles(); if (!(ab1[_x][_y] == 0 || ab1[_x][_y] == 255 || ab1[_x][_y] == 1)) { if (tp.XFlip) { if (tp.YFlip) { ab1[_x][_y] = 192 - ab1[_x][_y] + 192; ab1[_x][_y] = 128 - ab1[_x][_y] + 128; } else ab1[_x][_y] = 128 - ab1[_x][_y] + 128; } else { if (tp.YFlip) ab1[_x][_y] = 192 - ab1[_x][_y] + 192; else ab1[_x][_y] = (ab1[_x][_y]); } } var __x = 0; var __y = 0; HeightMap heightMask = tp.GetLayer1HeightMaps(); int[] heightMaskItems = null; if (heightMask == null) continue; Solidity mj; if (heightMask.Full != null) { mj = !heightMask.Full.Value ? 0 : tp.Solid1; for (__y = 0; __y < 16; __y++) { for (__x = 0; __x < 16; __x++) { hb1[(_x * 16 + __x)][(_y * 16 + __y)] = mj; } } } else heightMaskItems = heightMask.Items; for (__y = 0; __y < 16; __y++) { for (__x = 0; __x < 16; __x++) { var jx = 0; var jy = 0; if (tp.XFlip) { if (tp.YFlip) { jx = 15 - __x; jy = 15 - __y; } else { jx = 15 - __x; jy = __y; } } else { if (tp.YFlip) { jx = __x; jy = 15 - __y; } else { jx = __x; jy = __y; } } if (heightMask.Full == null) { switch (tp.Solid1) { case 0: hb1[(_x * 16 + jx)][(_y * 16 + jy)] = 0; break; case (Solidity)1: case (Solidity)2: case (Solidity)3: hb1[(_x * 16 + jx)][(_y * 16 + jy)] = HeightMap.ItemsGood(heightMaskItems, __x, __y) ? tp.Solid1 : 0; break; } } } } } } } else { if (chunk.HeightBlocks2.Truthy()) return; var hb2 = chunk.HeightBlocks2 = new Solidity[128][]; var ab2 = chunk.AngleMap2 = new int[8][]; for (var _1 = 0; _1 < 128; _1++) { hb2[_1] = new Solidity[128]; } for (var _1 = 0; _1 < 8; _1++) { ab2[_1] = new int[8]; } for (var _y = 0; _y < 8; _y++) { for (var _x = 0; _x < 8; _x++) { var tp = chunk.TilePieces[_x][_y]; ab2[_x][_y] = tp.GetLayer2Angles(); if (!(ab2[_x][_y] == 0 || ab2[_x][_y] == 255 || ab2[_x][_y] == 1)) { if (tp.XFlip) { if (tp.YFlip) { ab2[_x][_y] = 192 - ab2[_x][_y] + 192; ab2[_x][_y] = 128 - ab2[_x][_y] + 128; } else ab2[_x][_y] = 128 - ab2[_x][_y] + 128; } else { if (tp.YFlip) ab2[_x][_y] = 192 - ab2[_x][_y] + 192; else ab2[_x][_y] = (ab2[_x][_y]); } } int __x; int __y; var hd2 = tp.GetLayer2HeightMaps(); if (hd2 == null) continue; Solidity mj; int[] hd2Items = null; if (hd2.Full != null) { mj = hd2.Full == false ? 0 : tp.Solid2; for (__y = 0; __y < 16; __y++) { for (__x = 0; __x < 16; __x++) { hb2[(_x * 16 + __x)][(_y * 16 + __y)] = mj; } } } else hd2Items = hd2.Items; for (__y = 0; __y < 16; __y++) { for (__x = 0; __x < 16; __x++) { var jx = 0; var jy = 0; if (tp.XFlip) { if (tp.YFlip) { jx = 15 - __x; jy = 15 - __y; } else { jx = 15 - __x; jy = __y; } } else { if (tp.YFlip) { jx = __x; jy = 15 - __y; } else { jx = __x; jy = __y; } } if (hd2.Full == null) { switch (tp.Solid2) { case (Solidity)0: hb2[(_x * 16 + jx)][(_y * 16 + jy)] = Solidity.NotSolid; break; case (Solidity)1: case (Solidity)2: case (Solidity)3: hb2[(_x * 16 + jx)][(_y * 16 + jy)] = HeightMap.ItemsGood(hd2Items, __x, __y) ? tp.Solid2 : 0; break; } } //imap[(x * 128 + _x * 16 + __x) + (y * 128 + _y * 16 + __y) * (SonicManager.Instance.SonicLevel.LevelWidth)] = tp.heightMask.angle; } } } } } }
public void ObjectWithZeroHealthIsNotAlive() { var deadSolidity = new Solidity(_MAX_HEALTH, _DEFENCE, 0, 0); Assert.False(deadSolidity.IsAlive()); }
public void ObjectWithNotZeroHealthIsAlive() { var aliveSolidity = new Solidity(_MAX_HEALTH, _DEFENCE, 0, 1); Assert.True(aliveSolidity.IsAlive()); }
public void Setup() { _testSolidity = new Solidity(_MAX_HEALTH, _DEFENCE); }