Esempio n. 1
0
        public bool CreateEffectForGate(GateDataMessage gate, bool enable = false)
        {
            var effectName = gate.ParticleId;
            var size       = gate.Size;

            var centerMatrix = MatrixD.CreateWorld(gate.Position, Vector3D.CalculatePerpendicularVector(gate.Forward), -gate.Forward);

            if (effectName.Contains("end"))
            {
                size        *= 0.4f;
                centerMatrix = MatrixD.CreateWorld(gate.Position, Vector3D.CalculatePerpendicularVector(gate.Forward), gate.Forward);
            }

            var initialMatrix = centerMatrix;

            initialMatrix.Translation += initialMatrix.Right * size;
            var wmPos            = initialMatrix.Translation;
            var rotatingParticle = new RotatingParticle(0, initialMatrix, centerMatrix, size, gate.ParticleId);

            _allEffects[gate.Id] = rotatingParticle;
            if (enable)
            {
                _enabledEffects[gate.Id] = rotatingParticle;
                return(true);
            }
            return(true);
        }
Esempio n. 2
0
 private void OnJumpSucceeded(GateDataMessage gate, IMyCubeGrid grid)
 {
     _gateVisuals.DisableEffectForGate(gate.Id);
     if (MyAPIGateway.Session.ControlledObject is IMyShipController && ((IMyShipController)MyAPIGateway.Session.ControlledObject).CubeGrid == grid)
     {
         _soundEmitter.PlaySound(AfterSound, true);
     }
 }
Esempio n. 3
0
        private void OnJumpPerform(GateDataMessage gate, IMyCubeGrid grid, Vector3D destination)
        {
            if (Vector3D.IsZero(destination))
            {
                return;
            }
            var matrix = grid.WorldMatrix;

            matrix.Translation = destination;
            grid.Teleport(matrix);
        }
Esempio n. 4
0
 private void OnJumpReady(GateDataMessage gate, IMyCubeGrid grid)
 {
     _soundEmitter.PlaySound(JumpSound, true);
 }
Esempio n. 5
0
 private void OnJumpStarted(GateDataMessage gate, IMyCubeGrid grid)
 {
     _gateVisuals.EnableEffectForGate(gate.Id);
     _soundEmitter.Entity = (MyEntity)grid;
     _soundEmitter.PlaySound(ChargeSound);
 }