Ejemplo n.º 1
0
 private void _keyReleased(FlyCamera flyCam)
 {
     if (Input.GetKeyUp(KeyCode.W))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Forward, 0);
     }
     if (Input.GetKeyUp(KeyCode.S))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Backword, 0);
     }
     if (Input.GetKeyUp(KeyCode.A))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Leftword, 0);
     }
     if (Input.GetKeyUp(KeyCode.D))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Rightword, 0);
     }
     if (Input.GetKeyUp(KeyCode.Q))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Lower, 0);
     }
     if (Input.GetKeyUp(KeyCode.E))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Rise, 0);
     }
 }
Ejemplo n.º 2
0
 private void _keyPressed(FlyCamera flyCam)
 {
     if (Input.GetKeyDown(KeyCode.W))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Forward, 1);
     }
     if (Input.GetKeyDown(KeyCode.S))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Backword, 1);
     }
     if (Input.GetKeyDown(KeyCode.A))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Leftword, 1);
     }
     if (Input.GetKeyDown(KeyCode.D))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Rightword, 1);
     }
     if (Input.GetKeyDown(KeyCode.Q))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Lower, 1);
     }
     if (Input.GetKeyDown(KeyCode.E))
     {
         _flyCameraAction(flyCam, FlyCameraAction.Rise, 1);
     }
 }
Ejemplo n.º 3
0
 private void Awake()
 {
     flyCamera           = Camera.main.GetComponent <FlyCamera> ();
     flyCamera.enabled   = false;
     orbitCamera         = Camera.main.GetComponent <OrbitCamera> ();
     orbitCamera.enabled = true;
 }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Camera animation utility", EditorStyles.boldLabel);

        speed = EditorGUILayout.FloatField("Speed", speed);
        FlyCamera targetCam = (FlyCamera)target;

        if (GUILayout.Button("First position"))
        {
            firstPos = targetCam.transform.position;
        }

        if (GUILayout.Button("Second position"))
        {
            secondPos = targetCam.transform.position;
        }

        if (GUILayout.Button("Play"))
        {
            EditorCoroutineUtility.StartCoroutine(AnimationCoroutine(targetCam.transform), this);
        }
    }
Ejemplo n.º 5
0
    void Start()
    {
        addTestLevels();

        _camera = Camera.main.GetComponent <FlyCamera>();
        LoadNextLevel();
    }
Ejemplo n.º 6
0
 public CameraController(Camera camera, float distance)
 {
     this.camera   = camera;
     this.distance = distance;
     flyCamera     = new FlyCamera(camera, distance);
     SetDefaultCameraPosition();
     EditFarPlane();
 }
Ejemplo n.º 7
0
    private void Start()
    {
        walkController    = GetComponent <RigidbodyFirstPersonController>();
        headbobController = GetComponentInChildren <HeadBob>();
        flyController     = GetComponent <FlyCamera>();
        playerRigidbody   = GetComponent <Rigidbody>();

        //FreezePlayer();
        SetPlayerMode(false);
    }
Ejemplo n.º 8
0
 private void Start()
 {
     flyCamera          = GetComponent <FlyCamera>();
     robotManager       = GetComponentInChildren <RSManager>();
     robotManager.isRed = isRed;
     if (isLaborer)
     {
         robotManager.Invoke("Die", 0.2f);
     }
 }
Ejemplo n.º 9
0
    static void _wheelScrooled(FlyCamera flyCam)
    {
        float amount = Input.GetAxis("Mouse ScrollWheel");

        if (amount > 0)
        {
            _flyCameraAction(flyCam, FlyCameraAction.ZoomIn, (float)amount);
        }
        else if (amount < 0)
        {
            _flyCameraAction(flyCam, FlyCameraAction.ZoomOut, -(float)amount);
        }
    }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     goWall = GameObject.Find("phxx3f3/1Walls");
     SetTransparent();
     goFlyController = GameObject.Find("FlyController");
     goClassroomVp = GameObject.Find("ViewPoints/Classroom");
     goCornerVp = GameObject.Find("ViewPoints/Corner");
     goSquareVp = GameObject.Find("ViewPoints/Square");
     cmpFlyCamera = goFlyController.GetComponent<FlyCamera>();
     //start point : class room
     goFlyController.transform.position = goClassroomVp.transform.position;
     cmpFlyCamera.rotationX = goClassroomVp.transform.localScale.x;
     cmpFlyCamera.rotationY = goClassroomVp.transform.localScale.y;
 }
Ejemplo n.º 11
0
    static void _mouseMoved(FlyCamera flyCam, int x, int y)
    {
        if (Input.GetKeyDown(KeyCode.Mouse1))
        {
            flyCam._rightMouseDown = true;
            flyCam._oldMouseX      = x;
            flyCam._oldMouseY      = y;
        }
        if (Input.GetKeyUp(KeyCode.Mouse1))
        {
            flyCam._rightMouseDown = false;
        }
        float aspect = 1;//flyCam._camera.aspect;

        if (flyCam._rightMouseDown && (flyCam._oldMouseX != x || flyCam._oldMouseY != y))
        {
            int offsetX = x - flyCam._oldMouseX;
            int offsetY = y - flyCam._oldMouseY;
            if (offsetX > 0)
            {
                _flyCameraAction(flyCam, FlyCameraAction.Right, offsetX / 10.0f);
            }
            else
            {
                _flyCameraAction(flyCam, FlyCameraAction.Left, -offsetX / 10.0f);
            }
            if (offsetY > 0)
            {
                _flyCameraAction(flyCam, FlyCameraAction.Down, offsetY / 10.0f / aspect);
            }
            else
            {
                _flyCameraAction(flyCam, FlyCameraAction.Up, -offsetY / 10.0f / aspect);
            }
        }
        flyCam._oldMouseX = x;
        flyCam._oldMouseY = y;
    }
Ejemplo n.º 12
0
    // switch the camera to flying object and activate it
    void switchCam()
    {
        Cam       main_cam = cam.GetComponent <Cam> ();
        FlyCamera f_cam    = flycam.GetComponent <FlyCamera> ();

        if (main_cam.shark_obj.selected)
        {
            f_cam.obj_num = 1;
        }
        else if (main_cam.barn_obj.selected)
        {
            f_cam.obj_num = 2;
        }
        else if (main_cam.barn_obj.transform.FindChild("cow").gameObject.GetComponent <Cow> ().selected)
        {
            f_cam.obj_num = 3;
        }
        else
        {
            return;
        }
        flycam.gameObject.SetActive(true);
        cam.gameObject.SetActive(false);
    }
Ejemplo n.º 13
0
 void Start()
 {
     flyCamera = GetComponentInChildren <FlyCamera>();
 }
Ejemplo n.º 14
0
 // Use this for initialization
 void Start()
 {
     cam    = FindObjectOfType <FlyCamera>();
     create = FindObjectOfType <Create>();
 }
Ejemplo n.º 15
0
 void Start()
 {
     robotManager  = GetComponentInParent <RSController>();
     flyCamera     = GetComponentInChildren <FlyCamera>();
     isSplitScreen = InitialSpawnManager.instance.isSplitScreen;
 }
Ejemplo n.º 16
0
 void Start()
 {
     Instance         = this;
     Cursor.visible   = false;
     Cursor.lockState = CursorLockMode.Locked;
 }
Ejemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     flyCam = GetComponent <FlyCamera>();
 }
 void Start()
 {
     script = follower.GetComponent <FlyCamera>();
 }
Ejemplo n.º 19
0
 static void _flyCameraAction(FlyCamera flyCam, FlyCameraAction action, float value)
 {
     flyCam._actionStatus[(int)action] = value;
 }
Ejemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     options = GetComponent <OptionsManager>();
     cam     = FindObjectOfType <FlyCamera>();
     @throw  = FindObjectOfType <Throw>();
 }
Ejemplo n.º 21
0
        /// <summary>
        ///   Setup the example.
        /// </summary>
        public override void Setup()
        {
            _scene          = new Scene();
            _rand           = new Random();
            _contentManager = new ContentManager(XnaRenderer.Instance.Services,
                                                 GLabController.Instance.HomeDirectory + "\\Data\\FractalTerrain");

            _psf         = new PlatonicSolidFactory(XnaRenderer.Instance);
            _matrixStack = new MatrixStack();
            filename     = InputHelper.LoadFileDialog("Load LIN-File");
            if (filename == "")
            {
                return;
            }
            _lindenmayerSystem = GLabReader.ReadLindenmayerSystemFromFile(filename);

            if (filename.Contains("1_"))
            {
                _pos = new Vector3(0, 0, Math.Abs(_lindenmayerSystem.CoordinateSystem.MaxX) + Math.Abs(_lindenmayerSystem.CoordinateSystem.MinX));
            }
            if (filename.Contains("2_"))
            {
                _pos = new Vector3(0, 0, 3);
            }
            if (filename.Contains("3_"))
            {
                _pos = new Vector3(3, 5, 3);
            }

            flow = new FrmFlowControl();

            // Breite und Länge initialisieren
            _vecStart = new Vector3(0, 0, 0);

            Vector3 pos    = _pos; // new Vector3(0, 0, 5);
            Vector3 lookAt = Vector3.Zero;
            Vector3 up     = Vector3.UnitY;


            //_polarCamera = new PolarCamera();
            //_polarCamera.SetLookAt(pos, lookAt, up);
            //_polarCamera.ActivateControl();
            //_polarCamView = new RenderView(512, 512, _scene, _polarCamera,
            //                               "Polar Camera");

            //Logger.Instance.LogInfo(
            //    "Controls (Polar Camera): <W>, <A>, <S>, <D>, <Q>, <E> and mouse movement (while left or right clicking).");

            _flyCamera = new FlyCamera();
            _flyCamera.ActivateControl();
            _flyCamera.SetLookAt(pos, lookAt, up);
            _flyCamera.Movement = 0.2f;
            _flyCamView         = new RenderView(256, 256, _scene, _flyCamera, "Fly Camera");

            Logger.Instance.LogInfo(
                "Controls (Fly Camera): <W>, <A>, <S>, <D>, <Q>, <E> and mouse movement (while left clicking). Use <R> to reset the camera to the initial position.");

            //XnaRenderer.Instance.Views.Add(_polarCamView);
            XnaRenderer.Instance.Views.Add(_flyCamView);

            Start();
            _scene.RenderCoordinateAxes = false;
            flow.StepCount = 1;
            currentAxiom   = _lindenmayerSystem.Axiom;
            int iStep = 11;

            while (true)
            {
                iStep++;
                nextGeneration(_scene, 0, iStep, currentAxiom);
                flow.Wait();
                Logger.Instance.LogInfo("" + iStep);
            }
        }
Ejemplo n.º 22
0
 private void Start()
 {
     flyCamera          = GetComponent <FlyCamera>();
     robotManager       = GetComponentInChildren <RSManager>();
     robotManager.isRed = isRed;
 }
Ejemplo n.º 23
0
 private void Awake()
 {
     Instance = this;
 }