Esempio n. 1
0
 void UsingCCtV()
 {
     if (Input.GetKeyDown(KeyCode.O))
     {
         if (enableCCTV) // 끄기
         {
             TPScharacterCtrl.playerState = originState;
             enableCCTV = false;
             for (int i = 2; i <= 5; i++)
             {
                 GameManagerParameter.Instance().cam[i].SetActive(false);
             }
         }
         else // 켜기
         {
             originState = TPScharacterCtrl.playerState;
             TPScharacterCtrl.playerState = TPScharacterCtrl.PLAYERSTATE.useCCTV;
             enableCCTV = true;
             for (int i = 2; i <= 5; i++)
             {
                 GameManagerParameter.Instance().cam[i].SetActive(true);
             }
         }
     }
 }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     Cursor.lockState = CursorLockMode.Locked;
     Cursor.visible   = false;
     instance         = this;
     OnOffUI("CanvasPlayerUI", true);
 }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (batteryTimer == 0)
        {
            batteryImgCast.sprite = batterImg[4];
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            if (onOff) // 끄기
            {
                flashLight.SetActive(false);
                onOff = false;
            }
            else if (onOff == false && batteryTimer < batteryLife) // 켜기
            {
                batteryImgCast = GameManagerParameter.Instance().canvas[1].transform.Find("battery").GetComponent <Image>();
                flashLight.SetActive(true);
                onOff = true;
            }
        }

        if (onOff)
        {
            SpendBatteryLife();
        }
    }
Esempio n. 4
0
    void UsingItem()
    {
        // cctv 설치
        if (grabItem == GRABITEM.cctv)
        {
            if (cctv.Count > 0 && delay == false)
            {
                if (Input.GetButton("Fire1"))
                {
                    Debug.Log("UsingItem " + cctv.Peek().tag);
                    cctvEA--;
                    cctvEAText.text = cctvEA.ToString() + " / 4";

                    GameObject temp = cctv.Dequeue();
                    temp.transform.parent      = null;
                    temp.transform.position    = gameObject.transform.position + new Vector3(0, 0.3f, 0);
                    temp.transform.eulerAngles = new Vector3(0, gameObject.transform.eulerAngles.y, 0); // 플레이어가 바라보고 있는 방향
                    (temp.transform.Find("Swivel").GetComponent("scr_camera_rotate") as MonoBehaviour).enabled = true;

                    // map에 표시
                    GameManagerParameter.Instance().itemRoot[1].transform.Find(temp.name).transform.position = temp.transform.position + new Vector3(0, 900, 0);
                    GameManagerParameter.Instance().itemRoot[1].transform.Find(temp.name).gameObject.SetActive(true);

                    temp.gameObject.tag = "cctv";

                    if (cctv.Count > 0)
                    {
                        cctv.Peek().SetActive(true);
                    }

                    delay = true;
                }
            }
        }

        // 플래쉬 라이트 건전지 충전
        {
            if (Input.GetKeyDown(KeyCode.K))
            {
                if (batteryEA >= 1)
                {
                    batteryEA--;
                    batteryEAText.text      = batteryEA.ToString() + " / 5";
                    FlashLight.batteryTimer = 0;
                }
            }
        }
    }
Esempio n. 5
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.M))
     {
         if (TPScharacterCtrl.playerState != TPScharacterCtrl.PLAYERSTATE.useMap) // 켜기
         {
             originState = TPScharacterCtrl.playerState;
             TPScharacterCtrl.playerState = TPScharacterCtrl.PLAYERSTATE.useMap;
             GameManagerParameter.Instance().cam[6].SetActive(true);
         }
         else // 끄기
         {
             TPScharacterCtrl.playerState = originState;
             GameManagerParameter.Instance().cam[6].SetActive(false);
         }
     }
 }
Esempio n. 6
0
    // delay가 걸릴 경우 아이템을 줍지 못한다.
    void GetItem(Collider Object)
    {
        if (Input.GetKeyDown(KeyCode.F))
        {
            if (delay == false)
            {
                if (Object.gameObject.tag == "cctv")
                {
                    cctvEA++;
                    cctvEAText.text = cctvEA.ToString() + " / 4";
                    (Object.transform.Find("Swivel").GetComponent("scr_camera_rotate") as MonoBehaviour).enabled = false;
                    Object.gameObject.SetActive(false);
                    Object.tag = Object.gameObject.name;
                    Object.transform.SetParent(GameManagerParameter.Instance().itemRoot[0].transform);
                    Object.transform.localPosition    = new Vector3(-0.037f, -0.154f, 0.456f);
                    Object.transform.localEulerAngles = Vector3.zero;
                    cctv.Enqueue(Object.gameObject);

                    GameManagerParameter.Instance().itemRoot[1].transform.Find(Object.name).gameObject.SetActive(false); // map에서 지움

                    if (cctvEA == 1 && TPScharacterCtrl.playerState == TPScharacterCtrl.PLAYERSTATE.itemIdle)
                    {
                        cctv.Peek().SetActive(true);
                    }
                }
                else if (Object.gameObject.tag == "battery")
                {
                    if (batteryEA < 5)
                    {
                        batteryEA++;
                        batteryEAText.text = batteryEA.ToString() + " / 5";
                    }
                }
                else if (Object.gameObject.tag == "flarebullet")
                {
                    if (flareGunEA < 5)
                    {
                        flareGunEA++;
                        flaregunEAText.text = flareGunEA.ToString() + " / 5";
                    }
                }
                delay = true;
            }
        }
    }
Esempio n. 7
0
    IEnumerator HeadShot()
    {
        headShotBulletTIme = true;
        //TPScharacterCtrl.playerAnimator.SetBool("isShoot", true);
        Cam.SetActive(true);
        GameManagerParameter.Instance().cam[0].SetActive(false); // main
        GameManagerParameter.Instance().cam[1].SetActive(false); // scope
        dollyCam.GetComponent <CinemachineVirtualCamera>().Priority           = 10;
        dollyCam.GetComponent <CinemachineVirtualCamera>().m_Lens.FieldOfView = 45;
        dollyCam.SetActive(true);
        dollyCam2.SetActive(true);
        dollyCam.GetComponent <CinemachineVirtualCamera>().LookAt  = bullet.transform;
        dollyCam2.GetComponent <CinemachineVirtualCamera>().LookAt = bullet.transform;
        dollyCam2.GetComponent <CinemachineVirtualCamera>().Follow = bullet.transform.Find("followTarget");

        dollyCam.GetComponent <PlayableDirector>().Play();
        ExcuteSlow(0.0001f);
        yield return(new WaitForSecondsRealtime(2.3f));

        // 100M 헤드샷
        if (Zoom.distance <= 200)
        {
            ExcuteSlow(0.05f);
            Time.fixedDeltaTime = 0.02F * Time.timeScale;
            dollyCam.GetComponent <CinemachineVirtualCamera>().m_Lens.FieldOfView = 2;
            yield return(new WaitForSecondsRealtime(5 + (Zoom.distance / 100) * 2.2f));

            Debug.Log("100m headshot");
        }
        else // 200미터 이상
        {
            dollyCam.GetComponent <CinemachineVirtualCamera>().Priority = 7;
            yield return(new WaitForSecondsRealtime(0.4f));

            ExcuteSlow(0.05f);
            Time.fixedDeltaTime = 0.02F * Time.timeScale;
            yield return(new WaitForSecondsRealtime(8.0f + (Zoom.distance / 100) * 2.2f));
        }
        // 초기화
        ExcuteSlow(1); Time.fixedDeltaTime = 0.02F * Time.timeScale;
        GameManagerParameter.Instance().cam[1].SetActive(true); // scope
        dollyCam.SetActive(false);  dollyCam2.SetActive(false); Cam.SetActive(false);
        headShotBulletTIme = false;
    }
Esempio n. 8
0
    // UI , 플레이어 상태 관리
    void ControllPlayerState()
    {
        switch (playerState)
        {
        case PLAYERSTATE.gunIdle:
            GameManagerParameter.Instance().OnOffUI("CanvasPlayerUI", true);
            gameObject.GetComponent <Zoom>().enabled       = true;
            gameObject.GetComponent <Binoculars>().enabled = true;
            mouseSensitivityX = mouseSensitivityIdleX;
            mouseSensitivityY = mouseSensitivityIdleY;
            playerAnimator.SetBool("isIdle(item)", false);
            playerAnimator.SetBool("isIdle(gun)", true);
            break;

        case PLAYERSTATE.useBinoculars:
            gameObject.GetComponent <Zoom>().enabled = false;
            GameManagerParameter.Instance().OnOffUI("CanvasBinoculars", true);
            break;

        case PLAYERSTATE.useZoom:
            gameObject.GetComponent <Binoculars>().enabled = false;
            break;

        case PLAYERSTATE.itemIdle:
            GameManagerParameter.Instance().OnOffUI("CanvasPlayerUI", true);
            gameObject.GetComponent <Zoom>().enabled       = false;
            gameObject.GetComponent <Binoculars>().enabled = false;
            playerAnimator.SetBool("isIdle(item)", true);
            playerAnimator.SetBool("isIdle(gun)", false);
            break;

        case PLAYERSTATE.useCCTV:
            GameManagerParameter.Instance().OnOffUI("CanvasCCTV", true);
            break;

        case PLAYERSTATE.useMap:
            gameObject.GetComponent <Zoom>().enabled       = false;
            gameObject.GetComponent <Binoculars>().enabled = false;
            break;
        }
    }