/// <summary> /// Initializes a new instance of the <see cref="T:UseAbilityCommand"/> class. /// </summary> /// <param name="abilityUser"> /// A GameObject's AbilityUser Component that will use the given Ability. /// </param> /// <param name="ability"> /// The Ability that the given AbilityUser Component will use. /// </param> /// <param name="mouseWorldPosition"> /// The position of the mouse in world space during the current frame. /// </param> public UseAbilityCommand(AbilityUser abilityUser, Ability ability, Vector3 mouseWorldPosition) { this.ability = ability; this.abilityUser = abilityUser; this.mouseWorldPosition = mouseWorldPosition; }
public override void Activate(Transform transform, AbilityUser abilityUser) { Transform = transform; AbilityUser = abilityUser; IsShooting = true; }
public override IEnumerable <Gizmo> CompGetGizmosExtra() { if (ToolsPawn.IsSlug(AbilityUser)) { if (!AbilityUser.IsSleepingOrOnFire()) { IEnumerator <Gizmo> gizmoEnum = base.CompGetGizmosExtra().GetEnumerator(); while (gizmoEnum.MoveNext()) { Gizmo current = gizmoEnum.Current; yield return(current); } IEnumerator <Gizmo> gizmoAbilities = ToolsAbilities.GetAbilityGizmos(AbilityData); while (gizmoAbilities.MoveNext()) { Gizmo current = gizmoAbilities.Current; yield return(current); } } IEnumerable <Gizmo> reportGizmo = ToolsAbilities.GetAbilityReportGizmo(AbilityData); if (!reportGizmo.EnumerableNullOrEmpty()) { yield return(ToolsAbilities.GetAbilityReportGizmo(AbilityData).First()); } } }
public override void Execute(GoapAgent agent) { if (monsterAnimationController == null) { monsterAnimationController = agent.GetComponent <MonsterAnimationController>(); } if (monsterBaseAbilities == null) { monsterBaseAbilities = agent.GetComponent <MonsterBaseAbilities>(); } if (abilityUser == null) { abilityUser = agent.GetComponent <AbilityUser>(); } if (!ActionPossible(agent)) { monsterAnimationController.attacking = false; Fail(agent); } else { monsterAnimationController.attacking = true; HitPlayer(agent); } }
private void ContinueAction(GoapAgent agent) { if (monsterAnimationController == null) { monsterAnimationController = agent.GetComponent <MonsterAnimationController>(); } if (monsterBaseAbilities == null) { monsterBaseAbilities = agent.GetComponent <MonsterBaseAbilities>(); } if (abilityUser == null) { abilityUser = agent.GetComponent <AbilityUser>(); } if (!ActionPossible(agent)) { monsterAnimationController.attacking = false; } else { monsterAnimationController.attacking = true; HitPlayer(agent); } timer += Time.deltaTime; agent.transform.rotation = Quaternion.Slerp(originalRotation, targetLookRotation, timer / turnTime); if (timer >= turnTime) { timer = 0f; started = false; ApplyEffects(agent); } }
public override void Deactivate(Transform transform, AbilityUser abilityUser) { if (Clone != null) { Destroy(Clone.gameObject); Clone = null; } }
public void TryRemoveMindFlayer() { CompMindFlayer checkIfMindFlayer = AbilityUser.TryGetComp <CompMindFlayer>(); if (checkIfMindFlayer != null) { Tools.Warn(AbilityUser.LabelShort + " removing MindFlayer ability", myDebug); RemovePawnAbility(MindFlayerDefOf.LTF_Slug_MindFlayer); } }
public override void Activate(Transform transform, AbilityUser abilityUser) { if (Clone == null && abilityUser.CanAffordAbility(Reflect.EnergyCostPerTick)) { abilityUser.AdjustEnergy(-Reflect.EnergyCostPerTick); Clone = Instantiate(Reflect, transform.position, transform.rotation); Clone.CasterTransform = transform; Clone.AbilityUser = abilityUser; } }
public void GenerateHiddenSemblance() { if (AbilityUser.relations.RelatedPawns.Any(p => p.relations.Children.Contains(AbilityUser) && p.story.traits.HasTrait(RWBYDefOf.Semblance_Weiss)) || AbilityUser.relations.Children.Any(c => c.story.traits.HasTrait(RWBYDefOf.Semblance_Weiss))) { hiddenSemblance = RWBYDefOf.Semblance_Weiss; return; } List <TraitDef> traitDefs = new List <TraitDef>(); foreach (SkillRecord skillRecord in AbilityUser.skills.skills) { if (skillRecord.passion == Passion.Minor) { traitDefs.AddRange(SemblanceUtility.GetSemblancesForPassion(skillRecord.def)); } else if (skillRecord.passion == Passion.Major) { traitDefs.AddRange(SemblanceUtility.GetSemblancesForPassion(skillRecord.def)); traitDefs.AddRange(SemblanceUtility.GetSemblancesForPassion(skillRecord.def)); } } traitDefs.RemoveAll(t => AbilityUser.WorkTagIsDisabled(t.requiredWorkTags)); if (traitDefs.Count == 0) { hiddenSemblance = SemblanceUtility.semblanceList.FindAll(s => !AbilityUser.WorkTagIsDisabled(s.requiredWorkTags)).RandomElement(); // should never be empty, as there are Semblances without required workTags } else { List <TraitDef> allPossibleTraits = traitDefs.Distinct().ToList(); Dictionary <TraitDef, int> keyValuePairs = new Dictionary <TraitDef, int>(); foreach (TraitDef traitDef in traitDefs) { if (keyValuePairs.ContainsKey(traitDef)) { keyValuePairs[traitDef]++; } else { keyValuePairs.Add(traitDef, 1); } } int highestCount = keyValuePairs.Values.ToList().OrderByDescending(i => i).First(); List <TraitDef> mostMatchingTraits = new List <TraitDef>(); foreach (KeyValuePair <TraitDef, int> keyValuePair in keyValuePairs) { if (keyValuePair.Value == highestCount) { mostMatchingTraits.Add(keyValuePair.Key); } } hiddenSemblance = mostMatchingTraits.RandomElement(); } }
public override void Run(GoapAgent agent) { if (abilityUser == null) { abilityUser = agent.GetComponent <AbilityUser>(); } if (monsterBaseAbilities == null) { monsterBaseAbilities = agent.GetComponent <MonsterBaseAbilities>(); } agent.state["meleeAttackAvailable"] = IsMeleeAttackAvailable(); agent.state["rangedAttackAvailable"] = IsRangedAttackAvailable(); }
public override void PostInitialize() { base.PostInitialize(); if (MindFondler == true) { Tools.Warn(AbilityUser.LabelShort + " adding MindFondler ability", myDebug); AddPawnAbility(MindFondlerDefOf.LTF_Slug_MindFondler); } else { CompMindFondler checkIfMindFondler = AbilityUser.TryGetComp <CompMindFondler>(); if (checkIfMindFondler != null) { Tools.Warn(AbilityUser.LabelShort + " removing MindFondler ability", myDebug); RemovePawnAbility(MindFondlerDefOf.LTF_Slug_MindFondler); } } }
public override void HandleAbilities(AbilityUser abilityUser) { if (Input.GetButtonDown(InputManager.Ability0)) { AbilityManagers[0].Activate(gameObject.transform, abilityUser); } else if (Input.GetButtonUp(InputManager.Ability0)) { AbilityManagers[0].Deactivate(gameObject.transform, abilityUser); } if (Input.GetButtonDown(InputManager.Ability1)) { AbilityManagers[1].Activate(gameObject.transform, abilityUser); } else if (Input.GetButtonUp(InputManager.Ability1)) { AbilityManagers[1].Deactivate(gameObject.transform, abilityUser); } }
public abstract void HandleAbilities(AbilityUser abilityUser);
private void Awake() { abilityUser = GetComponent <AbilityUser>(); mousePositionDetector = GetComponent <MousePositionDetector>(); }
public override void Deactivate(Transform transform, AbilityUser abilityUser) { IsShooting = false; }
public abstract void Deactivate(Transform transform, AbilityUser abilityUser);
private void Start() { AbilityUser = GetComponentInParent <AbilityUser>(); }
public override void HandleAbilities(AbilityUser abilityUser) { }