コード例 #1
0
ファイル: GameManager.cs プロジェクト: snail15/GameDev
    IEnumerator RoundRoutine()
    {
        onReset.Invoke();

        readyPanel.SetActive(true);
        cam.SetTarget(canonPivoController.transform, CamFollow.State.Idle);
        canonPivoController.enabled = false;

        isRoundActive = false;

        messageText.text = "Ready!";

        yield return(new WaitForSeconds(3f));

        isRoundActive = true;
        readyPanel.SetActive(false);
        canonPivoController.enabled = true;
        cam.SetTarget(canonPivoController.transform, CamFollow.State.Ready);

        while (isRoundActive)
        {
            yield return(null);
        }

        readyPanel.SetActive(true);
        canonPivoController.enabled = false;

        UpdateUI();
        messageText.text = "Round Finished";

        yield return(new WaitForSeconds(3f));

        Reset();
    }
コード例 #2
0
    IEnumerator RoundRoutine()
    {
        onReset.Invoke();

        readyPannel.SetActive(true);

        cam.SetTarget(shooterRotator.transform, CamFollow.State.Idle);
        shooterRotator.enabled = false;

        isRoundActive    = false;
        messageText.text = "Ready...";

        yield return(new WaitForSeconds(3f));

        isRoundActive = true;
        readyPannel.SetActive(false);
        shooterRotator.enabled = true;
        cam.SetTarget(shooterRotator.transform, CamFollow.State.Ready);

        while (isRoundActive == true)
        {
            yield return(null);
        }

        readyPannel.SetActive(true);
        shooterRotator.enabled = false;

        yield return(new WaitForSeconds(3f));

        Reset();
    }
コード例 #3
0
    // 코루틴
    IEnumerator RoundRoutine()
    {
        onReset.Invoke();                                               // 이벤트 발생
        readyPanel.SetActive(true);                                     // 게임 준비 패널 보이기
        cam.SetTarget(shooterRotator.transform, CamFollow.State.Idle);  // 카메라 타겟, 상태 변경
        shooterRotator.enabled = false;                                 // 회전 스크립트 비활성화
        isRoundActive          = false;                                 // 라운드 시작 전
        messageText.text       = "Ready";                               // UI 텍스트 변경
        yield return(new WaitForSeconds(3f));                           // 3초 후 시작

        isRoundActive = true;                                           // 라운드 시작
        readyPanel.SetActive(false);                                    // 게임 준비 패널 숨기기
        shooterRotator.enabled = true;                                  // 회전 스크립트 활성화
        cam.SetTarget(shooterRotator.transform, CamFollow.State.Ready); // 카메라 타겟, 상태 변경
        while (isRoundActive == true)                                   // 라운드가 종료될 때 까지 무한 반복
        {
            yield return(null);
        }

        readyPanel.SetActive(true);                     // 게임 준비 패널 보이기
        shooterRotator.enabled = false;                 // 회전 스크립트 비활성화
        messageText.text       = "Wait for next round"; // UI 텍스트 변경
        yield return(new WaitForSeconds(3f));           // 3초 후 리셋

        Reset();                                        // 리셋
    }
コード例 #4
0
    IEnumerator RoundRoutine()
    {
        // 레디페이즈
        onReset.Invoke();
        messagePanel.SetActive(true);
        cam.SetTarget(shooterRotator.transform, CamFollow.State.Idle);
        shooterRotator.enabled = false;

        isRoundActive    = false;
        messageText.text = "Ready...";
        yield return(new WaitForSeconds(3.0f));


        // 플레이페이즈
        isRoundActive = true;
        messagePanel.SetActive(false);
        shooterRotator.enabled = true;
        cam.SetTarget(shooterRotator.transform, CamFollow.State.Ready);

        while (isRoundActive == true)
        {
            yield return(null);
        }


        // 엔드페이즈
        messagePanel.SetActive(true);
        shooterRotator.enabled = false;
        messageText.text       = "Wait For Next Round...";

        yield return(new WaitForSeconds(3.0f));

        Reset();
    }
コード例 #5
0
    // 발사
    private void Fire()
    {
        fired = true;
        Rigidbody ballinstance = Instantiate(ball, firePos.position, firePos.rotation);

        ballinstance.velocity = currentForce * firePos.forward;
        shootingAudio.clip    = fireClip;
        shootingAudio.Play();                                            // 발사 사운드 재생
        powerSlider.value = minForce;                                    // 게이지 초기화
        currentForce      = minForce;                                    // 힘 초기화
        cam.SetTarget(ballinstance.transform, CamFollow.State.Tracking); // 카메라 타겟, 상태 변경
    }
コード例 #6
0
    private void Fire()
    {
        fired = true;
        Rigidbody ballInstance = Instantiate(ball, firePos.position, firePos.rotation);

        ballInstance.velocity = currentForce * firePos.forward;
        shootingAudio.clip    = fireClip;
        shootingAudio.Play();

        currentForce = minForce;

        cam.SetTarget(ballInstance.transform, CamFollow.State.Tracking);
    }
コード例 #7
0
    private IEnumerator RoundRoutine()
    {
        //READY
        onReset.Invoke();

        readyPanel.SetActive(true);
        cam.SetTarget(shooterRotator.transform, CamFollow.State.Idle);
        shooterRotator.enabled = false;

        isRoundActive = false;

        messageText.text = "READY~!";

        yield return(new WaitForSeconds(3f));

        //PLAY
        isRoundActive = true;
        readyPanel.SetActive(false);
        shooterRotator.enabled = true;

        cam.SetTarget(shooterRotator.transform, CamFollow.State.Ready);

        while (isRoundActive)
        {
            yield return(null);
        }

        //END
        readyPanel.SetActive(true);
        shooterRotator.enabled = false;

        messageText.text = "Wait for next Round";

        yield return(new WaitForSeconds(3f));

        Reset();
    }
コード例 #8
0
ファイル: BallShooter.cs プロジェクト: hownk/Bomb_Unity
    private void Fire() // 발사 기능
    {
        // 볼 프리팹 생성 후 전방벡터에 Force를 곱해주어 날려보낸다.
        // 발사 오디오 플레이 후 일부 값은 초기화
        fired = true;
        Rigidbody ballInstance = Instantiate(ball, firePosition.position, firePosition.rotation);

        ballInstance.velocity = currentForce * firePosition.forward;
        shootingAudio.clip    = fireClip;
        shootingAudio.Play();

        currentForce      = minForce;
        powerSlider.value = minForce;

        cam.SetTarget(ballInstance.transform, CamFollow.State.Tracking);
    }
コード例 #9
0
    private void Fire()
    {
        PowerSlider.enabled = true;
        Debug.Log("Fire!");
        isFired = true;

        Rigidbody canonBallInstance = Instantiate(CanonBall, FirePos.position, FirePos.rotation);

        canonBallInstance.velocity = _currentForce * FirePos.forward;
        ShootingAudio.clip         = FireClip;
        ShootingAudio.Play();

        _currentForce = MinForce;

        cam.SetTarget(canonBallInstance.transform, CamFollow.State.Tracking);
    }