コード例 #1
0
    void OnGUI()
    {
        // Create a GUI button to switch to SpaceScene1
        if (GUI.Button(new Rect(10, 10, 180, 25), "Switch to Scene 1 (F1)"))
        {
            SU_SpaceSceneSwitcher.Switch("SpaceScene1");
        }
        // Create a GUI button to switch to SpaceScene2
        if (GUI.Button(new Rect(10, 40, 180, 25), "Switch to Scene 2 (F2)"))
        {
            SU_SpaceSceneSwitcher.Switch("SpaceScene2");
        }

        // Switch Camera Follow mode
        SU_CameraFollow _cameraFollow = Camera.main.GetComponent <SU_CameraFollow>();

        if (GUI.Button(new Rect(10, 70, 180, 25), "Camera " + _cameraFollow.followMode.ToString()))
        {
            if (_cameraFollow.followMode == SU_CameraFollow.FollowMode.CHASE)
            {
                // Set following spectator mode
                _cameraFollow.followMode = SU_CameraFollow.FollowMode.SPECTATOR;
            }
            else
            {
                // Set chase view mode
                _cameraFollow.followMode = SU_CameraFollow.FollowMode.CHASE;
            }
        }

        // Handle Space Particles on/off
        _spaceParticles = GUI.Toggle(new Rect(10, 100, 180, 25), _spaceParticles, "Space Particles");
        if (_oldSpaceParticles != _spaceParticles)
        {
            // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code
            SU_SpaceSceneSwitcher.SetActive(spaceParticles.gameObject, _spaceParticles);
            // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle
            _oldSpaceParticles = _spaceParticles;
        }

        // Handle Space Fog on/off
        _spaceFog = GUI.Toggle(new Rect(10, 130, 180, 25), _spaceFog, "Space Fog");
        if (_oldSpaceFog != _spaceFog)
        {
            // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code
            SU_SpaceSceneSwitcher.SetActive(spaceFog.gameObject, _spaceFog);
            // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle
            _oldSpaceFog = _spaceFog;
        }

        // Handle Asteroids on/off - when the asteroid object is disabled, it will detect this and disable any active asteroids in the scene
        _spaceAsteroids = GUI.Toggle(new Rect(10, 160, 180, 25), _spaceAsteroids, "Space Asteroids");
        if (_oldSpaceAsteroids != _spaceAsteroids)
        {
            // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code
            SU_SpaceSceneSwitcher.SetActive(spaceAsteroids.gameObject, _spaceAsteroids);
            // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle
            _oldSpaceAsteroids = _spaceAsteroids;
        }
    }
コード例 #2
0
 /*public SU_Thruster thrustScript;
  *
  * void Start () {
  *      thrustScript = gameObject.Find("ThrusterLeft").GetComponent<SU_Thruster>();
  *      thrustScript.enabled = false;
  * }*/
 // Update is called once per frame
 void Update()
 {
     transform.RotateAround(lookAtObj.position, Vector3.up, rotateSpeed * Time.deltaTime);
     if (Input.anyKeyDown)
     {
         SU_CameraFollow followScript = (SU_CameraFollow)GetComponent(typeof(SU_CameraFollow));
         followScript.enabled = true;
         RotateCamera rotateScript = (RotateCamera)GetComponent(typeof(RotateCamera));
         rotateScript.enabled = false;
         //thrustScript.enabled = true;
     }
 }
コード例 #3
0
    // Token: 0x060044CF RID: 17615 RVA: 0x001704E4 File Offset: 0x0016E8E4
    private void OnGUI()
    {
        if (GUI.Button(new Rect(10f, 10f, 180f, 25f), "Switch to Scene 1 (F1)"))
        {
            SU_SpaceSceneSwitcher.Switch("SpaceScene1");
        }
        if (GUI.Button(new Rect(10f, 40f, 180f, 25f), "Switch to Scene 2 (F2)"))
        {
            SU_SpaceSceneSwitcher.Switch("SpaceScene2");
        }
        SU_CameraFollow component = Camera.main.GetComponent <SU_CameraFollow>();

        if (GUI.Button(new Rect(10f, 70f, 180f, 25f), "Camera " + component.followMode.ToString()))
        {
            if (component.followMode == SU_CameraFollow.FollowMode.CHASE)
            {
                component.followMode = SU_CameraFollow.FollowMode.SPECTATOR;
            }
            else
            {
                component.followMode = SU_CameraFollow.FollowMode.CHASE;
            }
        }
        this._spaceParticles = GUI.Toggle(new Rect(10f, 100f, 180f, 25f), this._spaceParticles, "Space Particles");
        if (this._oldSpaceParticles != this._spaceParticles)
        {
            SU_SpaceSceneSwitcher.SetActive(this.spaceParticles.gameObject, this._spaceParticles);
            this._oldSpaceParticles = this._spaceParticles;
        }
        this._spaceFog = GUI.Toggle(new Rect(10f, 130f, 180f, 25f), this._spaceFog, "Space Fog");
        if (this._oldSpaceFog != this._spaceFog)
        {
            SU_SpaceSceneSwitcher.SetActive(this.spaceFog.gameObject, this._spaceFog);
            this._oldSpaceFog = this._spaceFog;
        }
        this._spaceAsteroids = GUI.Toggle(new Rect(10f, 160f, 180f, 25f), this._spaceAsteroids, "Space Asteroids");
        if (this._oldSpaceAsteroids != this._spaceAsteroids)
        {
            SU_SpaceSceneSwitcher.SetActive(this.spaceAsteroids.gameObject, this._spaceAsteroids);
            this._oldSpaceAsteroids = this._spaceAsteroids;
        }
    }
コード例 #4
0
	// Use this for initialization
	void Start () {
		cameraFollowScript = GetComponent<SU_CameraFollow> ();
	}