Esempio n. 1
0
    public void LoadScene()
    {
        levelLogic.Stop();

        if (isMenu)
        {
            levelLogic.StartLoad(titleScene);
        }
        else
        {
            levelLogic.StartLoad(gameplayScene);
        }
    }
    void Update()
    {
        videoCounter += Time.deltaTime;

        if (videoCounter > video.clip.length)
        {
            levelLogic.StartLoad(levelLogic.nextScene);
        }
    }
Esempio n. 3
0
 public void SetScene(int scene)
 {
     levelLogic.StartLoad(scene);
 }
Esempio n. 4
0
    public void Update()
    {
        if (GameObject.Find("LevelManager") != null)
        {
            level = GameObject.Find("LevelManager").GetComponent <LevelLogic>();
        }
        if (myCamera == null)
        {
            myCamera = GetComponent <CameraBehaviour>();
        }

        if (Input.GetButtonDown("Pause"))
        {
            TogglePause();
        }
        if (paused)
        {
            return;
        }

        if (Input.GetButtonDown("Cancel"))
        {
            //if (!builder.canCreateBuild) uiConstruction.StopConstruction();
            uiTrigger.DeselectBuilding();
        }

        if (!tutorial.Active)
        {
            #region Axis


            axis.x = Input.GetAxis("Horizontal") * moveSpeed;
            axis.y = Input.GetAxis("Vertical") * moveSpeed;

            inputMouse.x = Input.GetAxis("Mouse X") * moveSpeed;
            inputMouse.y = Input.GetAxis("Mouse Y") * moveSpeed;

            //inputMouseJostick.x = Input.GetAxis("Right Joystick X");
            //inputMouseJostick.y = Input.GetAxis("Right Joystick Y");

            realMousePosition = inputMouse;
            //realMousePosition = inputMouseJostick;

            #endregion
            #region Speed
            if (Input.GetButtonDown("Speed1"))
            {
                Time.timeScale = 1.0f;
            }
            if (Input.GetButtonDown("Speed2"))
            {
                Time.timeScale = 1.5f;
            }
            if (Input.GetButtonDown("Speed3"))
            {
                Time.timeScale = 2.0f;
            }
            if (Input.GetButtonDown("ChangeSpeedController"))
            {
                speedController = !speedController;
                if (!speedController)
                {
                    Time.timeScale = 1.0f;
                }
                if (speedController)
                {
                    Time.timeScale = 2.0f;
                }
                Debug.Log(Time.timeScale);
            }
            #endregion
            #region Rotate
            if (Input.GetAxis("Rotate") > 0.01f || Input.GetAxis("Rotate") < -0.01f)
            {
                isRotating = Input.GetAxis("Rotate") * 2;
            }
            else if (Input.GetAxis("RotateController") > 0.01f || Input.GetAxis("RotateController") < -0.01f)
            {
                Debug.Log(Input.GetAxis("RotateController"));

                isRotating = Input.GetAxis("RotateController") * 2;
            }
            else
            {
                isRotating = 0;
            }


            if (isRotating >= 2)
            {
                isRotating = 2;
            }
            else if (isRotating <= -2)
            {
                isRotating = -2;
            }

            rotate = isRotating;

            #endregion
            if (builder.canCreateBuild && Input.GetKeyDown(KeyCode.Escape))
            {
                builder.CantBuild(false);
            }
        }
        if (Input.GetButtonDown("Fire2") || Input.GetButtonDown("RotateBuilding"))
        {
            builder.AddRotation();
        }

        #region Camera Zoom
        if (Input.GetAxis("Mouse ScrollWheel") != 0)
        {
            mainCamera.transform.localPosition += new Vector3(0, 0, Input.GetAxis("Mouse ScrollWheel") * zoomSpeed); //Change values according to your requirements
        }
        if (Input.GetAxis("Mouse ScrollWheel Controller") != 0)
        {
            mainCamera.transform.localPosition += new Vector3(0, 0, Input.GetAxis("Mouse ScrollWheel Controller") * zoomSpeed / 2); //Change values according to your requirements
        }


        if (mainCamera.transform.localPosition.z >= -10)
        {
            mainCamera.transform.localPosition = new Vector3(mainCamera.transform.localPosition.x, mainCamera.transform.localPosition.y, -10);
        }
        else if (mainCamera.transform.localPosition.z <= -50)
        {
            mainCamera.transform.localPosition = new Vector3(mainCamera.transform.localPosition.x, mainCamera.transform.localPosition.y, -50);
        }

        #region Zoom Camera Example

        /*if (Input.GetAxis("Mouse ScrollWheel") > 0)   this fuking Works
         * {
         *  mainCamera.fieldOfView -= 5; //Change values according to your requirements
         * }
         * if (Input.GetAxis("Mouse ScrollWheel") < 0)
         * {
         *  mainCamera.fieldOfView += 5;
         * }*/
        #endregion
        #endregion

        if (Input.GetButtonDown("GodMode"))
        {
            godMode = !godMode;
            Debug.Log("GodMode:" + godMode);
        }
        if (Input.GetKey(KeyCode.AltGr) && level != null)
        {
            if (Input.GetKeyDown(KeyCode.N))
            {
                level.StartLoad(level.nextScene);
            }
            if (Input.GetKeyDown(KeyCode.B))
            {
                level.StartLoad(level.backScene);
            }
            if (Input.GetKeyDown(KeyCode.R))
            {
                level.StartLoad(level.currentScene);
            }
            if (Input.GetKeyDown(KeyCode.C))
            {
                level.StartLoad(level.menuScene);
            }
        }



        myCamera.GetAxis(axis.x, axis.y);
        myCamera.GetRotate(rotate);
        CanPlace();
        //Builder.CreateBuild(Input.GetButtonDown("Fire1"));
        //UiTrigger.GetMousePosition(mousePosition);
    }
Esempio n. 5
0
    void NoPaused()
    {
        if (mage != null)
        {
            if (mage.isUpdatingCirclePosition && mage.isActiveAndEnabled)
            {
                if (Input.GetMouseButtonDown(1))
                {
                    mage.isDoingSkill = true;
                    return;
                }
                if (Input.GetMouseButtonDown(0))
                {
                    mage.isUpdatingCirclePosition = false;
                }
            }
        }

        mouse.mousePosition = mousePosition;

        #region CameraControllerAndZoom
        inputAxis.x = Input.GetAxis("Horizontal");
        inputAxis.y = Input.GetAxis("Vertical");
        rotateAxis  = Input.GetAxis("Rotation");
        mouseAxis   = Input.GetAxis("Mouse X");
        scrollAxis  = Input.GetAxis("Mouse ScrollWheel");

        cameraController.SetInputAxis(inputAxis, mousePosition);
        cameraController.SetRotationAxis(rotateAxis);
        cameraZoom.SetAxis(scrollAxis);

        if (Input.GetButton("Fire3"))
        {
            cameraController.SetMouseRotationAxis(mouseAxis);
        }
        #endregion

        #region Selection&MovementBehaviours
        if (Input.GetMouseButton(0))
        {
            mouse.isDragging = true;
        }
        if (Input.GetMouseButtonUp(0))
        {
            mouse.MouseButtonUp();
        }
        if (Input.GetMouseButtonDown(0))
        {
            if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
                mouse.multipleUnitSelection = true;
            }
            mouse.ClickState();
        }
        if (Input.GetMouseButtonDown(1))
        {
            if (mouse.selectedUnit != null)
            {
                formationPosition = Vector3.zero;
                mouse.selectedUnit.ClickUpdate(formationPosition, mousePosition);
            }
            if (mouse.selectedUnits != null)
            {
                for (int i = 0; i < mouse.selectedUnits.Count; i++)
                {
                    if (i == 0)
                    {
                        formationPosition = Vector3.zero;
                    }
                    if (i == 1)
                    {
                        formationPosition = new Vector3(-4, 0, 0);
                    }
                    if (i == 2)
                    {
                        formationPosition = new Vector3(4, 0, 0);
                    }
                    if (i == 3)
                    {
                        formationPosition = new Vector3(0, 0, 4);
                    }

                    mouse.selectedUnits[i].ClickUpdate(formationPosition, mousePosition);
                }
            }
        }
        #endregion

        #region PlayableUnitSkills
        if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1))
        {
            hero.SkillUpdate();
        }
        if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2))
        {
            mage.isUpdatingCirclePosition = true;
        }
        #endregion

        if (Input.GetKeyDown(KeyCode.M))
        {
            levelLogic.StartLoad(4);
        }
    }
Esempio n. 6
0
 public void Reset()
 {
     levelLogic.Stop();
     levelLogic.StartLoad(gameplayScene);
 }
Esempio n. 7
0
 public void ChangetoNextScene()
 {
     levelLogic.StartLoad(levelLogic.nextScene);
 }
Esempio n. 8
0
 public void ChangetoNextScene()
 {
     //musicAudioSource.Stop();
     audioPlayer.StopMusic();
     levelLogic.StartLoad(levelLogic.nextScene);
 }