Пример #1
0
    private void FixedUpdate()
    {
        OnFixedUpdate();
        rb.velocity = springManager.GetVelocity(rb.velocity);

        if (springManager.IsDropping())
        {
            var shouldDeploy = CheckForDeploy();
            if (shouldDeploy)
            {
                rb.velocity           = Vector2.zero;
                myParachute           = Instantiate(parachutePrefab, transform.position + Vector3.up, Quaternion.identity);
                joint                 = gameObject.AddComponent <HingeJoint2D>();
                joint.connectedBody   = myParachute.GetComponent <Rigidbody2D>();
                joint.anchor          = new Vector2(0, .59f);
                joint.connectedAnchor = new Vector2(0.05f, -0.6f);
                joint.limits          = new JointAngleLimits2D {
                    max = 359, min = 0
                };
                joint.breakForce  = VeryLarge;
                joint.breakTorque = VeryLarge;
                joint.autoConfigureConnectedAnchor = true;
                springManager.Deploy(rb);
            }
        }

        if (springManager.IsFinished() && joint != null)
        {
            Destroy(joint);
            myParachute.CutLoose();
        }
    }
Пример #2
0
 public void SetParachuteTarget(FlightStatistics target, Parachute parachute)
 {
     _target     = target;
     _targetType = AvatarType.Parachute;
     _parachuteConfig.MinOrbitDistance = UnityParachuteFactory.OrbitDistance(parachute);
     _transitionStartTime = _clock.CurrentTime;
 }
Пример #3
0
        public Orion(string craftDirectory, DVector2 position, DVector2 velocity, double payloadMass, double propellantMass = 175)
            : base(craftDirectory, position, velocity, payloadMass, propellantMass, "SLS/Orion.png")
        {
            _drogueChute = new DrogueChute(this, new DVector2(7.0, -8.5));
            _parachute   = new Parachute(this, new DVector2(-10.0, -36.0));

            Engines = new IEngine[] {};
        }
    public static void Main(string[] args)
    {
        TreasureBox t = new TreasureBox();
        Parachute   p = new Parachute();

        Console.WriteLine("Enter the letter found in the paper");
        char ch = Console.ReadLine()[0];

        if (ch == 'T')
        {
            Console.WriteLine(t.OpenSesame());
        }
        else if (ch == 'P')
        {
            Console.WriteLine(p.OpenSesame());
        }
    }
Пример #5
0
            private IEnumerator <WaitCommand> OnEnter(PlayingEnvironment environment)
            {
                _environment = environment;

                _parachute = _data.ImmersionSpawner.Create(environment.ParachuteConfig, "ImmersionParachute");
                _data.ParachuteController.Parachute = _parachute;

                _parachute.AttachToPilot(environment.Pilot, Parachute.InflightUnfoldOrientation, _data.GameSettingsProvider);
                // TODO This is a hack to compensate for the editor
                //      that misuses the pilot for its own purposes.
                //      We actually need a second pilot for editor purposes

                environment.Pilot.DisableWings();
                environment.Pilot.SetPhysical();
                environment.Pilot.PilotAnimator.SetState(PilotAnimatorState.Parachute);

                SwitchToMount(environment.SelectedCameraMount);
                _data.GameHud.SetTarget(_parachute.Pilot.FlightStatistics, AvatarType.Parachute);
                _data.GameHud.Activate();

                _parachute.Deploy();

                Cursor.lockState = CursorLockMode.Locked;
                Cursor.visible   = false;

                if (_data.CameraManager.Rig.Shake)
                {
                    _data.CameraManager.Rig.Shake.enabled = true;
                }

                _data.GameClock.Resume();
                _data.FixedClock.Resume();

                _data.SoundMixer.Unpause(SoundLayer.GameEffects);

                // Indicate that we have unfolded the parachute once, i.e. the player know how to do it
                if (_data.GameSettingsProvider.ActiveSettings.Tutorial.HasUnfoldedParachute != true)
                {
                    var gameSettings = _data.GameSettingsProvider.ActiveSettings;
                    gameSettings.Tutorial.HasUnfoldedParachute = true;
                    _data.GameSettingsProvider.UpdateGameSettings(gameSettings);
                }

                yield return(WaitCommand.DontWait);
            }
Пример #6
0
        public DragonV2(string craftDirectory, DVector2 position, DVector2 velocity, double payloadMass, double propellantMass)
            : base(craftDirectory, position, velocity, payloadMass, propellantMass, "Dragon/V2/crewdragon.png")
        {
            _drogueChute = new DrogueChute(this, new DVector2(7.0, -8.5));
            _parachute   = new Parachute(this, new DVector2(-10.0, -36.0));

            Engines = new IEngine[]
            {
                new SuperDraco(0, this, new DVector2(-1.35, 0.1), -0.15),
                new SuperDraco(1, this, new DVector2(-1.35, 0.1), -0.15),
                new SuperDraco(2, this, new DVector2(-1.4, 0.1), -0.25),
                new SuperDraco(3, this, new DVector2(-1.4, 0.1), -0.25),
                new SuperDraco(4, this, new DVector2(1.35, 0.1), 0.15),
                new SuperDraco(5, this, new DVector2(1.35, 0.1), 0.15),
                new SuperDraco(6, this, new DVector2(1.4, 0.1), 0.25),
                new SuperDraco(7, this, new DVector2(1.4, 0.1), 0.25),
            };
        }
Пример #7
0
        public F9S2B(string craftDirectory, DVector2 position, DVector2 velocity, double stageOffset, double propellantMass = 103500)
            : base(craftDirectory, position, velocity, 0, propellantMass, "Falcon/9/S2B.png")
        {
            StageOffset = new DVector2(0, stageOffset);

            _drogueChute = new DrogueChute(this, new DVector2(-2.5, 5));
            _parachute   = new Parachute(this, new DVector2(-1.5, 0.0), true);

            Engines = new IEngine[]
            {
                new Merlin1DVac(this, new DVector2(0, Height * 0.38))
            };

            _skids = new[]
            {
                new Skid(this, new DVector2(1.1, -5), true),
                new Skid(this, new DVector2(1.1, 0.5), true)
            };

            _spriteSheet = new SpriteSheet("Textures/Spacecrafts/Falcon/9/scaledShip.png", 12, 12);
        }
Пример #8
0
    void Awake()
    {
        _anim = GetComponent <Animator> ();

        _boneHands    = transform.Find("body/hand_right");
        _boneHead     = transform.FindChild("body/head");
        _boneMuzzle   = transform.FindChild("body/hand_right/muzzle");
        _boneEjection = transform.FindChild("body/hand_right/ejection");

        _spriteHead = transform.Find("body/head").GetComponent <SpriteRenderer>();
        _spriteBody = transform.Find("body").GetComponent <SpriteRenderer>();
        _spriteFeet = transform.Find("body/feet").GetComponent <SpriteRenderer>();

        if (_currentWeapon == null)
        {
            _currentWeapon = gameObject.GetComponentInChildren <Weapon>();
        }

        if (gameManager == null)
        {
            gameManager = GameObject.Find("Game Manager").GetComponent <GameManager>();
        }


        /*if(role == Role.Enemy) {
         *      boneAnimation.SwapTexture("player", "player_body", "player", "enemy_body");
         *      boneAnimation.SwapTexture("player", "player_head", "player", "enemy_head");
         *      boneAnimation.SwapTexture("player", "player_run_1", "player", "enemy_run_1");
         *      boneAnimation.SwapTexture("player", "player_run_2", "player", "enemy_run_2");
         *      boneAnimation.SwapTexture("player", "player_run_3", "player", "enemy_run_3");
         *      boneAnimation.SwapTexture("player", "player_stand", "player", "enemy_stand");
         * }*/

        parachute = GetComponent <Parachute> ();

        healthBar = GetComponentInChildren <ProgressBar> ();
        healthBar.hide();
    }
Пример #9
0
            void CreateEditorChute(ParachuteConfig config, ImmutableTransform transform)
            {
                if (_editorParachute != null)
                {
                    _editorParachute.DetachPilot();
                    GameObject.Destroy(_editorParachute.Root.gameObject);
                }

                _editorParachute = _data.EditorSpawner.Create(config, transform, "EditorParachute");

                _environment.Pilot.SetKinematic();
                _environment.Pilot.OnDespawn();
                _environment.Pilot.transform.position = transform.Position;
                _environment.Pilot.transform.rotation = transform.Rotation;
                _environment.Pilot.OnSpawn();
                _environment.Pilot.SetKinematic();

                _editorParachute.AttachToPilot(_environment.Pilot, Parachute.DefaultUnfoldOrientation, _data.GameSettingsProvider);
                UnityParachuteFactory.SetKinematic(_editorParachute);
                _data.EditorCamera.SetTarget(_editorParachute);

                _editorParachuteChanges.OnNext(_editorParachute);
            }
Пример #10
0
 void Awake()
 {
     parachute = GetComponent <Parachute> ();
     _anim     = GetComponent <Animator> ();
 }