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); }
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); } }
private void OnJumpPerform(GateDataMessage gate, IMyCubeGrid grid, Vector3D destination) { if (Vector3D.IsZero(destination)) { return; } var matrix = grid.WorldMatrix; matrix.Translation = destination; grid.Teleport(matrix); }
private void OnJumpReady(GateDataMessage gate, IMyCubeGrid grid) { _soundEmitter.PlaySound(JumpSound, true); }
private void OnJumpStarted(GateDataMessage gate, IMyCubeGrid grid) { _gateVisuals.EnableEffectForGate(gate.Id); _soundEmitter.Entity = (MyEntity)grid; _soundEmitter.PlaySound(ChargeSound); }