Exemplo n.º 1
0
 internal void Close()
 {
     // Reset only vars that are not always set
     Hit = new Hit();
     if (AmmoSound)
     {
         TravelEmitter.StopSound(true);
         AmmoSound = false;
     }
     HitVelocity        = Vector3D.Zero;
     TracerBack         = Vector3D.Zero;
     TracerFront        = Vector3D.Zero;
     ClosestPointOnLine = Vector3D.Zero;
     Color             = Vector4.Zero;
     OnScreen          = Screen.None;
     Tracer            = TracerState.Off;
     Trail             = TrailState.Off;
     LifeTime          = 0;
     TracerSteps       = 0;
     TracerStep        = 0;
     DistanceToLine    = 0;
     TracerWidth       = 0;
     TrailWidth        = 0;
     TrailScaler       = 0;
     MaxTrajectory     = 0;
     ShotFade          = 0;
     ParentId          = ulong.MaxValue;
     Dirty             = false;
     AmmoSound         = false;
     HitSoundActive    = false;
     StartSoundActived = false;
     IsShrapnel        = false;
     HasTravelSound    = false;
     HitParticle       = ParticleState.None;
     Triggered         = false;
     Cloaked           = false;
     Active            = false;
     TrailActivated    = false;
     ShrinkInited      = false;
     Hitting           = false;
     Back            = false;
     LastStep        = false;
     DetonateFakeExp = false;
     TracerShrinks.Clear();
     GlowSteps.Clear();
     Offsets.Clear();
     //
     FiringWeapon  = null;
     PrimeEntity   = null;
     TriggerEntity = null;
     Ai            = null;
     AmmoDef       = null;
     System        = null;
 }
Exemplo n.º 2
0
        public void Relaunch(MovingObject pObjectToFollow, Single pMaxWidth, ColorEx pColor)
        {
            objectToFollow = pObjectToFollow;
            maxwidth       = pMaxWidth;
            color          = pColor;
            trailState     = TrailState.Growing;
            elementList.Clear();
            elementPositions.Clear();
            elementsToDestroy = Chain.MaxChainElements = 4;

            AddHead();
        }
Exemplo n.º 3
0
        public void ObjectToFollowDisappeared()
        {
            // stop creating.
            trailState        = TrailState.Stopping;
            elementsToDestroy = Math.Min(elementList.Count, Chain.MaxChainElements);
            finalPosition     = objectToFollow.OldPosition;

            if (elementList.Count != 0)
            {
                elementList[elementList.Count - 1].Color = color;
            }
        }
Exemplo n.º 4
0
        internal void Init(ProInfo info, double firstStepSize, double maxSpeed)
        {
            System     = info.System;
            AmmoDef    = info.AmmoDef;
            Ai         = info.Ai;
            IsShrapnel = info.IsShrapnel;
            if (ParentId != ulong.MaxValue)
            {
                Log.Line($"invalid avshot, parentId:{ParentId}");
            }
            ParentId        = info.Id;
            Model           = (info.AmmoDef.Const.PrimeModel || info.AmmoDef.Const.TriggerModel) ? Model = ModelState.Exists : Model = ModelState.None;
            PrimeEntity     = info.PrimeEntity;
            TriggerEntity   = info.TriggerEntity;
            Origin          = info.Origin;
            Offset          = AmmoDef.Const.OffsetEffect;
            MaxTracerLength = info.TracerLength;
            MuzzleId        = info.MuzzleId;
            WeaponId        = info.WeaponId;
            MaxSpeed        = maxSpeed;
            MaxStepSize     = MaxSpeed * MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS;
            ShootVelStep    = info.ShooterVel * MyEngineConstants.PHYSICS_STEP_SIZE_IN_SECONDS;
            info.Ai.WeaponBase.TryGetValue(info.Target.FiringCube, out FiringWeapon);
            MaxTrajectory = info.MaxTrajectory;
            ShotFade      = info.ShotFade;
            ShrinkInited  = false;
            HitEmitter.CanPlayLoopSounds = false;
            if (AmmoDef.Const.DrawLine)
            {
                Tracer = !AmmoDef.Const.IsBeamWeapon && firstStepSize < MaxTracerLength && !MyUtils.IsZero(firstStepSize - MaxTracerLength, 1E-01F) ? TracerState.Grow : TracerState.Full;
            }
            else
            {
                Tracer = TracerState.Off;
            }

            if (AmmoDef.Const.Trail)
            {
                MaxGlowLength  = MathHelperD.Clamp(AmmoDef.AmmoGraphics.Lines.Trail.DecayTime * MaxStepSize, 0.1f, MaxTrajectory);
                Trail          = AmmoDef.AmmoGraphics.Lines.Trail.Back ? TrailState.Back : Trail = TrailState.Front;
                GlowShrinkSize = !AmmoDef.AmmoGraphics.Lines.Trail.UseColorFade ? AmmoDef.Const.TrailWidth / AmmoDef.AmmoGraphics.Lines.Trail.DecayTime : 1f / AmmoDef.AmmoGraphics.Lines.Trail.DecayTime;
                Back           = Trail == TrailState.Back;
            }
            else
            {
                Trail = TrailState.Off;
            }
            TotalLength = MathHelperD.Clamp(MaxTracerLength + MaxGlowLength, 0.1f, MaxTrajectory);
        }
Exemplo n.º 5
0
 private void RemoveTail()
 {
     if (trailState == TrailState.Growing)
     {
         if (elementList.Count == Chain.MaxChainElements)                 // check if our state is advancing.
         {
             trailState = TrailState.Moving;
         }
     }
     else             // trail will exceed max length, record information of new tail.
     {
         elementList.RemoveAt(0);
         elementPositions.RemoveAt(0);
     }
 }
Exemplo n.º 6
0
 private void RemoveTail()
 {
     if (trailState == TrailState.Growing)
     {
         if (elementList.Count == Chain.MaxChainElements) // check if our state is advancing.
         {
             trailState = TrailState.Moving;
         }
     }
     else // trail will exceed max length, record information of new tail.
     {
         elementList.RemoveAt(0);
         elementPositions.RemoveAt(0);
     }
 }
Exemplo n.º 7
0
        public void Relaunch(MovingObject pObjectToFollow, Single pMaxWidth, ColorEx pColor)
        {
            objectToFollow = pObjectToFollow;
            maxwidth = pMaxWidth;
            color = pColor;
            trailState = TrailState.Growing;
            elementList.Clear();
            elementPositions.Clear();
            elementsToDestroy = Chain.MaxChainElements = 4;

            AddHead();
        }
Exemplo n.º 8
0
        public void ObjectToFollowDisappeared()
        {
            // stop creating.
            trailState = TrailState.Stopping;
            elementsToDestroy = Math.Min(elementList.Count, Chain.MaxChainElements);
            finalPosition = objectToFollow.OldPosition;

            if (elementList.Count != 0)
            {
                elementList[elementList.Count - 1].Color = color;
            }
        }