コード例 #1
0
ファイル: Tornado.cs プロジェクト: tyljeff9408/Ensage
        public override void Check()
        {
            if (StartCast > 0 && Obstacle != null && Game.RawGameTime > EndCast)
            {
                End();
            }
            else if (Obstacle == null && IsAbilityUnitValid() && abilityUnit.IsVisible)
            {
                var unitPosition = abilityUnit.Position;
                if (unitPosition == StartPosition)
                {
                    return;
                }

                EndPosition = StartPosition.Extend(abilityUnit.Position, GetCastRange());

                if (Math.Abs(EndPosition.Distance2D(StartPosition) - GetCastRange()) > 50)
                {
                    return;
                }

                Obstacle = Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), Obstacle);
            }
            else if (Obstacle != null)
            {
                Pathfinder.UpdateObstacle(Obstacle.Value, GetProjectilePosition(), GetRadius());
            }
        }
コード例 #2
0
ファイル: TimberChain.cs プロジェクト: senzdota/Ensage
        public override void Check()
        {
            if (StartCast <= 0 && IsInPhase && AbilityOwner.IsVisible)
            {
                StartCast = Game.RawGameTime;
                EndCast   = StartCast + CastPoint + GetCastRange() / GetProjectileSpeed();
            }
            else if (StartCast > 0 && Obstacle == null && CanBeStopped() && !AbilityOwner.IsTurning())
            {
                var tree = ChainTreePosition(AbilityOwner.InFront(GetCastRange()));

                if (tree == null)
                {
                    return;
                }

                StartPosition   = AbilityOwner.NetworkPosition;
                EndPosition     = tree.Position;
                AdditionalDelay = EndPosition.Distance2D(StartPosition) / GetProjectileSpeed();
                EndCast         = StartCast + CastPoint + AdditionalDelay * 2;
                Obstacle        = Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), GetEndRadius(), Obstacle);
            }
            else if (StartCast > 0 && Game.RawGameTime > EndCast)
            {
                End();
            }
            else if (Obstacle != null && !CanBeStopped())
            {
                Pathfinder.UpdateObstacle(Obstacle.Value, GetProjectilePosition(), GetRadius(), GetEndRadius());
            }
        }
コード例 #3
0
ファイル: SacredArrow.cs プロジェクト: Fluffy322/Ensage-1
        public override void Check()
        {
            var time  = Game.RawGameTime;
            var phase = IsInPhase && AbilityOwner.IsVisible;

            if (phase && StartCast + CastPoint <= time && time > EndCast)
            {
                StartCast = time;
                EndCast   = StartCast + CastPoint + GetCastRange() / GetProjectileSpeed();
            }
            else if ((phase && Obstacle == null && !AbilityOwner.IsTurning()) || (fowCast && Obstacle == null))
            {
                if (fowCast && (!IsValidArrow() || !arrow.IsVisible))
                {
                    return;
                }

                if (fowCast)
                {
                    EndPosition = StartPosition.Extend(arrow.Position.SetZ(AbilityOwner.Position.Z), GetCastRange());

                    if (EndPosition.Distance2D(StartPosition) < 10)
                    {
                        return;
                    }
                }
                else
                {
                    StartPosition = AbilityOwner.NetworkPosition;
                    EndPosition   = AbilityOwner.InFront(GetCastRange() + GetRadius() / 2);
                }

                Obstacle = Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), Obstacle);
            }
            else if ((StartCast > 0 && time > EndCast) || (fowCast && !IsValidArrow()))
            {
                End();
            }
            else if (Obstacle != null && !phase)
            {
                Pathfinder.UpdateObstacle(Obstacle.Value, GetProjectilePosition(fowCast), GetRadius());
            }
        }