示例#1
0
            protected virtual void OnReceiveAbilityHit(Entity ent, AbilityCastResult result)
            {
                Vector3 knockback = DetermineAbilityHitKnockback(result);

                references.RigidBody.velocity += knockback;
                result.FillKnockbackApplied(knockback);
            }
 private void OnEntityDeath(Entity ent, AbilityCastResult killingResult)
 {
     if (_entityChunks.ContainsKey(ent))
     {
         _entityChunks.Remove(ent);
     }
 }
 protected virtual void HandleDeath()
 {
     if (deathResult != null)
     {
         OnDeath.Invoke(master, deathResult);
         deathResult = null;
     }
 }
        public static void HandleAbilityCastResultFX(AbilityCastResult result, AbilityVisualData.AbilityVisualFX fx)
        {
            GameObject fxGo = PinouApp.Pooler.Retrieve(fx.Model, PinouApp.Scene.ActiveSceneInfos.FXsHolder);

            HandleAbilityPlacingMethod(fxGo, result, fx);
            HandleAbilityDirectionMethod(fxGo, result, fx);
            HandleAbilityDestroyMethod(fxGo, result.CastData, fx);
            fx.FXVisualParameters.Apply(fxGo);
        }
 private void OnReceiveAbilityHit(Entity master, AbilityCastResult castResult)
 {
     if (HasTarget == false)
     {
         if (IsEntityAuthorizedTarget(castResult.CastData.Caster))
         {
             target = castResult.CastData.Caster;
         }
     }
 }
        public static void ApplyAbilityPerformedOnHitEntity(AbilityCastData castData, Entity entity, AbilityCastResult existingResult = null)
        {
            AbilityCastResult result = existingResult == null ? new AbilityCastResult(castData) : existingResult;

            result.FillVictim(entity);
            if (result.ImpactFilled == false)
            {
                result.FillImpact(ComputePerformedAbilityImpact(castData, entity));
            }

            entity.ReceiveAbilityHit(result);
        }
            protected void TakeAbilityHit(AbilityCastResult result)
            {
                float oldHealth = currentHealth;

                ModifyHealth(result.CastData.GetResourceImpact(EntityBeingResourceType.Health));

                result.FillResourceChange(EntityBeingResourceType.Health, currentHealth - oldHealth);

                if (BeingState == BeingState.Dead)
                {
                    Death(result);
                }
            }
 public static void HandleAbilityCastResultVisual(AbilityCastResult result)
 {
     if (result.CastData.AbilityCast.Visual.HasFX == false)
     {
         return;
     }
     for (int i = 0; i < result.CastData.AbilityCast.Visual.FXs.Length; i++)
     {
         if (result.CastData.AbilityCast.Visual.FXs[i].TimingMethod == AbilityVisualData.AbilityVisualFXTimingMethod.Result)
         {
             HandleAbilityCastResultFX(result, result.CastData.AbilityCast.Visual.FXs[i]);
         }
     }
 }
        private static void HandleAbilityDirectionMethod(GameObject fxGo, AbilityCastResult result, AbilityVisualData.AbilityVisualFX resultFx)
        {
            if (resultFx.PlacingMethod != AbilityVisualData.AbilityVisualFXPlacingMethod.Script)
            {
                switch (resultFx.DirectionMethod)
                {
                case AbilityVisualData.AbilityResultDirectionMethod.CastDirection:
                    HandleAbilityDirectionMethod(fxGo, result.CastData, resultFx);
                    break;

                case AbilityVisualData.AbilityResultDirectionMethod.KnockbackDirection:
                    fxGo.transform.rotation = Quaternion.LookRotation(result.KnockbackApplied.normalized);
                    break;
                }
            }
        }
示例#10
0
        private void ApplyHitOnEntity(Entity ent, AbilityPerformer.AdditionalHitInfos infos)
        {
            AbilityCastResult result = null;

            if (infos != null)
            {
                result = new AbilityCastResult(_castData);
                Vector3 impact = infos.Hit.point;
                if (impact.sqrMagnitude <= Mathf.Epsilon)
                {
                    impact = infos.RayOrigin;
                }
                result.FillImpact(impact);
            }
            AbilityPerformer.ApplyAbilityPerformedOnHitEntity(_castData, ent, result);
            HandleCheckHitboxLife();
        }
        private static void HandleAbilityPlacingMethod(GameObject fxGo, AbilityCastResult result, AbilityVisualData.AbilityVisualFX resultFx)
        {
            switch (resultFx.PlacingMethod)
            {
            case AbilityVisualData.AbilityVisualFXPlacingMethod.Caster:
                HandleAbilityPlacingMethod(fxGo, result.CastData, resultFx);
                break;

            case AbilityVisualData.AbilityVisualFXPlacingMethod.Impact:
                fxGo.transform.position = result.Impact;
                break;

            case AbilityVisualData.AbilityVisualFXPlacingMethod.Victim:
                fxGo.transform.position = result.Victim.Position;
                break;

            case AbilityVisualData.AbilityVisualFXPlacingMethod.Script:
                fxGo.GetComponent <FX_Base>().StartFX(result);
                break;
            }
        }
示例#12
0
            protected Vector3 DetermineAbilityHitKnockback(AbilityCastResult result)
            {
                switch (result.CastData.AbilityCast.Methods.KnockbackMethod)
                {
                case KnockbackMethod.AttackBased:
                    return(PinouUtils.Transform.TransformVector(result.CastData.BaseKnockback, Quaternion.LookRotation(result.CastData.CastDirection)) * KnockbackTakenFactor);

                case KnockbackMethod.AttackEntityAverage:
                    return
                        ((PinouUtils.Transform.TransformVector(result.CastData.BaseKnockback, Quaternion.LookRotation(result.CastData.CastDirection)) +
                          references.VisualBody.TransformVector(result.CastData.BaseKnockback)) * 0.5f * KnockbackTakenFactor);

                case KnockbackMethod.VictimEntityBased:
                    return(references.VisualBody.TransformVector(result.CastData.BaseKnockback) * KnockbackTakenFactor);

                case KnockbackMethod.AttackImpactToEntity:
                    return(PinouUtils.Transform.TransformVector(result.CastData.BaseKnockback, PinouUtils.Quaternion.SafeLookRotation(Position - result.Impact, result.CastData.CastDirection)) * KnockbackTakenFactor);

                case KnockbackMethod.CasterToVictim:
                    return(PinouUtils.Transform.TransformVector(result.CastData.BaseKnockback, Quaternion.LookRotation(result.Victim.Position - result.CastData.Caster.Position)) * KnockbackTakenFactor);
                }

                throw new System.Exception("KnockbackMethod enum updated, this should be too.");
            }
示例#13
0
 public void FillResult(AbilityCastResult result)
 {
     _results.Add(result);
     OnResultEmitted.Invoke(this, result);
 }
示例#14
0
 private void OnDeath(Entity ent, AbilityCastResult killingResult)
 {
     AbilityPerformer.HandleAbilityCastResultFX(killingResult, Data._deathFX);
 }
示例#15
0
 private void OnAbilityHitResult(Entity ent, AbilityCastResult result)
 {
     AbilityPerformer.HandleAbilityCastResultVisual(result);
 }
示例#16
0
 protected void Death(AbilityCastResult killingResult)
 {
     deathResult = killingResult;
 }
示例#17
0
 private void OnCastDataEmitResult(AbilityCastData castData, AbilityCastResult result)
 {
     OnAbilityHitResultEmitted.Invoke(master, result);
 }
示例#18
0
 private void OnReceiveAbilityHit(Entity master, AbilityCastResult result)
 {
     TakeAbilityHit(result);
 }