public override IEnumerator Perform() { Digger digger = Owner.GetComponent <Digger>(); if (!digger.AutoDig) { setDestination(Position); while (!hasReachedTarget()) { yield return(0); } Stop(); } Owner.SendMessage("Dig", SendMessageOptions.DontRequireReceiver); LevelController.Instance.Dig((int)digPosition.x, (int)digPosition.y); yield return(new WaitForSeconds(digger.DigTime)); Owner.SendMessage("DoneDigging", SendMessageOptions.DontRequireReceiver); Owner.SendMessage("ActionComplete"); }
private static void Main(string[] args) { // Inputs Console.WriteLine("Enter Path: "); string directory = Console.ReadLine(); Console.WriteLine("Enter output file: "); string outputFile = Console.ReadLine(); // Init our digger Digger FileDigger = new Digger(); // Create file iterator IEnumerable <string> files = Digger.EnumerateFilesRecursively(directory); // Create Report XDocument doc = Digger.CreateReport(files); // Create and write to html file using (FileStream fs = new FileStream(outputFile, FileMode.Create)) { using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8)) { w.WriteLine(doc); } } }
public void Visit(Digger digger) { log.Verbose("{actor} visit {item} with {stamina}", "Digger", "Camp", digger.Stamina); digger.Stamina = digger.MaxStamina; service.Send(new DiggerInCamp()); }
public virtual async Task <JsonResult> EditPopup(T item) { var r = new JsonResultViewModel(); var keyFieldName = Digger2.GetKeyFieldNameFirst(typeof(T)); var v = Digger.GetObjectValue(item, keyFieldName); if (v != null) { int.TryParse(v.ToString(), out _editId); if (_editId > 0) { var org = Repo.GetItem(_editId); var x = await TryUpdateModelAsync(org); OnEditSaveItem(org); if (Repo.Edit(org)) { r.Ok = true; if (!EditJsAction.IsEmpty()) { r.JsFunction = EditJsAction; } } else { r.Error = MvcLogger.GetErrorMessage(ModelState); } } } else { r.Error = "NOT FOUND"; } return(Json(r)); }
public void DefaultStaminaInitialized() { var digger = new Digger(); digger.Stamina.Should() .BeGreaterThan(0); }
public virtual IActionResult Create(int keepEdit, T item) { OnCreateSaveItem(item); if (Repo.Create(item)) { OnAfterCreateSaveItem(item); if (keepEdit == 0) { return(CreateReturnListUrl.IsEmpty() ? (ActionResult)RedirectToAction("Index") : Redirect(CreateReturnListUrl)); } if (keepEdit == 1) { var keyFieldName = Digger2.GetKeyFieldNameFirst(typeof(T)); var itemIdValue = Digger.GetObjectValue(item, keyFieldName); return(RedirectToAction("Edit", new { id = itemIdValue })); } return(CreateSaveAndCreateUrl.IsEmpty() ? (ActionResult)RedirectToAction("Create") : Redirect(CreateSaveAndCreateUrl)); } ViewBag.EditMode = false; ViewBag.CreateAction = CreateAction; ViewBag.Title = GetTitle(TitleType.Create); BuildCreateMenu(); OnErrorCreateSaveItem(item); ViewBag.PageMenu = PageMenu; return(View(PopupEditor ? ViewCreatePopup : ViewCreate, item)); }
public override bool PreAI() { npc.active = lead.active; npc.realLife = lead.type == mod.NPCType <Magnoliac_head>() ? lead.whoAmI : part.whoAmI; Digger.DiggerPartsAI(npc, part, mod.GetNPC <Magnoliac_head>().followSpeed, ref acc); return(true); }
public Vector2Int[] GenerateRoomPositions() { Digger[] diggers = new Digger[dungeonData.numberOfDiggers]; Vector2Int startPos = Vector2Int.zero; positionVisited.Add(startPos); for (int i = 0; i < diggers.Length; i++) { diggers[i] = new Digger(startPos); } int iterations = UnityEngine.Random.Range(dungeonData.minIterations, dungeonData.maxIterations); for (int i = 0; i < iterations; i++) { for (int j = 0; j < diggers.Length; j++) { Vector2Int newPos = diggers[j].Move(directionMouvementMap); if (!positionVisited.Contains(newPos)) { positionVisited.Add(newPos); } } } return(positionVisited.ToArray()); }
public override void GenerateImpl(int row, int col, Direction dir) { var topRow = row; var leftCol = col; GetTopLeftCorner(ref topRow, ref leftCol, dir); var goalRow = row; var goalCol = col; RHelper.MoveInDirection(ref goalRow, ref goalCol, dir); var digArea = new Rectangle(leftCol + 1, topRow + 1, Width - 2, Height - 2); var digger = new Digger(goalRow, goalCol, (int)((digArea.Width * digArea.Height) / 25d), Map); Map[row, col] = Map[row, col].Is(RCell.Important) ? RCell.Door | RCell.Important | RCell.Closed : RCell.Floor; digger.DigCell(row, col); digger.DigCell(row + 1, col); digger.DigCell(row - 1, col); digger.DigCell(row, col + 1); digger.DigCell(row, col - 1); digger.Dig(); }
public static object InspectDataFormat(object item, DataColumn field, string dataFormat = null) { if (field.EditorType == ColumnTypes.Link) { dataFormat = HttpUtility.UrlDecode(dataFormat); } if (string.IsNullOrWhiteSpace(dataFormat)) { dataFormat = field.DataFormat; } if (string.IsNullOrWhiteSpace(dataFormat)) { var fieldValue = ValueToLabel(field.ValueConverter, Digger.GetObjectValue(item, field.FieldName)); return(fieldValue ?? string.Empty); } var val = dataFormat; var ma = RegexDataFormat.Matches(dataFormat); if (ma.Count > 0) { foreach (Match m in ma) { if (m.Success) { var fieldName = m.Groups[1].Value; var fieldValue = Digger.GetObjectValue(item, fieldName); if (field.FieldName == fieldName) { fieldValue = ValueToLabel(field.ValueConverter, fieldValue); } var fv = fieldValue != null?fieldValue.ToString() : string.Empty; val = val.Replace(m.ToString(), fv); } } } ma = RegexDataFormat2.Matches(dataFormat); if (ma.Count > 0) { foreach (Match m in ma) { if (m.Success) { var fieldName = m.Groups[1].Value; var fieldValue = Digger.GetObjectValue(item, fieldName); if (field.FieldName == fieldName) { fieldValue = ValueToLabel(field.ValueConverter, fieldValue); } var fv = fieldValue != null?fieldValue.ToString() : string.Empty; val = val.Replace(m.ToString(), fv); } } } return(val); }
void Awake() { _digger = GetComponent <Digger>(); if (_digger == null) { Debug.Log("inputdig has no digger", gameObject); } }
void Start() { target = playerTransform.position; digger = GetComponent <Digger>(); audioSource = GetComponent <AudioSource>(); digger.DigSize = 6; LoadWorm(); }
private static string RenderRow(IHtmlHelper helper, DataColumn[] columns, object item, DataGridOptions option) { var builder = new HtmlContentBuilder(); var idx = ""; var idclass = ""; if (option.RowFormatClass != null && !option.RowFormatFunction.IsEmpty()) { var obj = Activator.CreateInstance(option.RowFormatClass); var a = option.RowFormatClass.GetMethod(option.RowFormatFunction); var sonuc = (string)a.Invoke(obj, new dynamic[1] { item }); idclass = $"class='{sonuc}'"; } builder.AppendHtml($"<tr {idx} {idclass}>"); if (string.IsNullOrWhiteSpace(_exportMode)) { builder.AppendHtml(RenderRowButtons(helper, item, option)); foreach (var column in columns.Where(d => d.Visible && d.DataColumnType == DataColumnTypes.CommandColumn)) { var val = Digger.GetObjectValue(item, column.FieldName); if (val is List <DataGridCommand> ) { builder.AppendHtml(RenderRowButtons(val as List <DataGridCommand>)); } } } foreach (var field in columns.Where(d => d.Visible && d.DataColumnType != DataColumnTypes.CommandColumn)) { if (field.Width > 0) { builder.AppendHtml($"<td width='{field.Width}'>"); } else { builder.AppendHtml("<td>"); } if (string.IsNullOrWhiteSpace(field.ObjectValueFunction) || field.ObjectValueConverter == null) { builder.AppendHtml(ValueConverter.GetValue(helper, item, field)); } else { var type = field.ObjectValueConverter; var obj = Activator.CreateInstance(type); var a = type.GetMethod(field.ObjectValueFunction); var sonuc = (string)a.Invoke(obj, new object[2] { helper, item }); builder.AppendHtml(sonuc); } builder.AppendHtml("</td>"); } builder.AppendHtml("</tr>"); return(builder.GetString()); }
public static void ToCsvEXport <T>(this IEnumerable <T> list, string fileName) { var excelDoc = new StreamWriter(fileName, false, Encoding.UTF8); var rowCount = 0; var rowData = string.Empty; var type = typeof(T); var props = type.GetProperties(); foreach (var prop in props) { rowData += prop.Name + ";"; } excelDoc.WriteLine(rowData); foreach (T x in list) { rowData = string.Empty; rowCount++; foreach (var prop in props) { var value = Digger.GetObjectValue(x, prop.Name); if (value == null) { rowData += ";"; continue; } switch (prop.PropertyType.ToString()) { case "System.DateTime": var xmlDate = (DateTime)value; rowData += xmlDate.ToString("yyyy-MM-dd") + ";"; break; case "System.String": case "System.Boolean": case "System.Int16": case "System.Int32": case "System.Int64": case "System.Byte": rowData += value + ";"; break; case "System.Decimal": rowData += value.ToString().Replace(",", "."); break; case "System.Double": rowData += (decimal.Parse(value.ToString()).ToString("N2").Replace(",", ".")); break; default: rowData += ";"; break; } } excelDoc.WriteLine(rowData); } excelDoc.Close(); }
public void Visit(Digger digger) { digger.Stamina -= StaminaPrice; log.Verbose("Stamina reduced on {staminaPrice}", StaminaPrice); log.Verbose("{actor} moved, stamina left {stamina}", "Digger", digger.Stamina); Building.Visit(digger); digger.GemBag.Add(Gem); }
public void Initialize(ushort tileID, ushort wallID) { rand = WorldGen.genRand.Next(7, 12); diggers = new Digger[rand]; for (int i = 0; i < rand; i++) { diggers[i] = new Digger(25, tileID, wallID); } }
private void btnSearch_Click_1(object sender, EventArgs e) { DirectoryInfo d = new DirectoryInfo(txtDirectory.Text); SizeGetter sg1 = new SizeGetter(); TreeNode t = trvDirectories.Nodes.Add(d.FullName, d.Name + " (" + (int)sg1.GetDirectorySize(d.FullName) / 1000 + "K)"); Digger digger = new Digger(); digger.Dig(d, this); }
public void CantAddNullGem() { var digger = new Digger(); digger.GemBag.Add(new NullGem()); digger.GemBag.Gems.Count .Should() .Be(0); }
public void ItShouldBePossible() { var digger = new Digger(); digger.GemBag.Add(new Coal()); digger.GemBag.Gems.Count .Should() .Be(1); }
public override bool AllowEntrance(Digger digger) { if (Density <= 0) { return(true); } Density -= digger.Attack(); return(false); }
public void StaminaShouldDecrese() { var digger = new Digger(); var initialStamina = digger.Stamina; digger.Move(new EmptyTile()); digger.Stamina .Should() .BeLessThan(initialStamina); }
public FileExplorerConsole() { //String foldername = @"C:\Users\Tenurian\Tester"; String foldername = @"C:\Users\Tenurian\Documents\Visual Studio 2015\Projects\FileExplorerConsole"; Digger digger = new Digger(); spacers.Add(foldername, 1); DirectoryFound(new DirectoryInfo(foldername)); //this is here to ensure the top folder appears digger.Dig(new DirectoryInfo(foldername), this); Console.ReadLine(); }
public virtual async Task <IActionResult> Edit(int keepEdit, T item) { if (!OnEditAuthCheck()) { return(new ForbidResult()); } var keyFieldName = Digger2.GetKeyFieldNameFirst(typeof(T)); var v = Digger.GetObjectValue(item, keyFieldName); if (v != null) { int.TryParse(v.ToString(), out _editId); if (_editId > 0) { var org = await GetEditSaveItem(_editId); OnEditBeforeSaveItem(item, org); await TryUpdateModelAsync(org); if (OnEditSaveCheck(org)) { try { OnEditSaveItem(org); if (await Repo.EditAsync(org)) { OnAfterEditSaveItem(org); if (keepEdit == 0) { return(EditReturnListUrl.IsEmpty() ? (ActionResult)RedirectToAction("Index") : Redirect(EditReturnListUrl)); } return(RedirectToAction("Edit", new { id = _editId })); } } catch (Exception ex) { ModelState.AddModelError(keyFieldName, MvcLogger.GetErrorMessage(ex)); } ViewBag.EditMode = true; ViewBag.EditAction = EditAction; ViewBag.Title = GetTitle(TitleType.Editor); BuildEditMenu(); ViewBag.PageMenu = PageMenu; OnEditItem(org); return(View(PopupEditor ? ViewEditPopup : ViewEdit, org)); } return(new ForbidResult()); } } return(NotFound()); }
private void Awake() { mc = GetComponent <MovementController>(); mc.OnLanding += OnLanding; cam = Camera.main; health = GetComponent <Health>(); health.OnDeath += OnDeath; fps = cam.GetComponent <FirstPersonCamera>(); digger = GetComponent <Digger>(); audioSource = GetComponent <AudioSource>(); grapplingHook = GetComponent <GrapplingHook>(); digger.DigSize = DigSize; }
public void GoldShouldBeSummedFromBag() { var digger = new Digger(); digger.GemBag.Add(new Coal()); var service = new StoreService(); service.Handle(new DiggerInStore(digger)); digger.Gold.Should() .Be(10); digger.GemBag.Gems.Should() .BeEmpty(); }
void Awake() { _digUI = GetComponentInChildren <Canvas>(); if (_digUI == null) { Debug.Log("no canvas component in diggable children", gameObject); } _progressImage = _digUI.GetComponentInChildren <Image>(); if (_progressImage == null) { Debug.Log("no image component in diggable canvas children", gameObject); } _workDone = 0; _digger = null; }
public CaveBody(Digger d) : base(d) { //Debug.Log("creating cave body - adding to caves list"); digger.neighbourCount = 0; digger.gradient = 0; //Debug.Log("before: " + digger.master is CaveEntrance); digger.master = this; //ebug.Log("after: " + digger.master is CaveEntrance); center = Vector3.zero; CaveManager.caves.Add(this); digger.setScale(10); if (tier > 0) { Debug.Log("creating cave with tier = " + tier); } }
private Digger digger; // DiggerAgent objet that is going to build the dungeon public override void BuildDungeon() { AssertProperties(); // Create dungeon grid dungeon = new Dungeon(dungeonHeight, dungeonWidth); dungeon.createDungeonGrid(dungeonTopLeftCellPosition, floorTileDimensions); // Initialise digger digger = new Digger(dungeon, corridorMinTilesLength, corridorMaxTilesLength, removeDirtyCorridors); // Place digger in a random dungeon cell leaving a margin on the right and the bottom parts of the grid for the first room digger.SetDiggerInitialPosition(roomMinTilesWidth, roomMinTilesHeight); // Create dungeon digger.DigDungeon(roomMinTilesWidth, roomMaxTilesWidth, roomMinTilesHeight, roomMaxTilesHeight, floorTileDimensions, floorMaterial, wallHeight, wallMaterial); // Set entrance and exit rooms dungeon.chooseEntranceRoomAndExitRoom(0, dungeon.getDungeonRooms().Count - 1); // Set the corridors and rooms to be children of the dungeon game object dungeon.setRoomsAndCorridorsAsDungeonChildren(); // Set that the dungeon has finished building dungeonBuildingFinished = true; }
public virtual async Task <IActionResult> Create(int keepEdit, T item) { if (!OnCreateAuthCheck()) { return(new ForbidResult()); } var keyFieldName = Digger2.GetKeyFieldNameFirst(typeof(T)); try { OnCreateSaveItem(item); if (OnCreateSaveCheck(item)) { if (await Repo.CreateAsync(item)) { OnAfterCreateSaveItem(item); if (keepEdit == 0) { return(CreateReturnListUrl.IsEmpty() ? (ActionResult)RedirectToAction("Index") : Redirect(CreateReturnListUrl)); } if (keepEdit == 1) { var itemIdValue = Digger.GetObjectValue(item, keyFieldName); return(RedirectToAction("Edit", new { id = itemIdValue })); } return(CreateSaveAndCreateUrl.IsEmpty() ? (ActionResult)RedirectToAction("Create") : Redirect(CreateSaveAndCreateUrl)); } } return(new ForbidResult()); } catch (Exception ex) { ModelState.AddModelError(keyFieldName, MvcLogger.GetErrorMessage(ex)); } ViewBag.EditMode = false; ViewBag.CreateAction = CreateAction; ViewBag.Title = GetTitle(TitleType.Create); BuildCreateMenu(); OnErrorCreateSaveItem(item); ViewBag.PageMenu = PageMenu; return(View(PopupEditor ? ViewCreatePopup : ViewCreate, item)); }
public void removeDigger(Digger d) { diggers.Remove(d); Destroy(d.gameObject); if (diggers.Count <= 0) { tiersLeft--; gatherCaveVoxels(); //Debug.Log("finished cave tier " + (caveTiers - tiersLeft - 1)); if (tiersLeft <= 0) { finishDigging(); } else {//keep digging digNextTier(); } //MapManager.SmoothVoxels(); } }
void Start() { dig = GameObject.FindGameObjectWithTag("Digger").GetComponent<Digger>(); rm = GetComponent<Rooms_Manager>(); mm = GetComponent<Map_Manager>(); cm = GetComponent<Cleanup_Manager>(); //StartCoroutine(StartGeneration(1f)); }