IEnumerator combatHanlder() { UnitSearch search = null; while (true) { if (search == null) { search = new UnitSearch(maxScoutRange, teamCode, Map.instance.getNodeFromLocation(transform.position)); while (search.status == UnitSearch.PathStatus.inProcess) { yield return(null); } if (search.status == UnitSearch.PathStatus.succeeded) { if (search.result == null) { print("Search result is null"); continue; } search.result.takeDamage(attackDamage); } search = null; } yield return(new WaitForSeconds(timeBetweenScans)); } }
public void Init(Unit myUnit, UnitSearch searcher) { m_unit = myUnit; m_unit.m_ai = this; m_enermySearcher = searcher; if (m_enermySearcher) { m_enermySearcher.m_myAi = this; } m_AiProcessList.Capacity = (int)eAiProcess.Max; for (int i = 0; i < (int)eAiProcess.Max; ++i) { m_AiProcessList.Add(null); } AddState(eAiProcess.come_into_the_world, new AiProcessComeIntoTheWorld(eAiProcess.fly_run)); AddState(eAiProcess.idle, new AiProcessIdle()); AddState(eAiProcess.run, new AiProcessMoving()); AddState(eAiProcess.attack, new AiProcessAttack()); AddState(eAiProcess.die, new AiProcessDie()); AddState(eAiProcess.fly_run, new AiFlyMoving()); AddState(eAiProcess.fly_attack, new AiFlyAttack()); AddState(eAiProcess.fly_idle, new AiFlyIdle()); AddState(eAiProcess.fly_die, new AiFlyDie()); SetNextProcess(eAiProcess.come_into_the_world); m_UnitAttribute = new UnitAttribute(); }
private UnitSearch ToNewSetting(FileProperty property) { var reference = this.GetReference(property); if (reference == null) { return(null); } var newSetting = new UnitSearch() { Property = property, Reference = reference, }; if (property.IsComperable()) { newSetting.Mode = this.CompareOperator[this.CompareOperatorSelectedIndex.Value].Value; } else { newSetting.Mode = (this.EqualitySelectedIndex.Value == this.GetEqualitySelectorIndex(true)) ? CompareMode.NotEqual : CompareMode.Equal; } return(newSetting); }
// Use this for initialization static public Unit CreateUnit(string unitResourceName) { //unit GameObject goPrefab = Resources.Load <GameObject> (unitResourceName); if (goPrefab == null) { Debug.LogError("Unit Create Error => " + unitResourceName); return(null); } GameObject l_gameObject = GameObject.Instantiate <GameObject> (goPrefab); l_gameObject.SetActive(true); Unit unit = l_gameObject.GetComponent <Unit>(); //searcher UnitSearch unitSearcher = UnitSearch.CreateUnitSearch(unit.MyTransform, 15); //gage bar unit.m_unitGagebar = GameMgr.Ins.m_unitLocation.m_gagebar.GetComponent <UxUnitGagebar>(); unit.m_UnitAttribute = new UnitAttribute(); //ai UnitAi unitAi = new UnitAi(); unitAi.Init(unit, unitSearcher); return(unit); }
public void Init(Unit myUnit, UnitSearch searcher) { m_unit = myUnit; m_unit.m_ai = this; m_enermySearcher = searcher; if(m_enermySearcher)m_enermySearcher.m_myAi = this; }
public void Init(Unit myUnit, UnitSearch searcher) { m_unit = myUnit; m_unit.m_ai = this; m_enermySearcher = searcher; if (m_enermySearcher) { m_enermySearcher.m_myAi = this; } }
public ActionResult UnitReport(string designation, string title, int?semester, DateTime?beginDate, DateTime?endDate, int?lecturerId, string status) { UnitSearch unitSearch = new UnitSearch(this.DatabaseContext); unitSearch.Designation = designation; unitSearch.Title = title; unitSearch.Semester = semester; unitSearch.BeginDate = beginDate; unitSearch.EndDate = endDate; unitSearch.LecturerId = lecturerId; unitSearch.SetStatus(status); UnitReport report = new UnitReport(); report.Search = unitSearch; return(Content(report.CreateReport(), "text/html")); }
public static UnitSearch CreateUnitSearch(Transform parentTr, float searchRange) { GameObject unitSearchObj = new GameObject("UnitSearch"); unitSearchObj.transform.parent = parentTr; unitSearchObj.transform.localPosition = Vector3.zero; unitSearchObj.layer = LayerMask.NameToLayer("UnitSearch"); SphereCollider sphereCollider = unitSearchObj.AddComponent <SphereCollider>(); Rigidbody rigidbody = unitSearchObj.AddComponent <Rigidbody> (); UnitSearch unitSearch = unitSearchObj.AddComponent <UnitSearch>(); sphereCollider.radius = searchRange; sphereCollider.isTrigger = true; rigidbody.isKinematic = true; rigidbody.useGravity = false; unitSearchObj.SetActive(false); return(unitSearch); }
public async Task Test_Find() { var connector = FortnoxClient.UnitConnector; var existingCount = (await connector.FindAsync(null)).TotalResources; var marks = TestUtils.RandomString(); var createdEntries = new List <Unit>(); //Add entries for (var i = 0; i < 5; i++) { var createdEntry = await connector.CreateAsync(new Unit() { Code = marks + i, Description = TestUtils.RandomString() }); createdEntries.Add(createdEntry); } //Filter not supported var fullCollection = await connector.FindAsync(null); Assert.AreEqual(existingCount + 5, fullCollection.TotalResources); Assert.AreEqual(5, fullCollection.Entities.Count(x => x.Code.StartsWith(marks))); //Limit not supported var searchSettings = new UnitSearch(); searchSettings.Limit = 2; var limitedCollection = await connector.FindAsync(searchSettings); Assert.AreEqual(2, limitedCollection.Entities.Count); //Delete entries foreach (var entry in createdEntries) { await connector.DeleteAsync(entry.Code); } }
public IActionResult Index(string designation, string title, int?semester, DateTime?beginDate, DateTime?endDate, int?lecturerId, string status, string courseDesignation) { UnitSearch unitSearch = new UnitSearch(this.DatabaseContext); unitSearch.Designation = designation; unitSearch.Title = title; unitSearch.Semester = semester; unitSearch.BeginDate = beginDate; unitSearch.EndDate = endDate; unitSearch.LecturerId = lecturerId; unitSearch.SetStatus(status); unitSearch.CourseDesignation = courseDesignation; LecturerSearch lecturerSearch = new LecturerSearch(this.DatabaseContext); lecturerSearch.ShowDummyAll = true; lecturerSearch.ShowDummyNone = true; ViewBag.Lecturers = lecturerSearch.Search().Select(eachLecturer => new SelectListItem { Text = eachLecturer.Fullname, Value = eachLecturer.Id.ToString(), Selected = (lecturerId.HasValue && eachLecturer.Id == lecturerId.Value) || (!lecturerId.HasValue && eachLecturer.IsDummyAll) }); ViewBag.UnitTitle = title; ViewBag.Designation = designation; ViewBag.Semester = semester; if (beginDate.HasValue) { ViewBag.BeginDate = beginDate.Value.ToString("yyyy-MM-dd"); } if (endDate.HasValue) { ViewBag.EndDate = endDate.Value.ToString("yyyy-MM-dd"); } ViewBag.Status = status; ViewBag.CourseDesignation = courseDesignation; this.PutRolesInViewBag(); return(View(unitSearch.Search())); }
public void Init(Unit myUnit, UnitSearch searcher) { m_unit = myUnit; m_unit.m_ai = this; m_enermySearcher = searcher; if(m_enermySearcher)m_enermySearcher.m_myAi = this; m_AiProcessList.Capacity = (int)eAiProcess.Max; for(int i = 0; i < (int)eAiProcess.Max; ++i) { m_AiProcessList.Add(null); } AddState( eAiProcess.come_into_the_world, new AiProcessComeIntoTheWorld(eAiProcess.fly_run)); AddState( eAiProcess.idle, new AiProcessIdle()); AddState( eAiProcess.run, new AiProcessMoving()); AddState( eAiProcess.attack, new AiProcessAttack()); AddState( eAiProcess.die, new AiProcessDie()); AddState( eAiProcess.fly_run, new AiFlyMoving()); AddState( eAiProcess.fly_attack, new AiFlyAttack()); AddState( eAiProcess.fly_idle, new AiFlyIdle()); AddState( eAiProcess.fly_die, new AiFlyDie()); SetNextProcess (eAiProcess.come_into_the_world); m_UnitAttribute = new UnitAttribute (); }
private void Init(UnitSearch source) { this.PropertyListSelectedIndex = new ReactiveProperty <int>(-2).AddTo(this.unsubscribers); this.CompareOperatorSelectedIndex = new ReactiveProperty <int> (this.CompareOperator.FindIndex(x => x.Value == ((source?.Mode) ?? CompareMode.Equal))).AddTo(this.unsubscribers); this.EqualitySelectedIndex = new ReactiveProperty <int> (source == null ? 0 : this.GetEqualitySelectorIndex(!source.Mode.ContainsEqual())); this.TextBoxContent = new ReactiveProperty <string> ((source == null || !source.Property.IsText()) ? "" : source.Reference.ToString()).AddTo(this.unsubscribers); this.DateContent = new ReactiveProperty <DateTime> ((source == null || !source.Property.IsDate()) ? DateTime.Now : ((DateTimeOffset)source.Reference).Date).AddTo(this.unsubscribers); this.TagListSelectedIndex = new ReactiveProperty <int> ((source == null || source.Property != FileProperty.ContainsTag) ? -1 : this.RegisteredTags.FindIndex(x => x.Key == (int)source.Reference)).AddTo(this.unsubscribers); this.NumericText = new ReactiveProperty <int?>( (source != null && source.Property.IsInteger()) ? ((int?)(source.Reference as long?) ?? (source.Reference as int?)) : null) .AddTo(this.unsubscribers); this.FloatText = new ReactiveProperty <double?>( (source != null && source.Property.IsFloat()) ? (source.Reference as double?) ?? (source.Reference as int?) : null) .AddTo(this.unsubscribers); if (source == null) { this.DirectoryList = new ObservableCollection <DirectoryInfo>(); this.AddHierarchy(this.library.TreeRootNode, 0); } else { var newList = new List <DirectoryInfo>(); var text = source.Reference as string; if (source.Property == FileProperty.DirectoryPathStartsWith && text != null) { var pathList = this.library.GetPathList(text); pathList.ForEach(x => this.AddHierarchy(newList, x)); pathList.Skip(1).Zip(newList, (p, n) => new { Key = p.GetKey(), Node = n }) .ForEach(x => x.Node.Choice(x.Key)); } else { this.AddHierarchy(newList, this.library.TreeRootNode); } this.DirectoryList = new ObservableCollection <DirectoryInfo>(newList); } }