Example #1
0
            protected virtual Vector3 DetermineCastDirection(AbilityData ability, AbilityTriggerData triggerData)
            {
                Vector3 dir;

                switch (ability.Methods.DirectionMethod)
                {
                case DirectionMethod.AimBased:
                    if (HasController == false)
                    {
                        dir = PinouApp.Entity.Mode2D ? Forward2D.ToV3() : Forward;
                    }
                    else
                    {
                        dir = Controller.AimDirection;
                    }
                    break;

                case DirectionMethod.CharacterForward:
                    dir = PinouApp.Entity.Mode2D ? Forward2D.ToV3() : Forward;
                    break;

                default:
                    throw new System.Exception("Direction Method " + ability.Methods.DirectionMethod + " not found.");
                }

                float spreadAngle = (1f - triggerData.Precision) * Mathf.PI;

                if (PinouApp.Entity.Mode2D)
                {
                    dir = dir.SetZ(0f).normalized;
                    float curAngle = dir.y > 0 ? Mathf.Acos(dir.x) : -Mathf.Acos(dir.x);
                    curAngle += Random.Range(-spreadAngle, spreadAngle);

                    return(new Vector3(Mathf.Cos(curAngle), Mathf.Sin(curAngle)));
                }
                else
                {
                    throw new System.Exception("To Implement: Spherical Direction Projection");
                }
            }
Example #2
0
 protected virtual void StartVelocityOverrideFromAbilityCast(AbilityCastData castData)
 {
     voAgent = castData.AbilityCast.VelocityOverrideChain.StartChain(references.RigidBody, Is2D ? Forward2D.ToV3() : Forward);
     voAgent.OnAgentStop.Subscribe(OnVelocityOverrideStops);
 }
Example #3
0
            private void PerformDash()
            {
                Vector3 forward = Controller.InputingMovement ? Controller.MoveVector.normalized : (PinouApp.Entity.Mode2D == false ? Forward : Forward2D.ToV3());

                voAgent = _data._dashVelocityOverride.StartVelictyOverride(references.RigidBody, forward);
                if (HasStats == true)
                {
                    voAgent.SetStatsSpeedFactor(Stats.EvaluateMovementsStat(EntityMovementsStat.Acceleration, 1f));
                }
                voAgent.OnAgentStop.Subscribe(OnVelocityOverrideStops);

                _lastDashTime = Time.time - LastDashClampedDuration + DashCooldown;
                OnDash.Invoke(master, forward);
            }