/// <summary> /// 计算英雄属性(不包含装备) /// </summary> public static Dictionary <RoleAttributeType, RoleAttribute> CalcPlayerAttributesDic(PlayerInfo playerInfo) { if (playerInfo == null) { return(null); } return(HeroUtil.CalcHeroAttributesDic(playerInfo.heroData, playerInfo.level, playerInfo.advanceLevel, playerInfo.strengthenLevel)); }
void FixedUpdate() { if (_changeHeroButtonPressed) { HeroUtil.ChangeHero(); _changeHeroButtonPressed = false; SoundManager.Instance.SendMessage("PlaySFXSwap"); } }
static void ApplyInternalPrefix( Hero victim, Hero killer, KillCharacterAction.KillCharacterActionDetail actionDetail, bool showNotification) { _ = showNotification; if (victim is null || victim == Hero.MainHero) { return; } var clan = victim.Clan; // Only interested in the death of regular clan leaders where there's no other adult noble to succeed them: if (clan is null || clan.Leader != victim || clan.Kingdom is null || clan.Kingdom.IsEliminated || clan.IsClanTypeMercenary || // Start extreme paranoia: clan.IsRebelFaction || clan.IsBanditFaction || // End extreme paranoia! clan.Lords.Where(h => h.IsAlive && !h.IsChild && h.IsActive && h.IsNoble && h != victim).Any()) { return; } if (Config.AllowPlayerExecutionToEliminateClan && killer == Hero.MainHero && actionDetail == KillCharacterAction.KillCharacterActionDetail.Executed) { return; } var deathReasonStr = Enum.GetName(typeof(KillCharacterAction.KillCharacterActionDetail), actionDetail); Util.Log.Print($"[{CampaignTime.Now}] CLAN EXTINCTION PREVENTION: Leader of clan {clan.Name}, " + $"{victim.Name} of age {victim.Age:F0}, died without a valid heir (reason: {deathReasonStr})!"); // Spawn a male noble "distant relative" into the clan var ageMin = Campaign.Current.Models.AgeModel.HeroComesOfAge + 1; var successor = HeroUtil.SpawnNoble(clan, ageMin, ageMax: ageMin + 10, isFemale: MBRandom.RandomFloat < 0.5); if (successor is null) { Util.Log.Print(" -> ERROR: Could not find a noble character template to spawn lord!"); } else { Util.Log.Print($" -> Summoned distant relative {successor.Name} of age {successor.Age:F0} " + $"to assume leadership of clan {successor.Clan.Name}."); } }
void FixedUpdate() { heroStrongControl.ProcessHeroInput(GameInput); heroFastControl.ProcessHeroInput(GameInput); DeactivateTriggerButtons(); if (GameInput.changeHero) { HeroUtil.ChangeHero(); GameInput.changeHero = false; } }
/// <summary> /// 计算英雄属性(不包含装备) /// </summary> public static Dictionary <RoleAttributeType, RoleAttribute> CalcRoleAttributesDic(RoleInfo roleInfo) { PlayerInfo player = roleInfo as PlayerInfo; HeroInfo hero = roleInfo as HeroInfo; if (player != null) { return(PlayerUtil.CalcPlayerAttributesDic(player)); } if (hero != null) { return(HeroUtil.CalcHeroAttributesDic(hero)); } return(null); }
public static List <RoleAttribute> CalcRoleMainAttributesList(RoleInfo roleInfo) { PlayerInfo player = roleInfo as PlayerInfo; HeroInfo hero = roleInfo as HeroInfo; if (player != null) { return(PlayerUtil.CalcPlayerMainAttributesList(player)); } if (hero != null) { return(HeroUtil.CalcHeroMainAttributesList(hero)); } return(null); }
void FixedUpdate() { if (IsActive) { updateSphereColor(); if (puzzleSolved) { ColorPanel.GetComponent <Renderer>().enabled = false; HeroUtil.ChangeHero(); colorsPuzzleActivator.activate(); } if (puzzleFail) { restartPuzzle(); puzzleController.setCurrentBox(puzzleController.SelectionBox1); puzzleFail = false; } } }
private void RefreshAttribute() { HeroInfo heroInfo = HeroAdvanceProxy.instance.advanceHeroInfo; TransformUtil.ClearChildren(attributeRoot, true); List <RoleAttribute> attributeList = HeroUtil.CalcHeroMainAttributesList(heroInfo); int count = attributeList.Count; if (!heroInfo.IsMaxAdvanceLevel) { //next HeroInfo nextInfo = new HeroInfo(heroInfo.instanceID, heroInfo.heroData.id, heroInfo.breakthroughLevel, heroInfo.strengthenLevel, heroInfo.advanceLevel + 1, heroInfo.level); List <RoleAttribute> nextAttributeList = HeroUtil.CalcHeroMainAttributesList(nextInfo); attributePrefab.SetActive(true); for (int i = 0; i < count; i++) { GameObject go = Instantiate <GameObject>(attributePrefab); go.transform.SetParent(attributeRoot, false); RoleAttributeView view = go.GetComponent <RoleAttributeView>(); int add = (int)(nextAttributeList[i].value - attributeList[i].value); view.Set(attributeList[i], add, false); } attributePrefab.SetActive(false); } else { attributePrefab.SetActive(true); for (int i = 0; i < count; i++) { GameObject go = Instantiate <GameObject>(attributePrefab); go.transform.SetParent(attributeRoot, false); RoleAttributeView roleAttributeView = go.GetComponent <RoleAttributeView>(); roleAttributeView.Set(attributeList[i], Localization.Get("ui.hero_advance_view.role_attribute_max_remark")); } attributePrefab.SetActive(false); } }
private void UpdateHeroAttribute() { heroAttributes = HeroUtil.CalcHeroAttributes(this); }
public override void Deactivate() { HeroUtil.ResetControllableObject(this); }
public override void Activate() { HeroUtil.SetControllableObject(this); }
void initializeAll(GameObject character) { HeroUtil.SetHeroMarkerEnablement(true, character, Statics.CHAR_MARKER_BLUE); //TODO i'm sure i have to initialize some more things }
public void OnHeroActivate() { HeroUtil.ChangeToControllable(); }