예제 #1
0
    /// <summary>
    /// 이펙트를 리셋하는 함수
    /// </summary>
    private void ResetEffect()
    {
        if (isFirstShot)
        {
            transform.position = Vector3.zero;
            GAP_ParticleSystemController.ParticleSystemController customPsSystem = GetComponent <GAP_ParticleSystemController.ParticleSystemController>();

            if (customPsSystem != null)
            {
                for (int i = 0; i < customPsSystem.ParticleSystems.Count; i++)
                {
                    customPsSystem.ParticleSystems[i].transform.position = Vector3.zero;
                    customPsSystem.ParticleSystems[i].gameObject.SetActive(true);

                    if (customPsSystem.ParticleSystems[i].GetComponent <ParticleSystem>() != null)
                    {
                        customPsSystem.ParticleSystems[i].GetComponent <ParticleSystem>().Play();
                    }
                }
            }
            else
            {
                for (int i = 0; i < childEffect.Count; i++)
                {
                    childEffect[i].SetActive(true);

                    if (childEffect[i].GetComponent <ParticleSystem>() != null)
                    {
                        childEffect[i].GetComponent <ParticleSystem>().Play();
                    }
                }
            }
        }

        if (muzzlePrefab != null)
        {
            if (muzzleGO == null)
            {
                muzzleGO = Instantiate(muzzlePrefab, transform.position, Quaternion.identity, transform);
            }

            muzzleGO.SetActive(true);
            muzzleGO.transform.forward = gameObject.transform.forward + offset;
            ParticleSystem particleSys = muzzleGO.GetComponent <ParticleSystem>();

            if (particleSys != null)
            {
                particleSys.Play();
            }
            else
            {
                ParticleSystem psChild = muzzleGO.transform.GetChild(0).GetComponent <ParticleSystem>();
                psChild.Play();
            }
        }
    }
예제 #2
0
    /// <summary>
    /// 이펙트를 초기화하는 함수
    /// </summary>
    private void InitializeEffect()
    {
        if (childEffect == null && childEffect.Count < 0)
        {
            childEffect = new List <GameObject>();

            for (int i = 0; i < transform.childCount; i++)
            {
                childEffect.Add(transform.GetChild(i).gameObject);
            }
        }

        if (GetComponent <GAP_ParticleSystemController.ParticleSystemController>())
        {
            customPsSystem = GetComponent <GAP_ParticleSystemController.ParticleSystemController>();
        }
    }
예제 #3
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            ParticleSystemController psCtrl = (ParticleSystemController)target;

            if (GUILayout.Button("Fill Lists"))
            {
                psCtrl.FillLists();
            }
            if (GUILayout.Button("Empty Lists"))
            {
                psCtrl.EmptyLists();
            }
            if (GUILayout.Button("Apply"))
            {
                psCtrl.UpdateParticleSystem();
            }
            if (GUILayout.Button("Reset"))
            {
                psCtrl.ResetParticleSystem();
            }
        }