Beispiel #1
0
        private void Update()
        {
            if (ActiveMovementEnumeration == null)
            {
                var nextMovement = CameraMovements.DequeueToFirstOrDefault(movement => !movement.Cancelled);

                if (nextMovement == null)
                {
                    // Convenience hot key for pointing camera to origin, for better Haxxis usability (but not during a camera sequence as in choreography)
                    if (Input.GetButtonDown("Point camera to origin") && HaxxisGlobalSettings.Instance.IsVgsJob == false)
                    {
                        MainCamera.transform.LookAt(Vector3.zero);
                    }

                    return;
                }

                nextMovement.MovementComplete += HandleMovementCompleted;
                ActiveMovementEnumeration      = nextMovement.MovementEnumerator();
            }

            if (ActiveMovementEnumeration != null)
            {
                ActiveMovementEnumeration.MoveNext();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Move the camera in the given direction
        /// </summary>
        /// <param name="mov"></param>
        /// <param name="amount"></param>
        public void Move(CameraMovements mov, float amount)
        {
            var speed = unitsPerSecond * amount;

            switch (mov)
            {
            case CameraMovements.StrafeLeft:
                StrafeHorizontal(speed);
                break;

            case CameraMovements.StrafeRight:
                StrafeHorizontal(-speed);
                break;

            case CameraMovements.ThrustForward:
                Thrust(speed);
                break;

            case CameraMovements.ThrustBackward:
                Thrust(-speed);
                break;

            case CameraMovements.StrafeUp:
                StrafeVertical(speed);
                break;

            case CameraMovements.StrafeDown:
                StrafeVertical(-speed);
                break;

            default:
                break;
            }
        }
Beispiel #3
0
 // Get references if they're not here
 void GetReferences()
 {
     if (cameraScript == null)
     {
         if (Camera.main.GetComponent <CameraMovements>())
         {
             cameraScript = Camera.main.GetComponent <CameraMovements>();
         }
     }
 }
Beispiel #4
0
    void Start()
    {
        cameraMovements = Camera.main.gameObject.GetComponent <CameraMovements>();

        beginCameraSize = Camera.main.orthographicSize;

        float aspectRatio = Camera.main.aspect;

        finalCameraSize = lateralView / aspectRatio;

        diffSize = finalCameraSize - beginCameraSize;
    }
Beispiel #5
0
    public static void OnLoadLevel()
    {
        //Imposto qui il palyer, ad ogni caricamento di livello
        m_Character = FindObjectOfType <W_playerController>();

        UserControl      = FindObjectOfType <W_UserControl>();
        cameraShake      = FindObjectOfType <CameraShake>();
        cameraMovements  = FindObjectOfType <CameraMovements>();
        ThisLevelManager = FindObjectOfType <LevelManager>();     //Ad ogni caricamento di livello, trova il level manager
        gameUI           = FindObjectOfType <GameUI>();           //Ad ogni caricamento di livello, trova il level manager//Lo trova ad ongi caricamento di livello
        gameUI.gameObject.GetComponent <CanvasGroup>().alpha = 1; //Se è un livello, al caricamento, visualizzalo
        MiniMenu        = GameObject.Find("MiniMenu");
        MiniOptionsMenu = GameObject.Find("MiniOptionsMenu");
        Timer           = FindObjectOfType <W_SceneTimer>();
        //Se non sono nel developmentMode
        if (!developmentMode)
        {
            MainMenu.HideMainMenu();//Se è un livello, al caricamento, nascondilo
        }
        m_Character.GetComponent <Rigidbody>().isKinematic = true;
        //Prendo i gameObjects da GameUI di questo livello
        MiniMenu        = GameUI.Instance._MiniMenu;
        MiniOptionsMenu = GameUI.Instance._MiniOptionsMenu;
        _DeadPanel      = GameUI.Instance._DeadPanel;
        _EndTimePanel   = GameUI.Instance._EndTimePanel;
        MiniMenu.gameObject.SetActive(false);
        MiniOptionsMenu.gameObject.SetActive(false);
        _DeadPanel.gameObject.SetActive(false);
        _EndTimePanel.gameObject.SetActive(false);
        PlayerIsDead             = false;
        m_Character.PlayerEnergy = 1;



        //Timer.PauseTimer = true; //Mette in pausa per i primi tot secondi, poi parte

        Camera.main.transform.localPosition = new Vector3(Camera.main.transform.localPosition.x, Camera.main.transform.localPosition.y, GameManager.Instance.CameraDistance + ThisLevelManager.TowerSize);
    }
 // Start is called before the first frame update
 void Start()
 {
     instance       = this;
     startPosition  = transform.position;
     targetPosition = new Vector3(0f, 5f, -5.8f);
 }
Beispiel #7
0
    // Use this for initialization
    void Awake()
    {
        controller = GameObject.FindGameObjectWithTag("Controller");
        if (controller != null)
        {
            cursorHandler = controller.GetComponent <CursorHandler>();
        }

        player = GameObject.FindGameObjectWithTag("Player");
        if (player != null)
        {
            playerMovements = player.GetComponent <PlayerMovements>();
        }

        magicLanternLogicOBJ = GameObject.FindGameObjectWithTag("MagicLanternLogic");
        if (magicLanternLogicOBJ != null)
        {
            magicLanternLogic   = magicLanternLogicOBJ.GetComponent <MagicLantern>();
            magicLanternGraphic = magicLanternLogicOBJ.GetComponent <GraphicLantern>();
            glassesManager      = magicLanternLogicOBJ.GetComponent <GlassesManager>();
        }

        magicLantern = GameObject.FindGameObjectWithTag("Lantern");

        canvasPlayingUI = GameObject.FindGameObjectWithTag("CanvasPlayingUI");
        if (canvasPlayingUI != null)
        {
            playingUI         = canvasPlayingUI.GetComponent <PlayingUI>();
            playingUILateral  = canvasPlayingUI.GetComponent <PlayingUILateral>();
            playingUIGameOver = canvasPlayingUI.GetComponent <PlayingUIGameOver>();
        }

        canvasMenu = UtilFinder._FindGameObjectByTag("CanvasMenu");

        unlockableContentUI = UtilFinder._GetComponentOfGameObjectWithTag <UnlockableContentUI> ("Controller");
        informativeManager  = UtilFinder._GetComponentOfGameObjectWithTag <InformativeManager> ("MenuController");
        menuManager         = UtilFinder._GetComponentOfGameObjectWithTag <MenuManager> ("MenuController");
        playStatusTracker   = UtilFinder._GetComponentOfGameObjectWithTag <PlayStatusTracker> ("Controller");

        testInformativeManager = UtilFinder._GetComponentOfGameObjectWithTag <TestInformativeManager> ("TestController");
        testingController      = GameObject.FindGameObjectWithTag("TestController");
        if (testingController != null)
        {
            hintAnalyzer = testingController.GetComponent <HintAnalyzer>();
        }

        hubController = GameObject.FindGameObjectWithTag("HubController");
        if (hubController != null)
        {
            unlockedLevelControl = hubController.GetComponent <UnlockedLevelControl>();
            hubLadderControl     = hubController.GetComponent <HubLadderControl>();
            hubLanternControl    = hubController.GetComponent <HubLanternControl>();
        }

        if (controller != null)
        {
            inputKeeper = controller.GetComponent <InputKeeper>();
        }

        camera = Camera.main.gameObject;
        if (camera != null)
        {
            cameraMovements = camera.GetComponent <CameraMovements>();
            cameraHandler   = camera.GetComponent <CameraHandler>();
        }

        GameObject levelChanger = GameObject.FindGameObjectWithTag("CanvasLoadLevel");

        if (levelChanger != null)
        {
            levelChangerGeneral = levelChanger.GetComponent <LevelChangerGeneral> ();
        }

        GameObject buttonControllerOBJ = GameObject.FindGameObjectWithTag("ButtonControllerLink");

        if (buttonControllerOBJ != null)
        {
            buttonController    = buttonControllerOBJ.GetComponent <ButtonController> ();
            inputManager        = buttonControllerOBJ.GetComponent <InputManager>();
            buttonKeyboardMouse = buttonControllerOBJ.GetComponent <ButtonKeyboardMouse>();
        }
    }
Beispiel #8
0
 public void QueueCameraMovement(ICameraMovement movement)
 {
     CameraMovements.Enqueue(movement);
 }