Exemple #1
0
    private void Fire()
    {
        //쎼이크 효과 호출
        StartCoroutine(shake.ShakeCamera(0.1f, 0.1f, 0.2f));
        //Bullet 프리팹을 동적으로 생성
        //Instantiate(bullet, firePos.position, firePos.rotation);
        var _bullet = GameManager.instance.GetBullet();

        if (_bullet != null)
        {
            _bullet.transform.position = firePos.position;
            _bullet.transform.rotation = firePos.rotation;
            _bullet.SetActive(true);
        }
        //탄피 파티클 실행
        cartridge.Play();

        //총구 화염 파티클 실행
        muzzleFlash.Play();

        //사운드 발생
        // FireSfx();


        //재장전 이미지의 fillAmount 속성값 지정
        magazineImg.fillAmount = (float)remainingBullet / (float)maxBullet;
        //남은 총알 수 갱신
        UpdateBulletText();
    }
Exemple #2
0
    void Fire()
    {
        StartCoroutine(shake.ShakeCamera());
        //Instantiate(bullet, firePos.position, firePos.rotation);

        var _bullet = GameManager.instance.GetBullet();

        if (_bullet != null)
        {
            _bullet.transform.position = firePos.position;
            _bullet.transform.rotation = firePos.rotation;
            _bullet.SetActive(true);
        }

        cartridge.Play();
        muzzleFlash.Play();
        FireSfx();

        magazineImg.fillAmount = (float)remainingBullet / (float)maxBullet;
        UpdateBulletText();

        /*
         *
         * Instantiate<GameObject>(bullet, firePos.position, firePos.rotation);
         * Instantiate<GameObject>(bullet, firePos.position, firePos.rotation, null);
         * Instantiate<GameObject>(bullet, firePos);
         * Instantiate<GameObject>(bullet, firePos, false);
         *
         *
         */
    }
Exemple #3
0
    //폭발 효과 처리 함수
    void ExpBarrel()
    {
        GameObject effect = Instantiate(expEffect, transform.position, Quaternion.identity);

        //(삭제 대상, 딜레이 시간)
        Destroy(effect, 2.0f);

        //Quaternion.identity -> 무회전
        //Instantiate(gameObject, transform.position, Quaternion.identity);

        //무게(mass)를 가볍게 해서
        //rb.mass = 1.0f;
        //위로 떠오르게 힘을 가함
        //rb.AddForce(Vector3.up * 1000.0f);

        //폭발력 생성
        IndirectDamage(transform.position);

        //난수 발생
        int idx = Random.Range(0, meshes.Length);

        //찌그러진 메쉬 적용
        meshFilter.sharedMesh = meshes[idx];
        GetComponent <MeshCollider>().sharedMesh = meshes[idx];

        //폭발음 적용
        _audio.PlayOneShot(expSfx, 1.0f);

        StartCoroutine(shake.ShakeCamera());
    }
Exemple #4
0
    // 폭발 효과를 처리할 함수
    void ExpBarrel()
    {
        // 폭발 효과 프리팹을 동적으로 생성
        GameObject effect = Instantiate(expEffect, transform.position, Quaternion.identity);

        Destroy(effect, 2.0f);

        // Rigidbody 컴포넌트의 mass를 1.0으로 수정해 무게를 가볍게 함
        //rb.mass = 1.0f;
        // 위로 솟구치는 힘을 가함
        //rb.AddForce(Vector3.up * 1000.0f);

        // 폭발력 생성
        IndirectDamage(transform.position);


        // 난수를 발생
        int idx = Random.Range(0, meshes.Length);

        // 찌그러진 매쉬를 적용
        meshFilter.sharedMesh = meshes[idx];
        GetComponent <MeshCollider>().sharedMesh = meshes[idx];

        // 폭발음 발생
        _audio.PlayOneShot(expSfx, 1.0f);

        // 셰이크 효과 호출
        StartCoroutine(shake.ShakeCamera(0.1f, 0.2f, 0.5f));
    }
 //When the ball collides the camera may shake
 void OnCollisionEnter(Collision collision)
 {
     if (m_CameraShake != null)
     {
         m_CameraShake.ShakeCamera(collision.relativeVelocity);
     }
 }
Exemple #6
0
    private void OnCollisionEnter(Collision other)
    {
        //충돌한 Collider의 태그가 BULLET이면 Player의 currHp차감
        if (other.gameObject.tag == AttackTag)
        {
            //혈흔 효과
            StartCoroutine(ShowBloodScreen());
            currHp -= 5f;
            print(currHp.ToString());
            GetComponent<PlayerCtrl>().HitDamage();
            GetComponent<FireCtrl>().HitDam();
            DisplayHpBar();
            shake.StartCoroutine(shake.ShakeCamera());

            //Player의 생명이 0이하면 Die처리
            if (currHp <= 0)
            {
                PlayerDie();                
                currHp = 0;
                lost.gameObject.SetActive(true);
                manager.MouseNone();
                
            }            
        }
       
    }
Exemple #7
0
    IEnumerator Action() //상태에 따라 행동처리하는 코루틴
    {
        while (!isDie)   //적이 사망하기 전까지 무한루프
        {
            yield return(ws);

            switch (state) //상태에 따른 분기
            {
            case State.STAY:
                moveAgent.Stop();
                animator.SetBool(hashMove, false);
                GameManager.instance.isBossAttack = false;
                break;

            case State.BORN:
                yield return(new WaitForSeconds(0.3f));

                moveAgent.Stop();
                animator.SetBool(hashMove, false);
                animator.SetTrigger(hashBorn);
                GetComponent <BoxCollider>().enabled = false;
                audio.PlayOneShot(RoarSfx, 3.0f);
                StartCoroutine(shake.ShakeCamera(3.0f, 0.4f, 0.2f));
                yield return(new WaitForSeconds(3.0f));

                isBorn = false;
                GetComponent <BoxCollider>().enabled = true;
                break;

            case State.TRACE:
                moveAgent.traceTarget = playerTr.position;
                animator.SetBool(hashMove, true);
                break;

            case State.ATTACK:
                moveAgent.Stop();
                animator.SetBool(hashMove, false);
                GameManager.instance.isBossAttack = true;
                animator.SetInteger(hashAttackIdx, UnityEngine.Random.Range(1, 5));
                AttackSound();
                animator.SetTrigger(hashAttack);
                yield return(new WaitForSeconds(1.0f));

                GameManager.instance.isBossAttack = false;
                nextAttack = Time.time + 1.5f;
                break;

            case State.DIE:
                isDie = true;
                moveAgent.Stop();
                animator.SetTrigger(hashDie);                 //사망 애니메이션 실행
                audio.PlayOneShot(DieSfx, 2.0f);
                GetComponent <BoxCollider>().enabled = false; //충돌 판정 비활성화
                break;
            }
        }
    }
Exemple #8
0
 void Fire()
 {
     // 셰이크 효과 호출
     StartCoroutine(shake.ShakeCamera());
     // Bullet 프리팹을 동적으로 생성
     Instantiate(bullet, firePos.position, firePos.rotation);
     // 파티클 실행
     cartridge.Play();
     // 총구 화염 파티클 실행
     muzzleFlash.Play();
     // 사운드 발생
     FireSfx();
 }
Exemple #9
0
    private void OnTriggerEnter(Collider coll)
    {
        if (coll.tag == bulletTag)
        {
            Destroy(coll.gameObject);

            currHP -= 5.0f;

            CheckHp();
            StartCoroutine(shake.ShakeCamera(0.05f, 0.1f, 0.15f));
        }
        else if (coll.tag == SpikeTag && GameManager.instance.isBossAttack == true)
        {
            currHP -= 15.0f;

            CheckHp();
            StartCoroutine(shake.ShakeCamera(0.05f, 0.2f, 0.2f));
        }

        if (currHP <= 0.0f)
        {
            PlayerDie();
        }
    }
Exemple #10
0
    void ExpBarrel()
    {
        _audio.PlayOneShot(expSfx);
        GameObject effect = Instantiate(expEffect,
                                        transform.position, Quaternion.identity);

        _renderer.material.mainTexture
            = textures[textures.Length - 1];
        OnFire();
        IndirectDamage(transform.position);
        Destroy(effect, 3.8f);
        int idx = Random.Range(0, meshes.Length);

        _meshFilter.sharedMesh = meshes[idx];
        //Destroy(this.gameObject, 10.0f);
        StartCoroutine(_shake.ShakeCamera(0.1f, 0.2f, 0.5f));
    }
Exemple #11
0
    void ExpBarrel()
    {
        GameObject effect = Instantiate(expEffect, transform.position, Quaternion.identity);

        Destroy(effect, 2.0f);

        //Instantiate(expEffect, transform.position, Quaternion.identity);
        //rb.mass = 1.0f;
        //rb.AddForce(Vector3.up * 1000.0f);
        IndirectDamage(transform.position);

        int idx = Random.Range(0, meshes.Length);

        meshFilter.sharedMesh = meshes[idx];
        GetComponent <MeshCollider>().sharedMesh = meshes[idx];
        _audio.PlayOneShot(expSfx, 1.0f);
        StartCoroutine(shake.ShakeCamera(0.1f, 0.2f, 0.5f));
    }
Exemple #12
0
    void ExpBarrel()                                                                         // 폭발효과 함수
    {
        GameObject effect = Instantiate(expEffect, transform.position, Quaternion.identity); // 폭발 효과 프리팹을 동적으로 생성

        Destroy(effect, 2.0f);                                                               // 2초 후 효과 삭제
        //rb.mass = 1.0f; // mass를 수정하여 무게를 가볍게 함
        //rb.AddForce(Vector3.up * 1000.0f); // 위로 솟구치는 힘을 가함

        IndirectDamage(transform.position);       // 폭발력 생성

        int idx = Random.Range(0, meshes.Length); // 난수 발생시킴

        meshFilter.sharedMesh = meshes[idx];      // 찌그러진 메쉬를 적용
        GetComponent <MeshCollider>().sharedMesh = meshes[idx];

        _audio.PlayOneShot(expSfx, 1.0f);                    // 폭발음 발생

        StartCoroutine(shake.ShakeCamera(0.1f, 0.2f, 0.5f)); // 셰이크 효과 호출
    }
Exemple #13
0
    void Fire()
    {
        StartCoroutine(_shake.ShakeCamera());
        //GameObject _bullet = Instantiate(bullet,
        //    firePos.position, firePos.rotation);
        //Destroy(_bullet, 3.0f);
        var _bullet = GameManager.instance.GetBullet();

        if (_bullet != null)
        {
            _bullet.transform.position = firePos.position;
            _bullet.transform.rotation = firePos.rotation;
            _bullet.SetActive(true);
        }
        muzzleFlash.Play();
        cartridge.Play();
        FireSfx();
        magazineImg.fillAmount = (float)remainingBullet /
                                 (float)maxBullet;
        UpdateBulletText();
    }
Exemple #14
0
    private void Fire()
    {
        StartCoroutine(shake.ShakeCamera());

        Instantiate(bullet, firePos.position, firePos.rotation);
        var _bullet = GameMgr.instance.GetBullet();

        if (_bullet != null)
        {
            _bullet.transform.position = firePos.position;
            _bullet.transform.rotation = firePos.rotation;
            _bullet.SetActive(true);
        }

        Cartridge.Play();
        MuzzleFlash.Play();
        FireSfx();

        magazineImg.fillAmount = (float)remainingBullet / (float)maxBullet;
        UpdateBulletText();
    }
Exemple #15
0
    // 폭발 효과를 처리할 함수
    void ExpBarrel()
    {
        // 폭발 효과 프리팹을 동적으로 생성
        Instantiate(expEffect, transform.position, Quaternion.identity);
        //Destroy(expEffect, 2.0f);

        // 폭발력 생성
        IndirectDamage(transform.position);

        // 난수를 발생
        int idx = Random.Range(0, meshes.Length);

        // 찌그러진 메쉬를 적용
        meshFilter.sharedMesh = meshes[idx];
        // 콜라이더 변경
        GetComponent <MeshCollider>().sharedMesh = meshes[idx];

        // 폭발음 발생
        _audio.PlayOneShot(expSfx, 1.0f);

        // 셰이크 효과 호출
        StartCoroutine(shake.ShakeCamera(0.1f, 0.2f, 0.5f));
    }
Exemple #16
0
    void Fire()
    {
        //Shake 효과 호출
        StartCoroutine(shake.ShakeCamera());
        //bullet 프리팹을 동적으로 생성
        //Instantiate(bullet, firePos.position, firePos.rotation);
        var _bullet = GameManager.instance.GetBullet();

        if (_bullet != null)
        {
            _bullet.transform.position = firePos.position;
            _bullet.transform.rotation = firePos.rotation;
            _bullet.SetActive(true);
        }
        //파티클 실행
        cartridge.Play();
        muzzleFlash.Play();
        //사운드 발생
        FireSfx();

        magazineImg.fillAmount = (float)remainingBullet / (float)maxBullet;
        UpdateBulletText();
    }
Exemple #17
0
    //폭발 효과를 처리할 함수
    void ExpBarrel()
    {
        //폭발 효과 프리팹을 동적으로 생성
        GameObject effect = Instantiate(expEffect, transform.position, transform.rotation);

        Destroy(effect, 0.2f);
        //Rigidbody 컴포턴트의 mass를 1.0으로 수정해 무게를 가볍게 함
        rb.mass = 1.0f;
        //위로 숫구치는 힘을 가함
        rb.AddForce(Vector3.up * 1000.0f);

        //폭발력 생성
        IndirectDamage(transform.position);

        //난수 발생
        int idx = Random.Range(0, meshes.Length);

        //찌그러진 메쉬를 적용
        meshFilter.sharedMesh = meshes[idx];

        //폭발음 발생
        _audio.PlayOneShot(expSfx, 1.0f);
        StartCoroutine(shake.ShakeCamera(0.1f, 0.2f, 0.5f));
    }
Exemple #18
0
 public void Launch()
 {
     voice = GameObject.FindGameObjectWithTag("Sound").GetComponent <SoundManager>();
     if (id == 0)
     {
         Enable(Constants.GetLine("student", lang) + " 3", Constants.GetLine("invocation0", lang), voice.sounds["invoCthulhu"]);
     }
     else if (id == 1)
     {
         shake.ShakeCamera();
         Enable(Constants.GetLine("student", lang) + " 1", Constants.GetLine("invocation1", lang), voice.sounds["invocation1"]);
     }
     else if (id == 2)
     {
         Enable(Constants.GetLine("student", lang) + " 2", Constants.GetLine("invocation2", lang), voice.sounds["invocation2"]);
     }
     else if (id == 3)
     {
         reiSr.enabled = true;
         Enable(Constants.GetLine("student", lang) + " 3", Constants.GetLine("invocation3", lang), voice.sounds["invocation3"]);
     }
     else if (id == 4)
     {
         flash.FlashPanel();
         reiSr.enabled = false;
         Enable(Constants.GetLine("student", lang) + " 2", Constants.GetLine("invocation4", lang), voice.sounds["invocation4"]);
     }
     else if (id == 5)
     {
         Enable(Constants.GetLine("student", lang) + " 1", Constants.GetLine("invocation5", lang), voice.sounds["invocation5"]);
     }
     else if (id == 6)
     {
         Enable(Constants.GetLine("student", lang) + " 3", Constants.GetLine("invocation6", lang), voice.sounds["invocation6"]);
     }
     else if (id == 7)
     {
         Enable("Tsuma", Constants.GetLine("invocation7", lang), voice.sounds["invocation7"]);
     }
     else if (id == 8)
     {
         SceneManager.LoadScene("Main");
     }
     else if (id == 100)
     {
         Enable("Tsuma", Constants.GetLine("ending1", lang), voice.sounds["end0"]);
     }
     else if (id == 101)
     {
         Enable("Rei", Constants.GetLine("ending2", lang), voice.sounds["end1"]);
     }
     else if (id == 102)
     {
         Enable("Rei", Constants.GetLine("ending3", lang), voice.sounds["end2"]);
     }
     else if (id == 103)
     {
         Enable("Rei", Constants.GetLine("ending3", lang), voice.sounds["end3"]);
         GameObject go = new GameObject("GameOverManager", typeof(GameOverManager));
         go.GetComponent <GameOverManager>().type = GameOverManager.EndType.Victory;
         SceneManager.LoadScene("Ending");
     }
     id++;
 }