Наследование: MonoBehaviour
Пример #1
0
    private IEnumerator BeforeWin()
    {
        stopObjects.Invoke();
        if (!Covering.isCovering)
        {
            covering.Stop();
        }
        yield return(new WaitForSeconds(EyeBlinkController.halfTimeBlink - EyeBlinkController.halfTimeBlink / 4));

        if (Covering.isCovering) //Закрываем скрипт покрывала чуть-чуть раньше, чем игрок откроет глаза, дабы не было видно подрагивания покрывала(короче, забей, чисто визуальная заморочка)
        {
            covering.Stop();
        }
        yield return(new WaitForSeconds(EyeBlinkController.halfTimeBlink / 4));

        if (Covering.isCovering)
        {
            camAnimation.StopBeforeCutScene();
            RotateCamera.SetDefaultTransform();
            RotateCamera.StartRotate();
        }
        yield return(new WaitForSeconds(clock.alarmSoundLenght + timeBeforeCutScene));

        cutSceneObject.SetActive(true);
        StopCoroutine(beforeWinCourutine);
    }
Пример #2
0
    public void startTRSGizmo(GameObject o)
    {
        gizmoScript = (GyzmoTransformScript)gizmoChild.GetComponent(typeof(GyzmoTransformScript));


        //gizmoLight.SetActive (true);
        gizmoChild.SetActive(true);
        gizmoCamera.SetActive(true);
        gizmoScript.startGizmoAttachment(o);
        Transform mainCamera = transform.Find("Main Camera");

        ScaleCamera  scale  = (ScaleCamera)mainCamera.GetComponent(typeof(ScaleCamera));
        RotateCamera rotate = (RotateCamera)mainCamera.GetComponent(typeof(RotateCamera));

        rotate.setPoint(o);

        LinkGyzmoPositionToPointPosition link = (LinkGyzmoPositionToPointPosition)gizmoChild.GetComponent(typeof(LinkGyzmoPositionToPointPosition));

        link.SetPoint(o);


        SelectorScript selectorScript = (SelectorScript)selector.GetComponent(typeof(SelectorScript));

        selectorScript.setPoint(o);


        scale.SetFocusPoint(o);



        active = true;         //JT

        gizmoCamera.transform.position = viewerCamera.transform.position;
        gizmoCamera.transform.rotation = viewerCamera.transform.rotation;
    }
Пример #3
0
    void OnSceneGUI()
    {
        RotateCamera rotateCamera = target as RotateCamera;

        Handles.color = Color.blue;
        Handles.DrawWireArc(rotateCamera.transform.position, rotateCamera.transform.up, Camera.main.transform.localPosition, rotateCamera.AddAngle * rotateCamera.Turns, Vector3.Distance(rotateCamera.transform.position, Camera.main.transform.position));
    }
Пример #4
0
    /// <summary>
    /// 实例化摄像机
    /// </summary>
    /// <param name="trans"></param>
    private void InitCamera(Transform trans)
    {
        mainCamera           = GameObject.Find("Main Camera");
        mainCameraController = mainCamera.GetComponent <MainCameraController>();
        mainCameraController.SetFollower(trans);

        rotateCamera           = GameObject.Find("RotateCamera");
        rotateCameraController = rotateCamera.GetComponent <RotateCamera>();
        rotateCamera.SetActive(false);
    }
Пример #5
0
 private void Rotate(bool clockwise)
 {
     if (animationFinished)
     {
         var rotate = new RotateCamera(cam, clockwise);
         requestResponse = Response.Allow;
         player.facing   = Direction.FromAngle(rotate.destRot);
         camAnim         = rotate;
     }
 }
Пример #6
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;
     }
 }
Пример #7
0
    private IEnumerator CoveringAction()
    {
        while (true)
        {
            timeUnderCovering = 0f;

            while (!isCovering)                                                                                                                                                  //Цикл выполняется, пока игрок не укрыт одеялом
            {
                if (staminaPresentValue != _staminaMaxValue)                                                                                                                     //Операции в условии выполняются, если выносливость была потрачена
                {
                    staminaPresentValue = Mathf.Clamp((staminaPresentValue += (Time.fixedDeltaTime / regenerationStaminaDebuffCoefficient)), staminaMinValue, _staminaMaxValue); //Восстановление выносливости до заданных пределов
                    ButtonFillAmount();
                }
                yield return(new WaitForFixedUpdate());
            }

            canUseButton = !canUseButton;                //Запрещаем нажатие кнопки
            animator.SetBool(conditionName, isCovering); //Проигрываем анимацию покрывала
            coveringSound.Play();

            RotateCamera.StopRotate();
            CamAnimation.CoveringEffect();
            yield return(new WaitForSeconds(animationCoveringDuration)); //Приостанавливаем на время действия анимации покрывала

            canUseButton = !canUseButton;
            while (isCovering)                //Цикл выполняется, пока игрок укрыт одеялом
            {
                if (staminaPresentValue <= 0) //Если стамина падает ниже нуля, прерываем цикл
                {
                    isCovering = !isCovering;
                }
                staminaPresentValue -= Time.fixedDeltaTime; //Отнимаем стамину
                timeUnderCovering   += Time.fixedDeltaTime; //Просчитываем, сколько времени игрок находится под одеялом
                ButtonFillAmount();
                yield return(new WaitForFixedUpdate());
            }
            canUseButton = !canUseButton;                //Запрещаем нажатие кнопки,
            animator.SetBool(conditionName, isCovering); //И проигрываем
            coveringSound.Play();

            CamAnimation.CoveringEffectReverse();                        //Также проигрываем анимацию обратного движения камеры
            yield return(new WaitForSeconds(animationCoveringDuration)); //Пока проигрывается анимация движения камеры, запрещено ее поворачивать

            RotateCamera.StartRotate();                                  //Разрешаем камере двигаться

            yield return(new WaitForSeconds(remainingTime));             //Ожидание делается для того, чтобы игрок не мог постоянно нажимать на кнопку активации, тем самым, мешая логике аниматора

            canUseButton = !canUseButton;                                //Разрешаем нажатие кнопки
        }
    }
    /// <summary>
    /// Start this instance.
    /// </summary>
    void Start()
    {
        /// RTS camera init
        CameraComponent camera       = new CameraComponent(this.gameObject);
        ZoomCamera      zoomCamera   = new ZoomCamera(camera, zoomMin, zoomMax, zoomSpeed);
        RotateCamera    rotateCamera = new RotateCamera(zoomCamera, rotateSpeed);
        FreeCamera      freeCamera   = new FreeCamera(rotateCamera, minX, minZ, maxX, maxZ, movementSpeed);

        rtsCamera = new SelectionFrameCamera(freeCamera, selection_frame);

        /// Follow camera init
        orbitalCamera = new OrbitalCamera(zoomCamera, rotateSpeed);
        followCamera  = new FollowCamera(orbitalCamera, followDampTime);

        currentCamera = rtsCamera;
    }
Пример #9
0
    void Update()
    {
        if (isStartUpdate)
        {
            if (!initDone)
            {
                return;
            }

            if (webCamTexture.didUpdateThisFrame)
            {
                frameImage = new Mat(webCam_height, webCam_width, CvType.CV_8UC3);
                Utils.webCamTextureToMat(webCamTexture, frameImage);

                                #if UNITY_EDITOR
                                #elif UNITY_IPHONE
                RotateCamera.rotate(ref frameImage);
                                #endif

                texture.Resize(frameImage.cols(), frameImage.rows());
                Utils.matToTexture2D(frameImage, texture);
            }
        }
    }
Пример #10
0
 void Start()
 {
     initialPosX      = transform.position.x;
     _player          = GameObject.FindGameObjectWithTag("Player");
     compRotateCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <RotateCamera>();
 }
Пример #11
0
 public static void MenShaking()  //Тряска камеры при появлении монстра Men
 {
     RotateCamera.SetDefaultTransform();
     screamerLight.enabled = true; //Включаем свет,специально созданный для скримеров
     anim.Play(cameraMenShakingName);
 }
    public bool isStart;// the first of the tutorial frame

    public void Start()
    {
        if (isStart && playTutorial())
        {
            Destroy(gameObject);
            return;
        }
        camScript = m_Camera.GetComponent <RotateCamera>();
        if (lockCamera)
        {
            camScript.inTutorial = true;
        }
        else
        {
            camScript.inTutorial = false;
        }
        pScript = player.gameObject.GetComponent <playerControllerCopy>();

        if (pScript == null)
        {
            Debug.Log("could not find");
        }


        if (isLookTutorial)
        {
            Invoke("setTextActive", 0.2f);
            Invoke("setTargetActive", 0.2f);
            setLookTutorial();
            StartCoroutine("lookTutorial");

            //OnDrawGizmosSelected();
        }
        if (isMoveTutorial)
        {
            Invoke("setTextActive", 0.2f);
            setMoveTutorial();
            StartCoroutine("moveTutorial");
        }
        if (isLightTutorial)
        {
            Invoke("setTextActive", 0.2f);
            setLightTutorial();
            StartCoroutine("lightTutorial");
        }
        if (isIntermmediate)
        {
            Invoke("setTextActive", 0.2f);
            setIntermediatePhase();
            StartCoroutine("intermeddiatePhase");
        }
        if (isIntermmediateUnLock)
        {
            Invoke("setTextActive", 0.2f);
            setIntermediatePhaseUnlock();
            StartCoroutine("intermeddiatePhase");
        }


        if (isInfoTutorial)
        {
            Invoke("setTextActive", 0.2f);
            Invoke("setTargetActive", 0.2f);
            setInfoTutorial();
            StartCoroutine("infoPhase");
        }
        if (isLookTargetTutorial)
        {
            setLookTargetTutorial();
            Invoke("lookAtTarget", 0.2f);
            StartCoroutine("lookTargetPhase");
        }
        if (isMonsterTut)
        {
            Invoke("setTextActive", 0.2f);
            setInfoTutorial();
            StartCoroutine("monsterTutPhase");
        }
    }
Пример #13
0
 // Start is called before the first frame update
 private void Awake()
 {
     Singleton = this;
     Depth     = Mathf.Abs(transform.position.z);
 }
Пример #14
0
 public static void HandShaking()  //Тряска камеры при появлении скримера монстра Hand
 {
     RotateCamera.SetDefaultTransform();
     screamerLight.enabled = true;
     anim.Play(cameraHandShakingName);
 }
Пример #15
0
	void Awake()
	{
		rotateCam = Camera.main.transform.GetComponent<RotateCamera>();
	}
Пример #16
0
 void Start()
 {
     StartBattle();
     currentRound = 0;
     cameraScript = GameObject.FindGameObjectWithTag("MainCamPoint").GetComponent<RotateCamera>();
     guiScript = GameObject.FindGameObjectWithTag("GUIData").GetComponent<CharacterGUI>();
 }
Пример #17
0
    // Initialization.
    void Start()
    {
        if (gameBoard.ny <= startHeight){
            throw new Exception("Start height has to be ny - 1");
        }

        pass = 0;
        timer = startTimer;
        shapeMove=0;

        transparentMaterial = (Material)Resources.LoadAssetAtPath("Assets/Materials/ShadowMaterial.mat", typeof(Material));
        RedMaterial = (Material)Resources.LoadAssetAtPath("Assets/Materials/RedBlock.mat", typeof(Material));
        GreenMaterial = (Material)Resources.LoadAssetAtPath("Assets/Materials/GreenBlock.mat", typeof(Material));
        BlueMaterial = (Material)Resources.LoadAssetAtPath("Assets/Materials/BlueBlock.mat", typeof(Material));
        YellowMaterial = (Material)Resources.LoadAssetAtPath("Assets/Materials/YellowBlock.mat", typeof(Material));

        cameraScript = GameObject.Find("Main Camera").GetComponent<RotateCamera>();
    }
Пример #18
0
 void Start()
 {
     direction = new Vector3();
     cam       = Camera.main;
     rotate    = cam.GetComponent <RotateCamera>();
 }
Пример #19
0
 public static void CoveringEffect()
 {
     RotateCamera.SetDefaultTransform();
     anim.Play(cameraCoveringEffectName);
 }
Пример #20
0
 public static void StickmanShaking()  //Тряска камеры при появлении скримера монстра Stickman
 {
     RotateCamera.SetDefaultTransform();
     anim.Play(cameraStickmanShakingName);
 }