Ejemplo n.º 1
0
 public override void Check()
 {
     if (StartCast <= 0 && IsInPhase && AbilityOwner.IsVisible)
     {
         StartCast = Game.RawGameTime;
         StartPosition = AbilityOwner.NetworkPosition;
         EndCast = StartCast + CastPoint;
         Obstacle = Pathfinder.AddObstacle(StartPosition, GetRadius(), Obstacle);
     }
     else if (StartCast > 0 && Game.RawGameTime > EndCast)
     {
         End();
     }
 }
Ejemplo n.º 2
0
 public override void Check()
 {
     if (StartCast <= 0 && IsInPhase && AbilityOwner.IsVisible)
     {
         StartCast = Game.RawGameTime;
         EndCast = StartCast + CastPoint + AdditionalDelay;
     }
     else if (StartCast > 0 && Obstacle == null && CanBeStopped() && !AbilityOwner.IsTurning())
     {
         StartPosition = AbilityOwner.InFront(-GetRadius() * 0.9f);
         EndPosition = AbilityOwner.InFront(GetCastRange());
         Obstacle = Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), Obstacle);
     }
     else if (StartCast > 0 && Game.RawGameTime > EndCast)
     {
         End();
     }
 }
Ejemplo n.º 3
0
 // 朝向转旋转
 public static Common.Quaternion LookAt(Common.Vector3 dir)
 {
     return(Common.Quaternion.LookRotation(dir, Common.Vector3.up));
 }
Ejemplo n.º 4
0
        public float GetProjectileRadius(Vector3 position = new Vector3())
        {
            if (GetRadius().Equals(GetEndRadius()))
            {
                return GetRadius();
            }

            if (position.IsZero)
            {
                position = GetProjectilePosition();
            }

            return (GetEndRadius() - GetRadius()) * (StartPosition.Distance2D(position) / GetCastRange()) + GetRadius();
        }
Ejemplo n.º 5
0
        public override void Check()
        {
            if (StartCast <= 0 && IsInPhase && AbilityOwner.IsVisible)
            {
                StartCast = Game.RawGameTime;
                EndCast = StartCast + CastPoint + GetCastRange() / GetProjectileSpeed();
                StartPosition = AbilityOwner.NetworkPosition;
                EndPosition = AbilityOwner.InFront(GetCastRange());
                Obstacle = Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), Obstacle);
            }
            else if (ProjectileTarget != null && Obstacle == null && !FowCast)
            {
                FowCast = true;
                StartCast = Game.RawGameTime;
                EndCast = StartCast + GetCastRange() / GetProjectileSpeed();
                StartPosition = AbilityOwner.NetworkPosition;
                EndPosition = StartPosition.Extend(ProjectileTarget.Position, GetCastRange());
                Obstacle = Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), Obstacle);
            }
            else if (StartCast > 0 && Game.RawGameTime > EndCast)
            {
                End();
            }
            else if (Obstacle != null)
            {
                if (!ProjectileLaunched())
                {
                    EndPosition = AbilityOwner.InFront(GetCastRange());
                    Pathfinder.UpdateObstacle(Obstacle.Value, StartPosition, EndPosition);
                    AbilityDrawer.UpdateRectaglePosition(StartPosition, EndPosition, GetRadius());
                }
                else if (ProjectileTarget != null)
                {
                    var projectilePosition = GetProjectilePosition(FowCast);
                    if (projectilePosition == lastProjectilePosition)
                    {
                        End();
                        return;
                    }

                    lastProjectilePosition = projectilePosition;

                    AbilityDrawer.Dispose(AbilityDrawer.Type.Rectangle);
                    EndCast = Game.RawGameTime
                              + (ProjectileTarget.Distance2D(projectilePosition) - 20) / GetProjectileSpeed();

                    if (!obstacleToAOE)
                    {
                        Obstacle = Pathfinder.AddObstacle(ProjectileTarget.Position, stunRadius, Obstacle);
                        obstacleToAOE = true;
                    }
                    else
                    {
                        Pathfinder.UpdateObstacle(Obstacle.Value, ProjectileTarget.Position, stunRadius);
                    }
                }
            }
        }