private void Update()
    {
        if (m_PlayerGun == null)
        {
            return;
        }

        if (m_PlayerManager.IsPlayerLoaded() == false)
        {
            return;
        }

        if (m_PlayerManager.IsInteractable() == false)
        {
            return;
        }

        if (m_PlayerManager.IsUltimatable() == false)
        {
            return;
        }



        GunCoreCharging gunCoreCharging = m_PlayerGun.GetCore <GunCoreCharging>();

        if (Input.GetKeyDown(KeyCode.LeftAlt) && m_PlayerGun.IsUltimateEnabled())
        {
            if (m_PlayerManager.GetPlayerGun()?.IsUltimateEnabled() == false)
            {
                return;
            }

            if (m_PlayerManager.GetPlayerUltimateCount() <= 0)
            {
                return;
            }

            if (GameObject.FindGameObjectsWithTag("PlayerUltimate")?.Length >= 1)
            {
                return;
            }

            if (gunCoreCharging == null)
            {
                FireUltimate();
            }
            else
            {
                if (gunCoreCharging.IsChargingFiring() == false && gunCoreCharging.IsCharging() == false)
                {
                    FireUltimate();
                }
            }
        }
    }
Ejemplo n.º 2
0
    private void OnDestroy()
    {
        if (m_PlayerGun == null)
        {
            return;
        }

        GunCoreCharging playerGunCoreCharging = m_PlayerGun.GetCore <GunCoreCharging>();

        if (playerGunCoreCharging.IsCharging() == true)
        {
            ParticleFactory.GetInstance().DeleteParticle(this);
        }
    }
Ejemplo n.º 3
0
    private IEnumerator VulcanChargingFire(GunCoreCharging playerGunCoreCharging, int vulcanLevel, float chargingPercent)
    {
        int   bulletCount      = (int)(vulcanLevel * 17.0f * chargingPercent / 100.0f);
        float leftStartDegree  = Random.Range(-3.0f * bulletCount / 2, -3.0f);
        float rightStartDegree = Random.Range(3.0f, 3.0f * bulletCount / 2);

        for (int i = 0; i < bulletCount; i++)
        {
            Instantiate(m_VulcanBullet, m_FireTransforms[0].position, Quaternion.Euler(0, 0, leftStartDegree + 3.0f * i));
            Instantiate(m_VulcanBullet, m_FireTransforms[0].position, Quaternion.Euler(0, 0, rightStartDegree - 3.0f * i));
            yield return(new WaitForSeconds(0.1f));
        }

        playerGunCoreCharging.SetIsChargingFiring(false);

        yield return(null);
    }
Ejemplo n.º 4
0
    private void VariableInit()
    {
        m_PlayerManager = ManagerPool.GetInstance().GetManager <PlayerManager>();

        //쿨탐 초기화
        m_PlayerGun = m_PlayerManager.GetPlayerGun();
        m_PlayerGun.SetCurrentBulletFiringTime(0.0f);


        GunCoreCharging charging = m_PlayerGun.GetCore <GunCoreCharging>();

        if (charging != null)
        {
            charging.SetIsChargingFull(false);
            charging.SetIsChargingFiring(false);
            charging.SetIsCharging(false);
            charging.SetChargingTime(0.0f);
        }
    }
Ejemplo n.º 5
0
    private void EquipDefaultWeapon()
    {
        GunCoreCharging gunCoreCharging = new GunCoreCharging();

        gunCoreCharging
        .SetChargingEnable(true)
        .SetChargingTime(0.0f)
        .SetMaxChargingTime(3.0f);


        GunCoreBooster gunCoreBooster = new GunCoreBooster();

        gunCoreBooster
        .SetBoosterEnabled(true);

        m_PlayerGun = new GunVulcan(1);
        m_PlayerGun.RegisterCore(gunCoreCharging);
        m_PlayerGun.RegisterCore(gunCoreBooster);
    }
Ejemplo n.º 6
0
    void Update()
    {
        if (m_PlayerGun == null)
        {
            return;
        }

        if (m_PlayerManager.IsPlayerLoaded() == false)
        {
            return;
        }

        if (m_PlayerManager.IsInteractable() == false)
        {
            return;
        }

        if (m_PlayerManager.IsShootable() == false)
        {
            return;
        }

        m_PlayerGun.SetCurrentBulletFiringTime(m_PlayerGun.GetCurrentBulletFiringTime() + Time.deltaTime);
        if (m_PlayerGun.GetCurrentBulletFiringTime() >= m_PlayerGun.GetBulletFiringDelay())
        {
            m_PlayerGun.SetFireEnabled(true);
        }

        bool hasGunChargingCore = m_PlayerGun.HasCore <GunCoreCharging>();

        if (Input.GetKeyDown(KeyCode.LeftControl))
        {
            m_CurrentRecognizingPressedTime += Time.deltaTime;
            if (m_PlayerGun.IsFireEnabled())
            {
                if (hasGunChargingCore == false)
                {
                    FireBullet();
                }
                else
                {
                    GunCoreCharging playerGunCoreCharging = m_PlayerGun.GetCore <GunCoreCharging>();

                    if (m_CurrentRecognizingPressedTime < m_MaxRecognizingPressedTime)
                    {
                        FireBullet();
                    }
                }
            }
        }
        else if (Input.GetKey(KeyCode.LeftControl))
        {
            m_CurrentRecognizingPressedTime += Time.deltaTime;
            if (m_PlayerGun.IsFireEnabled())
            {
                if (hasGunChargingCore == false)
                {
                    FireBullet();
                }
                else
                {
                    if (m_CurrentRecognizingPressedTime < m_MaxRecognizingPressedTime)
                    {
                        FireBullet();
                    }
                    else
                    {
                        GunCoreCharging playerGunCoreCharging = m_PlayerGun.GetCore <GunCoreCharging>();

                        if (playerGunCoreCharging.IsCharging() == false)
                        {
                            if (playerGunCoreCharging.IsChargingFiring() == false)
                            {
                                playerGunCoreCharging.SetIsCharging(true);
                                ParticleFactory.GetInstance().CreatePermanentParticle <ParticleCharging>(this, m_FireTransforms[(int)MainFireTransformPosition.Top].transform).Play();
                            }
                        }
                        else
                        {
                            if (playerGunCoreCharging.IsChargingFiring() == false)
                            {
                                playerGunCoreCharging.SetChargingTime(playerGunCoreCharging.GetChargingTime() + Time.deltaTime);
                                m_PointLight.intensity = 20.0f * playerGunCoreCharging.GetChargingTime() / playerGunCoreCharging.GetMaxCharingTime();;
                                m_PointLight.range     = 20.0f * playerGunCoreCharging.GetChargingTime() / playerGunCoreCharging.GetMaxCharingTime();;


                                //차징 게이지가 모두 찬 경우 차징풀 상태로 바꾼다.
                                if (playerGunCoreCharging.GetChargingTime() >= playerGunCoreCharging.GetMaxCharingTime())
                                {
                                    playerGunCoreCharging.SetIsChargingFull(true);
                                }

                                //차징이 다된 경우 파티클을 더이상 재생하지 않는다.
                                if (playerGunCoreCharging.IsChargingFull() && ParticleFactory.GetInstance().IsPlaying <ParticleCharging>(this) == true)
                                {
                                    ParticleFactory.GetInstance().DeleteParticle(this);
                                }
                            }
                        }
                    }
                }
            }
        }

        else if (Input.GetKeyUp(KeyCode.LeftControl))
        {
            if (hasGunChargingCore == false)
            {
                FireBullet();
            }
            else
            {
                GunCoreCharging playerGunCoreCharging = m_PlayerGun.GetCore <GunCoreCharging>();
                ParticleFactory.GetInstance().DeleteParticle(this);

                if (playerGunCoreCharging.IsCharging() == true)
                {
                    FireBullet();
                }
            }

            m_CurrentRecognizingPressedTime = 0.0f;
            m_PointLight.intensity          = 0.0f;
            m_PointLight.range = 0.0f;
        }
    }
Ejemplo n.º 7
0
    private void FireVulcanBullet()
    {
        GunVulcan       vulcanGun             = m_PlayerManager.GetPlayerGun() as GunVulcan;
        GunCoreCharging playerGunCoreCharging = vulcanGun.GetCore <GunCoreCharging>();

        if (vulcanGun is null)
        {
            throw new NullReferenceException("vulcanGun 오브젝트가 null입니다.");
        }

        //if (vulcanGun.GetPowerLevel() == 1)
        //{
        //    if (playerGunCoreCharging.IsCharging() == false && playerGunCoreCharging.IsChargingFiring() == false)
        //        Instantiate(m_VulcanBullet, m_FireTransforms[0].position, m_FireTransforms[0].rotation);
        //    else
        //    {
        //        float chargedPercent = playerGunCoreCharging.GetChargingTime() / playerGunCoreCharging.GetMaxCharingTime() * 100;


        //        playerGunCoreCharging.SetChargingTime(0.0f);
        //        playerGunCoreCharging.SetIsChargingFull(false);
        //        playerGunCoreCharging.SetIsCharging(false);
        //        playerGunCoreCharging.SetIsChargingFiring(true); //밑에 두면안된다. bulletCount가 0일 경우에 바로 m_IsChargingFiring값이 false로 되버리기 때문에 그 이후 true로 바껴버리면 담에 발사가 안됨

        //        StartCoroutine(VulcanChargingFire(playerGunCoreCharging, vulcanGun.GetPowerLevel(), chargedPercent));
        //    }
        //}


        if (playerGunCoreCharging.IsCharging() == false && playerGunCoreCharging.IsChargingFiring() == false)
        {
            if (vulcanGun.GetPowerLevel() == 1)
            {
                Instantiate(m_VulcanBullet, m_FireTransforms[0].position, m_FireTransforms[0].rotation);
            }
            else if (vulcanGun.GetPowerLevel() == 2)
            {
                Instantiate(m_VulcanBullet, m_FireTransforms[1].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[2].position, m_FireTransforms[0].rotation);
            }
            else if (vulcanGun.GetPowerLevel() == 3)
            {
                Instantiate(m_VulcanBullet, m_FireTransforms[0].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[1].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[2].position, m_FireTransforms[0].rotation);
            }
            else if (vulcanGun.GetPowerLevel() == 4)
            {
                Instantiate(m_VulcanBullet, m_FireTransforms[1].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[2].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[3].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[4].position, m_FireTransforms[0].rotation);
            }
            else if (vulcanGun.GetPowerLevel() == 5)
            {
                Instantiate(m_VulcanBullet, m_FireTransforms[0].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[1].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[2].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[3].position, m_FireTransforms[0].rotation);
                Instantiate(m_VulcanBullet, m_FireTransforms[4].position, m_FireTransforms[0].rotation);
            }
        }
        else
        {
            float chargedPercent = playerGunCoreCharging.GetChargingTime() / playerGunCoreCharging.GetMaxCharingTime() * 100;


            playerGunCoreCharging.SetChargingTime(0.0f);
            playerGunCoreCharging.SetIsChargingFull(false);
            playerGunCoreCharging.SetIsCharging(false);
            playerGunCoreCharging.SetIsChargingFiring(true); //밑에 두면안된다. bulletCount가 0일 경우에 바로 m_IsChargingFiring값이 false로 되버리기 때문에 그 이후 true로 바껴버리면 담에 발사가 안됨

            StartCoroutine(VulcanChargingFire(playerGunCoreCharging, vulcanGun.GetPowerLevel(), chargedPercent));
        }
        vulcanGun.SetCurrentBulletFiringTime(0.0f);
        vulcanGun.SetFireEnabled(false);
    }