void Start() { shipElements = GetComponent <GravityElements>(); encounters = GetComponent <Encounters>(); spriteRenderer = GetComponentInChildren <SpriteRenderer>(true); lineDrawer = GetComponentInChildren <LineDrawer>(); perigeeIcons = new List <GameObject>(); apogeeIcons = new List <GameObject>(); updateEncounters(); }
// Use this for initialization protected void Start() { //First time setup gravityElements = GetComponent <GravityElements>(); gravityElements.MassiveBody = findInfluencingCelestialBody(transform.position, gravityElements.velocity, null); gravityElements.TimeStep = GlobalElements.timeStep; gravityElements.Position = transform.position - gravityElements.MassiveBody.transform.position; sphereChangeImmunity = 0; calculateInitialOrbitalElements(gravityElements.Position, gravityElements.velocity); shipPatchedConics = GetComponent <ShipPatchedConics>(); }
// Use this for initialization void Start() { node = null; shipElements = GetComponent <GravityElements>(); ship = GetComponent <ShipGravityBehavior>(); lineDrawer = GetComponentInChildren <LineDrawer>(); patchedConics = GetComponent <ShipPatchedConics>(); currentMassiveBody = shipElements.massiveBody; hoverDistanceTolerance = 1f; hovering = false; lastTrueAnomaly = shipElements.TrueAnomaly; thrustVector = new Vector2(0, 0); }
// Use this for initialization void Start() { massiveBodyElements = GetComponent <MassiveBodyElements>(); switch (massiveBodyElements.massiveBodyType) { case MassiveBodyType.Black_Hole: massiveBodyElements.SphereOfInfluence = double.PositiveInfinity; break; default: gravityElements = GetComponent <GravityElements>(); massiveBodyElements.SphereOfInfluence = calculateSphereOfInfluence(gravityElements.SemiMajorAxis, massiveBodyElements.mass, gravityElements.MassiveBody.GetComponent <MassiveBodyElements>().mass); break; } }
private void copyGravityElementsComponent(GravityElements gravElements) { this.velocity = gravElements.velocity; this.massiveBody = gravElements.massiveBody; this.gravitationalType = gravElements.gravitationalType; this.altitude = gravElements.Altitude; this.speed = gravElements.Speed; this.velocityAngle = gravElements.VelocityAngle; this.orbitType = gravElements.OrbitType; this.mu = gravElements.Mu; this.position = gravElements.Position; this.apogee = gravElements.Apogee; this.perigee = gravElements.Perigee; this.center = gravElements.Center; this.altitudeOfPerigee = gravElements.AltitudeOfPerigee; this.angularMomentum = gravElements.AngularMomentum; this.semiMajorAxis = gravElements.SemiMajorAxis; this.semiLatusRectum = gravElements.SemiLatusRectum; this.eccentricity = gravElements.Eccentricity; this.eccentricityMagnitude = gravElements.EccentricityMagnitude; this.eccentricAnomaly = gravElements.EccentricAnomaly; this.trueAnomaly = gravElements.TrueAnomaly; this.meanAnomaly = gravElements.MeanAnomaly; this.anomalyAtEpoch = gravElements.AnomalyAtEpoch; this.mechanicalEnergy = gravElements.MechanicalEnergy; this.time = gravElements.Time; this.timeStep = gravElements.TimeStep; this.timeAtEpoch = gravElements.TimeAtEpoch; this.clockwise = gravElements.Clockwise; this.towardsPerigee = gravElements.TowardsPerigee; this.globalTransformationVector = gravElements.GlobalTransformationVector; this.globalRotationAngle = gravElements.GlobalRotationAngle; }
// Use this for initialization void Start() { gravElements = GetComponentInChildren <GravityElements>(); lineDrawer = Camera.main.GetComponent <LineDrawer>(); massiveElements = GetComponent <MassiveBodyElements>(); switch (gravElements.gravitationalType) { case GravitationalType.black_hole: patchedConicsColor = Color.black; break; case GravitationalType.star: patchedConicsColor = Color.yellow; break; case GravitationalType.planet: patchedConicsColor = Color.blue; break; } }
public GravityElementsClass(Vector2 velocity, Vector2 position, GravityElements gravElements) { copyGravityElementsComponent(gravElements); this.velocity = velocity; this.position = position; }