/// <summary> /// Creates a new HeroParty with the given name and a leader already set. /// </summary> /// <param name="partyName">The (unique) name of the HeroParty to create.</param> /// <param name="leader">The Hero that will be the leader of this HeroParty.</param> /// <returns>True if the HeroParty was created, false if a HeroParty with the given name already exists.</returns> /// <remarks>If a HeroParty with the given name already exists, the GameObject 'leader' may not be assigned to the leader position.</remarks> public bool CreateHeroParty(string partyName, HeroComponent leader) { bool newParty = CreateHeroParty(partyName); heroParties[partyName].AddPartyMember(leader); NumHeroesAlive++; return newParty; }
/// <summary> /// Creates a new HeroParty with the given name and a leader already set. /// </summary> /// <param name="partyName">The (unique) name of the HeroParty to create.</param> /// <param name="leader">The Hero that will be the leader of this HeroParty.</param> /// <param name="partyMembers">An array of Hero party members that does not include the leader.</param> /// <returns>True if the HeroParty was created, false if a HeroParty with the given name already exists.</returns> /// <remarks>If a HeroParty with the given name already exists, the GameObject 'leader' may not be assigned to the leader position.</remarks> public bool CreateHeroParty(string partyName, HeroComponent leader, HeroComponent[] partyMembers) { bool newParty = CreateHeroParty(partyName, leader); NumHeroesAlive++; for (int i = 0; i < partyMembers.Length; i++) AddHeroToParty(partyName, partyMembers[i]); return newParty; }
/// <summary> /// Gets the HeroComponent that the given HeroComponent should be following. /// </summary> /// <param name="hero"> /// The HeroComponent in question. /// </param> /// <returns> /// The HeroComponent to follow or null if the HeroComponent provided is a leader. /// </returns> public HeroComponent GetWhoIFollow(HeroComponent hero) { //If it's a leader then return null. HeroComponent toFollow = null; int index = heroQueue.FindNextHero(hero); if (index >= 0) toFollow = heroQueue[index].GetComponent<HeroComponent>(); return toFollow; }
protected void Awake() { waypointManager = GameObject.Find("WaypointManager").GetComponent<WaypointManager>(); waypointManager.SubscribeToAssignedWaypointEvent(this.gameObject, SetWaypoint); myBehaviorManager.OnBehaviorStateChangedEvent += HandleOnBehaviorStateChangedEvent; myEntityComponent = GetComponent<HeroComponent>(); performingActions = false; movingToEntity = false; }
protected override void Awake() { base.Awake(); attackNoticeWatcher = GetComponentInChildren<AttackNoticeWatcher>(); // attackNoticeWatcher.onAttackNotice += HandleOnAttackNotice; movementComponent = transform.parent.GetComponent<MovementManager>(); movementComponent.StopMovement(); enemyTracking = null; enemiesInRange = new List<HeroComponent>(); }
protected void SetEnemy() { if (enemiesInRange.Count > 0) { enemyTracking = enemiesInRange[0]; movementComponent.CurrTarget = enemyTracking.transform; movementComponent.ResumeMovement(); } else //We have nothing, reset our target. { enemyTracking = null; movementComponent.CurrTarget = null; } }
public int FindNextHero(HeroComponent hero) { int index = -1; for (int i = 0; i < heroes.Count; i++) { if (heroes[i] == hero) { index = i - 1; break; } } return index; }
public bool AddPartyMember(HeroComponent newMember) { bool added = heroQueue.AddHero(newMember); if (added) { newMember.myParty = this; newMember.myMovement.ReachedEndOfPathEvent += MemberReachedWaypoint; newMember.onEntityDeath += OnHeroDeath; waypointManager.AddNewEntity(newMember.gameObject); } return added; }
private void Init() { // DataEntities _heroComponent = FindObjectOfType <HeroComponent>(); var bagEntities = ResourcesExt.LoadDataEntities(NameBag); var dummyEntities = ResourcesExt.LoadDataEntities(NameDummy); // Inventories _dummy = new InventoryOpenCloseObject(_prefabDummyInventory, dummyEntities, NameDummy); _bag = new InventoryOpenCloseObject(_prefabBagInventory, bagEntities, NameBag); _inventoryDataBindHotBar = _containerDi.InventoryBindingFactory.Create(_inventoryComponentHotBar) .Bind(_inventoryComponentHotBar); // Listeners _buffDebafListener = new BuffDebuffListener(_heroComponent, _dummy); _hotBarListener = new HotBarListener(_inventoryDataBindHotBar, _bag); _changeAmountEntityInInventoryListener = new ChangeAmountEntityInInventoryListener(_bag); }
private void OnInitParam(HeroParam _param) { param = _param; if (string.IsNullOrEmpty(data.name)) { data.name = param.name; } if (data.height == 0) { data.height = param.height; } if (param.components != null) { for (int i = 0; i < param.components.Count; ++i) { HeroComponent component = ObjectPool.GetInstance <HeroComponent>(param.components[i].type); component.Init(this, param.components[i]); components.Add(component); } } //初始化技能 if (param.skills != null) { for (int i = 0; i < param.skills.Count; ++i) { var skill = ObjectPool.GetInstance <HeroSkill>(); skill.Init(this, param.skills[i]); skills.Add(param.skills[i].type, skill); } } //初始化动作状态机 machine = ObjectPool.GetInstance <HeroActionMachine>(); machine.Init(this); string assetBundleName = string.Format("assets/r/{0}.prefab", param.assetBundleName); string assetName = string.Format("assets/r/{0}.prefab", param.assetName); LoadAsset(assetBundleName, assetName); }
/// <summary> /// Adds the given Hero to the end of the HeroQueue. /// </summary> /// <param name="hero">The Hero to be added to this HeroQueue.</param> /// <returns>True if the Hero was added, false if otherwise.</returns> /// <remarks>A Hero must have a HeroComponent attached to its GameObject</remarks> public bool AddHero(HeroComponent hero) { bool added = false; if (!heroes.Contains(hero) && hero != null) { heroes.Add(hero); added = true; if (heroes.Count == 1 && onLeaderChanged != null) //We have a new leader by default, fire the event! { onLeaderChanged(heroes[0], null, null); Debug.Log("New party leader has been set!"); } else //A new follower, set its target to be the next Hero in line... onFollowerChanged(heroes[heroes.Count - 1], heroes[heroes.Count - 2]); } return added; }
public void RemoveHero(HeroComponent hero) { int removedIndex = -1; for (int i = 0; i < heroes.Count; i++) { if (heroes[i] == hero) { removedIndex = i; break; } } //Remove the Hero from the Queue, and be sure we point the person directly behind in the right direction. if (removedIndex < heroes.Count && removedIndex >= 0) { if (removedIndex == 0) //We will remove the leader so the next follower is now the leader! { if (heroes.Count > 1) //We haven't actually removed the old leader yet, so ensure that we have 2 units + in the queue. { HeroComponent firstFollower = heroes.Count > 2 ? heroes[2] : null; onLeaderChanged(heroes[1], hero, firstFollower); } } else //We just removed a follower { if (heroes.Count > removedIndex + 1) //This follower has a follower, so redirect it! { onFollowerChanged(heroes[removedIndex + 1], heroes[removedIndex - 1]); } } heroes.RemoveAt(removedIndex); } }
public abstract void Add(HeroComponent page);
/// <summary> /// Adds a new Hero to the given HeroParty. /// </summary> /// <param name="partyName">The name of the HeroParty to add a Hero to.</param> /// <param name="hero">The Hero to add to the HeroParty.</param> /// <returns>True if the Hero was added to the HeroParty, false if otherwise.</returns> public bool AddHeroToParty(string partyName, HeroComponent hero) { bool added = false; if (hero != null && heroParties.ContainsKey(partyName)) { heroParties[partyName].AddPartyMember(hero); NumHeroesAlive++; added = true; } return added; }
public FilterDummyStats([NotNull] IDataInventoryContainer dummy, [NotNull] HeroComponent heroComponent) { _dummy = dummy ?? throw new ArgumentNullException(nameof(dummy)); _heroComponent = heroComponent ?? throw new ArgumentNullException(nameof(heroComponent)); }
public abstract void Remove(HeroComponent page);
public BuffDebuffListener(HeroComponent heroComponent, IDataInventoryContainer dummy) { _heroComponent = heroComponent; _dummy = dummy; }
public Form1() { Model = new Model(); InitializeComponent(); Groups(); imageResource = new ImageResource(this.imageList1) { Resource = "UI/Icons/" }; imageResource.ImageSizeChange(Settings.Default.IconSize); largeImageResource = new ImageResource(this.imageList2) { Resource = "UI/Images/" }; largeImageResource.Load(largeImageResource.Resource); contextMenu = new ContextMenuComponent(metroContextMenu1) { GetStatistic = (x) => Model.Hero.Statistic(x) }; playerPick = new PlayerPickInfo(playerpickButton) { GetImage = imageResource.Bitmap, GetHeroId = (x) => Model.Hero.Select(x).Item[0].Id }; forecastResultComponent = new ForecastResultComponent(metroListView1, btn_forecast) { Compute = Model.ForecastService.Select(x => x).ToList(), GetHeroes = () => Model.Hero, GetPlayersPick = playerPick.GetPlayerPics, MatchupWith = Model.Statistic.MatchUp.With, MatchupAgainst = Model.Statistic.MatchUp.Against }; filterTab = new FilterTab(cont_Filter, btn_FilterVisibleChange); filterTab.Collapse(); statfilterTab = new FilterTab(splitContainer2, bunifuTileButton1); statfilterTab.Collapse(); heroFilter = new HeroFilter(groupCheckBox, subgroupCheckBox, franchiseCheckBox, metroTextBox9); heroStatFilter = new HeroFilter(groupStatCheckBox, subgroupStatCheckBox, franchiseStatCheckBox, metroTextBox1); heroPicker = new HeroPicker(listView1) { GetImageId = imageResource.Index, GetHeroes = () => Model.Hero }; heroSelector = new HeroSelector(listView2) { GetImageId = imageResource.Index, GetHeroes = () => Model.Hero, GetFranchiseFilter = heroFilter.GetFranchiseFilter, GetGroupFilter = heroFilter.GetGroupsFilter, GetSubGroupFilter = heroFilter.GetSubGroupFilter, GetTextFilter = heroFilter.GetTextFilter }; heroComponent = new HeroComponent(controls) { GetImage = imageResource.Bitmap, GetLargeImage = largeImageResource.Bitmap, GetHero = (x) => Model.Hero.Select(x).Item[0] }; renderSettings = new RenderSettings(metroComboBox1, metroTextBox15, metroCheckBox2, numericUpDown1) { GetRenderType = () => imageResource.RenderType.ToArray() }; renderSettings.Init(); styleManager = new StyleManager(controls, metroContextMenu1, metroStyleManager1, this); themeSelector = new ThemeSelector(metroComboBox2, metroComboBox3); statComponent = new StatComponent(zedGraphControl1) { Hero = x => Model.Hero.Item[x].Hero, HeroesAvgStatistic = () => Model.Statistic.HeroStatistic.All().Item1, HeroGameCount = x => Model.Hero.Select(x).Item[0].Statistic.count, Image = imageResource.Bitmap, Style = () => styleManager.Style, Filter = () => { return(Model.Hero. Select(heroStatFilter.GetGroupsFilter()). Select(heroStatFilter.GetSubGroupFilter()). Select(heroStatFilter.GetFranchiseFilter()). Select(heroStatFilter.GetTextFilter()).Select(X => X.Id).ToList()); } }; statComponent.Init(); statGraph = new StatGraph(metroComboBox4) { GetSupportHeroStatistic = () => statComponent.HeroStat }; statGraph.HeroesSelectionChanged += statComponent.ComputeHeroesStat; statGraph.Init(); heroSelector.SelectionChanged += contextMenu.SelectPlayer; heroPicker.SelectionChanged += heroComponent.Render; playerPick.PickChanged += contextMenu.ChangeElement; contextMenu.OnPlayerPicked += playerPick.SetPick; heroFilter.OnGroupChanged += heroSelector.Render; heroFilter.OnSubGroupChanged += heroSelector.Render; heroFilter.OnFranchiseChanged += heroSelector.Render; heroFilter.OnTextСhanged += heroSelector.Render; heroStatFilter.OnGroupChanged += statComponent.ComputeHeroesStat; heroStatFilter.OnSubGroupChanged += statComponent.ComputeHeroesStat; heroStatFilter.OnFranchiseChanged += statComponent.ComputeHeroesStat; heroStatFilter.OnTextСhanged += statComponent.ComputeHeroesStat; themeSelector.OnThemeChanged += styleManager.ChangeTheme; themeSelector.OnStyleChanged += styleManager.ChangeStyle; renderSettings.OnBackgroundChanged += styleManager.SetBackground; renderSettings.OnTransparentChanged += styleManager.TransparentChange; renderSettings.OnBackgroundChanged += heroPicker.ChangeBackGround; renderSettings.OnRenderModeChanged += heroPicker.RenderModeChange; renderSettings.OnImageSizeChanged += heroPicker.ItemSizeChange; renderSettings.OnBackgroundChanged += heroSelector.ChangeBackGround; renderSettings.OnRenderModeChanged += heroSelector.RenderModeChange; renderSettings.OnImageSizeChanged += heroSelector.ItemSizeChange; renderSettings.OnImageSizeChanged += imageResource.ImageSizeChange; LoadToolTip(); Render(); }
public void LeaderChanged(HeroComponent newLeader, HeroComponent oldLeader, HeroComponent firstFollower) { if (newLeader != null) { HeroComponent newLeaderComp = newLeader; HeroComponent oldLeaderComp = null; if (oldLeader != null) { //Demote the old leader to a follower who follows the new leader if it is still alive for some reason. oldLeaderComp = oldLeader.GetComponent<HeroComponent>(); if (oldLeaderComp.Alive) { oldLeaderComp.SendMessage("DemotedToFollower", newLeaderComp, SendMessageOptions.DontRequireReceiver); } } //Promote the new leader and set its waypoint accordingly. newLeaderComp.SendMessage("PromotedToLeader", oldLeaderComp, SendMessageOptions.DontRequireReceiver); } }
public void FollowerChanged(HeroComponent follower, HeroComponent toFollow) { //HeroMovement heroMove = follower.GetComponent<HeroMovement>(); //if (heroMove != null) // heroMove.ChangeHeroToFollow(toFollow.GetComponent<HeroComponent>()); }
/// <summary> /// Removes a Hero from the given HeroParty. /// </summary> /// <param name="partyName">The name of the HeroParty to remove a Hero from.</param> /// <param name="hero">The Hero to remove from the HeroParty.</param> /// <returns>True if the Hero was removed to the HeroParty, false if otherwise.</returns> public bool RemoveHeroFromParty(string partyName, HeroComponent hero) { bool removed = false; if (hero != null && heroParties.ContainsKey(partyName)) { heroParties[partyName].RemovePartyMember(hero); NumHeroesAlive--; removed = true; } return removed; }
public void RemovePartyMember(HeroComponent oldMember) { oldMember.myMovement.ReachedEndOfPathEvent -= MemberReachedWaypoint; heroQueue.RemoveHero(oldMember); }
public NoFilterValidReactStats(HeroComponent heroComponent) { _heroComponent = heroComponent; }