public void OnCastTimeChanged(IAbilityCaster abilityCaster, BaseAbility ability, float currentPercent) { //Debug.Log(gameObject.name + ".CastBarController.OnCastTimeChanged(" + currentTime + ") : total casting time: " + ability.MyAbilityCastingTime); if (currentPercent <= 1f) { // first set text because bar width is based on text size castText.text = ability.DisplayName + " ( " + (currentPercent * ability.GetAbilityCastingTime(abilityCaster)).ToString("F1") + "s / " + ability.GetAbilityCastingTime(abilityCaster).ToString("F1") + "s )"; // then get width of container that expands to the text originalCastSliderWidth = castBackground.GetComponent <RectTransform>().rect.width; //Debug.Log(gameObject.name + ".CastBarController.OnCastTimeChanged(): cast slider width: " + originalCastSliderWidth); this.gameObject.SetActive(true); //float castPercent = (float)currentPercent / ability.GetAbilityCastingTime(abilityCaster); // code for an actual image, not currently used //playerCastSlider.fillAmount = castPercent; // code for the default image castSlider.GetComponent <LayoutElement>().preferredWidth = currentPercent * originalCastSliderWidth; if (castIcon.sprite != ability.Icon) { castIcon.sprite = null; castIcon.sprite = ability.Icon; } } }
public void AddAbility(IAbility ability) { this.ability = ability as BaseAbility; icon.sprite = this.ability.MyIcon; icon.color = Color.white; spellName.text = ability.MyName; description.text = ability.GetSummary(); }
public void AbilityLearnedHandler(BaseAbility newAbility) { //Debug.Log("PlayerAbilityManager.AbilityLearnedHandler()"); if (MessageFeedManager.MyInstance != null) { MessageFeedManager.MyInstance.WriteMessage(string.Format("Learned New Ability: {0}", newAbility.MyName)); } }
public override void UnlearnAbility(BaseAbility oldAbility, bool updateActionBars = true) { base.UnlearnAbility(oldAbility); if (updateActionBars) { // attemp to remove from bars UIManager.MyInstance.MyActionBarManager.UpdateVisuals(true); } }
public override void ActivateTargettingMode(BaseAbility baseAbility, GameObject target) { //Debug.Log("CharacterAbilityManager.ActivateTargettingMode()"); base.ActivateTargettingMode(baseAbility, target); targettingModeActive = true; CastTargettingManager.MyInstance.EnableProjector(baseAbility); }
public void AddAbility(BaseAbility ability) { this.ability = ability; icon.sprite = this.ability.Icon; icon.color = Color.white; spellName.text = ability.DisplayName; description.text = ability.GetSummary(); description.text = ability.GetShortDescription(); }
public void SetupScriptableObjects() { prerequisiteAbility = null; if (prerequisiteName != null && prerequisiteName != string.Empty) { prerequisiteAbility = SystemAbilityManager.MyInstance.GetResource(prerequisiteName); } else { Debug.LogError("SystemAbilityManager.SetupScriptableObjects(): Could not find ability : " + prerequisiteName + " while inititalizing a prerequisite. CHECK INSPECTOR"); } }
public void HandleAbilityListChanged(BaseAbility newAbility) { if (newAbility == prerequisiteAbility) { prerequisiteMet = true; OnStatusUpdated(); } else { //prerequisiteMet = false; } }
public override bool IsTargetInAbilityRange(BaseAbility baseAbility, GameObject target, AbilityEffectContext abilityEffectContext = null) { bool returnResult = base.IsTargetInAbilityRange(baseAbility, target, abilityEffectContext); if (!returnResult && abilityEffectContext != null && abilityEffectContext.baseAbility != null) { if (CombatLogUI.MyInstance != null) { CombatLogUI.MyInstance.WriteCombatMessage(target.name + " is out of range of " + (baseAbility.DisplayName == null ? "null" : baseAbility.DisplayName)); } } return(returnResult); }
public override bool LearnAbility(BaseAbility newAbility) { //Debug.Log(gameObject.name + "PlayerAbilityManager.LearnAbility()"); bool returnValue = base.LearnAbility(newAbility); if (returnValue) { //Debug.Log(gameObject.name + "PlayerAbilityManager.LearnAbility() returnvalue is true"); SystemEventManager.MyInstance.NotifyOnAbilityListChanged(newAbility); } else { //Debug.Log(gameObject.name + "PlayerAbilityManager.LearnAbility() returnvalue was false"); } return(returnValue); }
/* * public override string GetSummary() { * string abilityName = "Ability Not Set In Inspector!"; * if (ability != null) { * abilityName = ability.MyName; * } * return string.Format("{0}\n<color=green>Use: Cast {1}</color>", base.GetSummary(), abilityName); * } */ public override void SetupScriptableObjects() { base.SetupScriptableObjects(); ability = null; if (abilityName != null) { BaseAbility baseAbility = SystemAbilityManager.MyInstance.GetResource(abilityName); if (baseAbility != null) { ability = baseAbility; } else { Debug.LogError("SystemSkillManager.SetupScriptableObjects(): Could not find ability : " + abilityName + " while inititalizing " + MyName + ". CHECK INSPECTOR"); } } }
public void SetupScriptableObjects(SystemGameManager systemGameManager) { Configure(systemGameManager); prerequisiteAbility = null; if (prerequisiteName != null && prerequisiteName != string.Empty) { prerequisiteAbility = systemDataFactory.GetResource <BaseAbility>(prerequisiteName); if (prerequisiteAbility != null) { prerequisiteAbility.OnAbilityLearn += HandleAbilityListChanged; } } else { Debug.LogError("SystemAbilityManager.SetupScriptableObjects(): Could not find ability : " + prerequisiteName + " while inititalizing a prerequisite. CHECK INSPECTOR"); } }
public override void SetupScriptableObjects(SystemGameManager systemGameManager) { base.SetupScriptableObjects(systemGameManager); ability = null; if (abilityName != null) { BaseAbility baseAbility = systemDataFactory.GetResource <BaseAbility>(abilityName); if (baseAbility != null) { ability = baseAbility; } else { Debug.LogError("CastableItem.SetupScriptableObjects(): Could not find ability : " + abilityName + " while inititalizing " + DisplayName + ". CHECK INSPECTOR"); } } }
// for casting public void UpdateCastCount(BaseAbility baseAbility) { bool completeBefore = IsComplete; if (baseAbility == this.baseAbility) { MyCurrentAmount++; quest.CheckCompletion(); if (MyCurrentAmount <= MyAmount && !quest.MyIsAchievement) { MessageFeedManager.MyInstance.WriteMessage(string.Format("{0}: {1}/{2}", baseAbility.MyName, MyCurrentAmount, MyAmount)); } if (completeBefore == false && IsComplete && !quest.MyIsAchievement) { MessageFeedManager.MyInstance.WriteMessage(string.Format("Learn {0} {1}: Objective Complete", MyCurrentAmount, baseAbility.MyName)); } } }
// for learning public void UpdateCompletionCount(BaseAbility baseAbility) { if (!SystemResourceManager.MatchResource(baseAbility.MyName, MyType)) { // some other ability than this one was used. no need to check. return; } bool completeBefore = IsComplete; if (completeBefore) { return; } MyCurrentAmount++; quest.CheckCompletion(); if (MyCurrentAmount <= MyAmount && !quest.MyIsAchievement && MyCurrentAmount != 0) { MessageFeedManager.MyInstance.WriteMessage(string.Format("{0}: {1}/{2}", MyType, Mathf.Clamp(MyCurrentAmount, 0, MyAmount), MyAmount)); } if (completeBefore == false && IsComplete && !quest.MyIsAchievement) { MessageFeedManager.MyInstance.WriteMessage(string.Format("Learn {0} {1}: Objective Complete", MyCurrentAmount, MyType)); } }
public virtual void BeginAbilityCoolDown(BaseAbility baseAbility, float coolDownLength = -1f) { // do nothing }
public override void BeginAbilityCoolDown(BaseAbility baseAbility, float coolDownLength = -1) { //Debug.Log("PlayerAbilityManager.BeginAbilityCoolDown(" + baseAbility.MyName + ", " + coolDownLength + ")"); base.BeginAbilityCoolDown(baseAbility, coolDownLength); }
public virtual void PerformCastingAnimation(AnimationClip animationClip, BaseAbility baseAbility) { // do nothing. environmental effects have no animations for now }
public void NotifyOnAbilityListChanged(BaseAbility newAbility) { //Debug.Log("SystemEventManager.NotifyOnAbilityListChanged(" + abilityName + ")"); OnAbilityListChanged(newAbility); //OnPrerequisiteUpdated(); }
public override void ActivateTargettingMode(BaseAbility baseAbility, GameObject target) { base.ActivateTargettingMode(baseAbility, target); groundTarget = target.transform.position; }
public virtual bool PerformWeaponAffinityCheck(BaseAbility baseAbility) { return(true); }
public virtual bool IsTargetInAbilityRange(BaseAbility baseAbility, GameObject target, AbilityEffectContext abilityEffectContext = null) { // environmental effects only target things inside their collider, so everything is always in range return(true); }
public void NotifyOnAbilityUsed(BaseAbility ability) { //Debug.Log("SystemEventManager.NotifyAbilityused(" + ability.MyName + ")"); OnAbilityUsed(ability); }
public virtual void EndCastCleanup() { currentCastCoroutine = null; currentCastAbility = null; }