示例#1
0
    public void SpawnVFX()
    {
        GameObject vfx;

        if (cameraShake && cameras != null)
        {
            cameras.GetComponent <CameraShakeSimpleScript> ().ShakeCamera();
        }

        if (firePoint != null)
        {
            vfx = Instantiate(effectToSpawn, firePoint.transform.position, Quaternion.identity);
            if (rotateToMouse != null)
            {
                vfx.transform.localRotation = rotateToMouse.GetRotation();
            }
            else
            {
                Debug.Log("No RotateToMouseScript found on firePoint.");
            }
        }
        else
        {
            vfx = Instantiate(effectToSpawn);
        }

        var ps = vfx.GetComponent <ParticleSystem> ();

        if (vfx.transform.childCount > 0)
        {
            ps = vfx.transform.GetChild(0).GetComponent <ParticleSystem> ();
        }
    }
示例#2
0
    public void SpawnVFX()
    {
        GameObject vfx;

        var cameraShakeScript = cameras.GetComponent <CameraShakeSimpleScript> ();

        if (cameraShake && cameraShakeScript != null)
        {
            cameraShakeScript.ShakeCamera();
        }

        if (firePoint != null)
        {
            vfx = Instantiate(effectToSpawn, firePoint.transform.position, Quaternion.identity);
            if (!useTarget)
            {
                if (rotateToMouse != null)
                {
                    vfx.transform.localRotation = rotateToMouse.GetRotation();
                }
                else
                {
                    Debug.Log("No RotateToMouseScript found on firePoint.");
                }
            }
            else
            {
                if (target != null)
                {
                    vfx.GetComponent <ProjectileMoveScript>().SetTarget(target, rotateToMouse);
                    rotateToMouse.RotateToMouse(vfx, target.transform.position);
                }
                else
                {
                    Destroy(vfx);
                    Debug.Log("No target assigned.");
                }
            }
        }
        else
        {
            vfx = Instantiate(effectToSpawn);
        }
    }