Example #1
0
        public void DetachPilot()
        {
            if (_pilot != null)
            {
                _pilot = null;

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

                    section.BrakeLine.Joint.connectedBody = null;
                    section.FrontLine.Joint.connectedBody = null;
                    section.RearLine.Joint.connectedBody  = null;
                }

                _lineRenderer.enabled = false;
            }
        }
        public static Bounds PilotBounds(Wingsuit w)
        {
            ColliderCache.Clear();
            w.GetComponentsInChildren(ColliderCache);

            var bounds = ColliderCache[0].bounds;

            for (int i = 1; i < ColliderCache.Count; i++)
            {
                var collider = ColliderCache[i];
                bounds.Encapsulate(collider.bounds);
            }
            return(bounds);
        }
Example #3
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;
        }