Esempio n. 1
0
        public Parachute Create(ParachuteConfig config, ImmutableTransform spawnpoint, string name = "Parachute")
        {
            Profiler.BeginSample("CreateParachute");

            config.AirfoilDefinition = _airfoilDefinition;

            Profiler.BeginSample("CreateSimObject");
            var parachute = UnityParachuteFactory.Create(config, spawnpoint, name);

            Profiler.EndSample();

            Profiler.BeginSample("CreateSkinnedMesh");
            UnityParachuteMeshFactory.CreateSkinnedMesh(parachute, _parachuteMeshconfig, _parachuteMaterial);
            Profiler.EndSample();

            parachute.Inject(_windManager, _fixedClock, _fixedScheduler);

            Profiler.EndSample();

            return(parachute);
        }
Esempio n. 2
0
        public void AttachToPilot(Wingsuit pilot, Quaternion unfoldOrientation, GameSettingsProvider gameSettingsProvider)
        {
            _pilot = pilot;

            UnityParachuteFactory.SetKinematic(this);

            Root.position  = _pilot.Torso.position;
            Root.rotation  = _pilot.Torso.rotation;
            Root.rotation *= unfoldOrientation;

            // Layout canopy to initial pre-opened deployment state
            UnityParachuteFactory.LayoutCells(this);
            UnityParachuteFactory.Relax(this);

            for (int i = 0; i < Sections.Count; i++)
            {
                var section = Sections[i];
                if (section.FrontLine == null || section.RearLine == null)
                {
                    continue;
                }
                section.BrakeLine.Joint.connectedBody = pilot.Torso;
                section.FrontLine.Joint.connectedBody = pilot.Torso;
                section.RearLine.Joint.connectedBody  = pilot.Torso;
            }

            UnityParachuteFactory.SetPhysical(this);

            if (_lineRenderer == null)
            {
                _lineRenderer = gameObject.AddComponent <ParachuteLineRenderer>();
                _lineRenderer.Initialize(this, gameSettingsProvider);
            }

            _lineRenderer.enabled = true;
        }
Esempio n. 3
0
 private static float GetOrbitDistance(Parachute p, float zoomLevel)
 {
     return(UnityParachuteFactory.OrbitDistance(p) * zoomLevel);
 }
Esempio n. 4
0
 public void CalculateCanopyBounds()
 {
     _canopyBounds = UnityParachuteFactory.CanopyBounds(this);
 }