Beispiel #1
0
        internal void SpinBarrel(bool spinDown = false)
        {
            var matrix = MuzzlePart.Entity.PositionComp.LocalMatrixRef * BarrelRotationPerShot[BarrelRate];

            MuzzlePart.Entity.PositionComp.SetLocalMatrix(ref matrix, null, true);

            if (PlayTurretAv && RotateEmitter != null && !RotateEmitter.IsPlaying)
            {
                RotateEmitter?.PlaySound(RotateSound, true, false, false, false, false, false);
            }

            if (_spinUpTick <= Comp.Session.Tick && spinDown)
            {
                _spinUpTick = Comp.Session.Tick + _ticksBeforeSpinUp;
                BarrelRate--;
            }

            if (BarrelRate < 0)
            {
                BarrelRate     = 0;
                BarrelSpinning = false;

                if (PlayTurretAv && RotateEmitter != null && RotateEmitter.IsPlaying)
                {
                    RotateEmitter.StopSound(true);
                }
            }
            else
            {
                BarrelSpinning = true;
            }
        }
Beispiel #2
0
        public void StopRotateSound()
        {
            if (RotateEmitter == null)
            {
                return;
            }

            RotateEmitter.StopSound(true);
        }
Beispiel #3
0
        internal bool SpinBarrel(bool spinDown = false)
        {
            var matrix = MuzzlePart.Entity.PositionComp.LocalMatrixRef * BarrelRotationPerShot[BarrelRate];

            MuzzlePart.Entity.PositionComp.SetLocalMatrix(ref matrix, null, true);

            if (Comp.BaseType == BlockType.Fixed)
            {
                var testSphere = Comp.MyCube.PositionComp.WorldVolume;
                if (Vector3D.DistanceSquared(System.Session.CameraPos, testSphere.Center) < 62500 && System.Session.Camera.IsInFrustum(ref testSphere))
                {
                    MuzzlePart.Entity.Render.AddRenderObjects();
                }
            }

            if (PlayTurretAv && RotateEmitter != null && !RotateEmitter.IsPlaying)
            {
                RotateEmitter?.PlaySound(RotateSound, true, false, false, false, false, false);
            }

            if (_spinUpTick <= Comp.Session.Tick && spinDown)
            {
                _spinUpTick = Comp.Session.Tick + _ticksBeforeSpinUp;
                BarrelRate--;
            }

            if (BarrelRate < 0)
            {
                BarrelRate     = 0;
                BarrelSpinning = false;

                if (PlayTurretAv && RotateEmitter != null && RotateEmitter.IsPlaying)
                {
                    RotateEmitter.StopSound(true);
                }
            }
            else
            {
                BarrelSpinning = true;
            }

            if (!spinDown)
            {
                if (BarrelRate < 9)
                {
                    if (_spinUpTick <= Comp.Session.Tick)
                    {
                        BarrelRate++;
                        _spinUpTick = Comp.Session.Tick + _ticksBeforeSpinUp;
                    }
                    return(false);
                }
            }

            return(true);
        }
Beispiel #4
0
        public void StopRotateSound()
        {
            if (RotateEmitter == null)
            {
                return;
            }

            if (RotateEmitter.Loop)
            {
                RotateEmitter.StopSound(true);
                RotateEmitter.PlaySound(RotateSound, stopPrevious: false, skipIntro: true, force2D: false, alwaysHearOnRealistic: false, skipToEnd: true);
            }
            else
            {
                RotateEmitter.StopSound(true);
            }
        }
Beispiel #5
0
 public void StopRotateSound()
 {
     RotateEmitter?.StopSound(true);
 }