public void BackToNetwork()
    {
        if (CyberspaceBattlefield.Current.RequiredButtonExists)
        {
            ToastLog.Toast("Undownloaded data in subnet!");
            return;
        }

        CyberspaceBattlefield.Current.Abdicate = true;
        var pixelater = new PixelateTransition()
        {
            finalScaleEffect = PixelateTransition.PixelateFinalScaleEffect.ToPoint,
            duration = 1.0f
        };
        pixelater.nextScene = 2;
        TransitionKit.instance.transitionWithDelegate( pixelater );
    }
예제 #2
0
	void OnGUI()
	{
		// hide the UI during transitions
		if( !_isUiVisible )
			return;

		if( Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android )
		{
			// bigger buttons for higher res mobile devices
			if( Screen.width >= 1500 || Screen.height >= 1500 )
				GUI.skin.button.fixedHeight = 60;
		}

		if( GUILayout.Button( "Fade to Scene" ) )
		{
			var fader = new FadeTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				fadedDelay = 0.2f,
				fadeToColor = Color.black
			};
			TransitionKit.instance.transitionWithDelegate( fader );
		}


		if( GUILayout.Button( "Vertical Slices to Scene" ) )
		{
			var slices = new VerticalSlicesTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				divisions = Random.Range( 3, 20 )
			};
			TransitionKit.instance.transitionWithDelegate( slices );
		}


		if( GUILayout.Button( "Triangle Slices to Scene" ) )
		{
			var slices = new TriangleSlicesTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				divisions = Random.Range( 2, 10 )
			};
			TransitionKit.instance.transitionWithDelegate( slices );
		}


		if( GUILayout.Button( "Pixelate to Scene with Random Scale Effect" ) )
		{
			var enumValues = System.Enum.GetValues( typeof( PixelateTransition.PixelateFinalScaleEffect ) );
			var randomScaleEffect = (PixelateTransition.PixelateFinalScaleEffect)enumValues.GetValue( Random.Range( 0, enumValues.Length ) );

			var pixelater = new PixelateTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				finalScaleEffect = randomScaleEffect,
				duration = 1.0f
			};
			TransitionKit.instance.transitionWithDelegate( pixelater );
		}


		if( GUILayout.Button( "Twirl via Component with No Scene Change" ) )
		{
			TransitionKit.instance.transitionWithDelegate( GetComponent<TwirlTransition>() );
		}


		if( GUILayout.Button( "Blur to Scene" ) )
		{
			var blur = new BlurTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 2.0f,
				blurMax = 0.01f
			};
			TransitionKit.instance.transitionWithDelegate( blur );
		}


		if( GUILayout.Button( "Wacky Blur with No Scene Change" ) )
		{
			var blur = new BlurTransition()
			{
				duration = 1.0f,
				blurMax = 1f
			};
			TransitionKit.instance.transitionWithDelegate( blur );
		}


		if( GUILayout.Button( "Big Squares to Scene" ) )
		{
			var squares = new SquaresTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 2.0f,
				squareSize = new Vector2( 5f, 4f ),
				smoothness = 0.0f
			};
			TransitionKit.instance.transitionWithDelegate( squares );
		}


		if( GUILayout.Button( "Little Squares to Scene" ) )
		{
			var squares = new SquaresTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 2.0f,
				squareSize = new Vector2( 64f, 45f ),
				squareColor = Color.yellow,
				smoothness = 0.1f
			};
			TransitionKit.instance.transitionWithDelegate( squares );
		}


		if( GUILayout.Button( "Ripples to Scene" ) )
		{
			var ripple = new RippleTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				amplitude = 1500f,
				speed = 20f
			};
			TransitionKit.instance.transitionWithDelegate( ripple );
		}


		if( GUILayout.Button( "Fish Eye to Scene" ) )
		{
			var fishEye = new FishEyeTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				size = 0.08f,
				zoom = 10.0f,
				colorSeparation = 3.0f
			};
			TransitionKit.instance.transitionWithDelegate( fishEye );
		}


		if( GUILayout.Button( "Fish Eye (alternate params) to Scene" ) )
		{
			var fishEye = new FishEyeTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 2.0f,
				size = 0.2f,
				zoom = 100.0f,
				colorSeparation = 0.1f
			};
			TransitionKit.instance.transitionWithDelegate( fishEye );
		}


		if( GUILayout.Button( "Doorway to Scene" ) )
		{
			var doorway = new DoorwayTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				perspective = 1.5f,
				depth = 3f,
				runEffectInReverse = false
			};
			TransitionKit.instance.transitionWithDelegate( doorway );
		}


		if( GUILayout.Button( "Doorway (reversed) to Scene" ) )
		{
			var doorway = new DoorwayTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				perspective = 1.1f,
				runEffectInReverse = true
			};
			TransitionKit.instance.transitionWithDelegate( doorway );
		}


		if( GUILayout.Button( "Wind to Scene" ) )
		{
			var wind = new WindTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				size = 0.3f
			};
			TransitionKit.instance.transitionWithDelegate( wind );
		}


		if( GUILayout.Button( "Curved Wind to Scene" ) )
		{
			var wind = new WindTransition()
			{
				useCurvedWind = true,
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				size = 0.3f,
				windVerticalSegments = 300f
			};
			TransitionKit.instance.transitionWithDelegate( wind );
		}


		if( GUILayout.Button( "Mask to Scene" ) )
		{
			var mask = new ImageMaskTransition()
			{
				maskTexture = maskTexture,
				backgroundColor = Color.yellow,
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1
			};
			TransitionKit.instance.transitionWithDelegate( mask );
		}
	}
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        //cheat! tilde to get instant 5 mins of oxygen
        if (Input.GetKeyUp(KeyCode.BackQuote))
        {
            if (Input.GetKey(KeyCode.LeftShift))
            {
                StarshipEnvironment.Instance.OxygenLevel -= .0025f;
            }
            else
            {
                StarshipEnvironment.Instance.OxygenLevel += .0025f;
            }
        }

        //hypersleep
        if (Input.GetKeyUp(KeyCode.C))
        {

        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            StartCoroutine(BeImmature());
        }

        bool escapeUp = Input.GetKeyUp(KeyCode.Escape);
        if (Input.GetKeyUp(KeyCode.E))
        {
            if (TerminalManager.IsNextToTerminal)
            {
                SetFocus(FocusState.Terminal);
            }
            else if (TerminalManager.IsNextToGenerator)
            {
                SetFocus(FocusState.Generator);
            }
        }
        else if (CurrentFocus != FocusState.None && escapeUp)
        {
            SetFocus(FocusState.None);
        }
        else if (escapeUp)
        {
            ToggleMenu();
        }

        if (CurrentFocus == FocusState.None)
        {
            float h, v;
            h = CrossPlatformInputManager.GetAxis("Horizontal");
            v = CrossPlatformInputManager.GetAxis("Vertical")  ;
            //print("h:" + h + " v:" + v);
            if (v > 0)
            {
                animator.SetInteger("Direction", 2);
            }
            else if (v < 0)
            {
                animator.SetInteger("Direction", 0);
            }
            else if (h > 0)
            {
                animator.SetInteger("Direction", 3);
            }
            else if (h < 0)
            {
                animator.SetInteger("Direction", 1);
            }
            headlightAnimator.SetFloat("BlendX", Mathf.Clamp(h, -1f, 1f));
            headlightAnimator.SetFloat("BlendY", Mathf.Clamp(v, -1f, 1f));
            animator.SetBool("isWalking", (h != 0) || (v != 0));

            Vector3 vec = new Vector3(h, v, 0f);
            vec.Normalize();
            vec.x *= Time.deltaTime * 5f;
            vec.y *= Time.deltaTime * 5f;
            this.transform.Translate(vec);
        }

        if (CrossPlatformInputManager.GetButtonDown("Jump") && !HarmonicSerialization.Instance.IsNewGame){
            UICanvas.enabled = false;
            var pixelater = new PixelateTransition()
            {
                nextScene = 2,
                finalScaleEffect = PixelateTransition.PixelateFinalScaleEffect.ToPoint,
                duration = 1.0f
            };
            TransitionKit.instance.transitionWithDelegate( pixelater );
        }

        ClockText.text = HarmonicUtils.ClockFormat((float)StarshipEnvironment.Instance.SecondsTilOxygenRunsOut);
        ClockFill.fillAmount = (float)(StarshipEnvironment.Instance.OxygenLevel / StarshipEnvironment.Instance.OxygenStorage);
    }
예제 #4
0
 private void TransitionToMeatspace()
 {
     var pixelater = new PixelateTransition()
     {
         nextScene = 1,
         finalScaleEffect = PixelateTransition.PixelateFinalScaleEffect.ToPoint,
         duration = 1.0f
     };
     TransitionKit.instance.transitionWithDelegate(pixelater);
 }
예제 #5
0
 public void StartGame()
 {
     var pixelater = new PixelateTransition()
     {
         finalScaleEffect = PixelateTransition.PixelateFinalScaleEffect.ToPoint,
         duration = 1.0f
     };
     pixelater.nextScene = 1;
     TransitionKit.instance.transitionWithDelegate(pixelater);
     return;
 }
    // Update is called once per frame
    void Update()
    {
        if (CrossPlatformInputManager.GetButtonDown("Cancel")){
            var pixelater = new PixelateTransition()
            {
                finalScaleEffect = PixelateTransition.PixelateFinalScaleEffect.ToPoint,
                duration = 1.0f
            };
            pixelater.nextScene = 0;
            TransitionKit.instance.transitionWithDelegate( pixelater );
            return;
        }

        boost = CrossPlatformInputManager.GetButton("Jump");
        boostStart = CrossPlatformInputManager.GetButtonDown("Jump");
        boostStop = CrossPlatformInputManager.GetButtonUp("Jump");

        vert = -CrossPlatformInputManager.GetAxis("Mouse Y") * ySensitivity;
        horz = CrossPlatformInputManager.GetAxis("Mouse X") * xSensitivity;
        roll = -CrossPlatformInputManager.GetAxis("Roll") * zSensitivity;

        //print(string.Format("Boosting:{0}, X:{1}, Y:{2}, Z:{3}", boost, horz, vert, roll));

        /*if (thruster != null){
            if (currentThrottle != 0f){
                if (boost) {
                    thruster.ChangeEngineState(EngineThruster.EngineState.Boost);
                } else {
                    thruster.ChangeEngineState(EngineThruster.EngineState.Engaged);
                }
            } else {
                thruster.ChangeEngineState(EngineThruster.EngineState.Idle);
            }
        }*/

        if (boostStart){
            throttleBoostDirection = 1;
        } else if (boostStop){
            throttleBoostDirection = -1;
        } else if ((throttleBoostDirection == -1) && (ThrottlePanel.color.Equals(normalThrottlePanelColor))){
            throttleBoostDirection = 0;
        }

        if (throttleBoostDirection == 1){
            ThrottlePanel.color = Color.Lerp(ThrottlePanel.color, Color.red, 4f*Time.deltaTime);
        } else if (throttleBoostDirection == -1){
            ThrottlePanel.color = Color.Lerp(ThrottlePanel.color, normalThrottlePanelColor, 4f*Time.deltaTime);
        }

        Vector3 translateV = new Vector3(
            CrossPlatformInputManager.GetAxis("Horizontal") * moveSpeed * (boost ? boostMultiplier : 1),
            CrossPlatformInputManager.GetAxis("Elevator") * moveSpeed * (boost ? boostMultiplier : 1),
            CrossPlatformInputManager.GetAxis("Vertical") * moveSpeed * (boost ? boostMultiplier : 1)
            );
        translateV.Normalize();

        if (translateV.magnitude > 0)
        {
            this.transform.parent.transform.Translate(translateV);
        }

        BoundsCheckInput();

        currentHeading *= Quaternion.Euler(vert,
                                           horz,
                                           roll);

        playerPrefab.rotation = Quaternion.Slerp(playerPrefab.rotation, currentHeading, smoothing * Time.deltaTime);
    }