protected IEnumerator PlayParticleSystemOnTarget(AbilitySystem Owner, bool SetTargetToParent = false) { if (TargetProjectileSystem != null) { Vector3 WorldPos = Grid.CellToWorld((Vector3Int)Owner.CurrentTarget); ParticleSystem Instance = Instantiate(TargetProjectileSystem, WorldPos, Quaternion.identity); Instance.Play(); if (SetTargetToParent) { TickAgent TargetAgent = null; foreach (TickAgent Agent in Ticker.Instance.tickAgents) { if (Agent.IsAlive && Agent.GridPos == Owner.CurrentTarget) { TargetAgent = Agent; break; } } Instance.transform.SetParent(TargetAgent.transform); } while (Instance != null && Instance.isPlaying) { yield return(null); } if (Instance != null) { Destroy(Instance.gameObject); } } }
protected AbilitySystem GetEnemyInTile(AbilitySystem Owner, Vector2Int TargetPos) { if (TargetPos.x < 0 || TargetPos.x >= Grid.xWidth || TargetPos.y < 0 || TargetPos.y >= Grid.zWidth) { return(null); } TickAgent TargetAgent = null; foreach (TickAgent Agent in Ticker.Instance.tickAgents) { if (Agent.IsAlive && Agent.GridPos == TargetPos) { TargetAgent = Agent; break; } } if (TargetAgent == null || !TargetAgent.IsAlive) { return(null); } if (Owner.OwnerAgent.GetType() == TargetAgent.GetType()) { return(null); } return(TargetAgent.AbilitySystem); }
protected void RotateThowaradsTarget(AbilitySystem Owner) { Vector3 TargetPos = Grid.CellToWorld((Vector3Int)Owner.CurrentTarget); Vector3 OriginalPos = Owner.OwnerAgent.transform.position; Animator Animator = Owner.OwnerAgent.Animator; Animator.transform.localRotation = Quaternion.LookRotation((TargetPos - OriginalPos), Animator.transform.up); Animator.transform.localRotation = Quaternion.Euler(0, Animator.transform.localRotation.eulerAngles.y, 0); }
public void Commit(AbilitySystem Owner) { if (Cost != null) { Debug.Assert(Owner.TryApplyEffectToSelf(Cost)); } if (Cooldown != null) { Debug.Assert(Owner.TryApplyEffectToSelf(Cooldown)); } }
protected void ApplyEffectToTarget(AbilitySystem Owner, AbilitySystem Target) { int?PowerModifier = null; if (AbilityTag.Is(TypeTag.StrengthAbility)) { PowerModifier = Owner.GetAttributeValue(Attribute.Strength); } else if (AbilityTag.Is(TypeTag.DexterityAbility)) { PowerModifier = Owner.GetAttributeValue(Attribute.Dexterity); } else if (AbilityTag.Is(TypeTag.IntelligenceAbility)) { PowerModifier = Owner.GetAttributeValue(Attribute.Intelligence); } if (AppliedEffect != null) { GameplayEffect Instance = Instantiate(AppliedEffect); if (PowerModifier.HasValue) { if (Instance.InitialAttribute != null) { Instance.InitialValue += PowerModifier.Value / 2; } if (Instance.TickAttribute != null) { Instance.TickValue += PowerModifier.Value / 6; } } int?AddedDamage = Owner.GetAttributeValue(Attribute.AddedDamage); if (AddedDamage.HasValue && Owner != Target) { if (Instance.InitialAttribute != null && Instance.InitialAttribute.Is(Attribute.Health)) { Instance.InitialValue += AddedDamage.Value; } if (Instance.TickAttribute != null && Instance.TickAttribute.Is(Attribute.Health)) { Instance.TickValue += AddedDamage.Value / 3; } } Target.TryApplyEffectToSelf(Instance); } }
protected IEnumerator ApplyEffectVisualized(AbilitySystem Owner, AbilitySystem Target) { RotateThowaradsTarget(Owner); Owner.OwnerAgent.Animator.SetInteger("AbilityIndex", AbilityIndex); Owner.OwnerAgent.Animator.SetTrigger("Ability"); yield return(new WaitForSeconds(MomentOfExecution)); AudioSystem.Play(SoundEffect); yield return(PlayParticleSystemFromSelfToTarget(Owner)); Debug.Log("PlayParticleSystemFromSelfToTarget1"); if (Target != null) { ApplyEffectToTarget(Owner, Target); } }
protected IEnumerator PlayParticleSystemOnSelf(AbilitySystem Owner) { if (SelfProjectileSystem != null) { Vector3 WorldPos = Owner.OwnerAgent.transform.position; ParticleSystem Instance = Instantiate(SelfProjectileSystem, WorldPos, Quaternion.identity); Instance.Play(); while (Instance != null && Instance.isPlaying) { yield return(null); } if (Instance != null) { Destroy(Instance.gameObject); } } }
public bool CanActivate(AbilitySystem Owner, bool IgnoreTarget = false) { if (Owner.IsBlocked(BlockedByTags) || !Owner.HasRequired(RequiredTags)) { return(false); } if (!IgnoreTarget && !IsTargetValid(Owner)) { return(false); } if (Cost == null) { return(true); } return(Owner.CanApplyFullEffectToSelf(Cost)); }
protected IEnumerator PlayParticleSystemFromSelfToTarget(AbilitySystem Owner) { Debug.Log("PlayParticleSystemFromSelfToTarget2"); if (FromSelfToTargetParticleSystem != null) { Vector3 TargetWorldPos = Grid.CellToWorld((Vector3Int)Owner.CurrentTarget); Vector3 WorldPos = Owner.OwnerAgent.transform.position; ParticleSystem Instance = Instantiate(FromSelfToTargetParticleSystem, WorldPos, Quaternion.identity); Instance.transform.forward = TargetWorldPos - WorldPos; Instance.Play(); Debug.Log("PlayParticleSystemFromSelfToTarget3"); while (Instance != null && Instance.isPlaying) { yield return(null); } if (Instance != null) { Destroy(Instance.gameObject); } } }
protected bool IsTileOccupiedByEnemy(AbilitySystem Owner, Vector2Int TargetPos) { return(GetEnemyInTile(Owner, TargetPos) != null); }
public abstract bool IsTargetValid(AbilitySystem Owner);
public abstract void Activate(AbilitySystem Owner);
public static void Init(AbilitySystem Owner) { //Owner.RegisterAttribute(Attribute.Health, 100); //Owner.RegisterAttribute(Attribute.Mana, 50); }