Ejemplo n.º 1
0
    public void createStar()
    {
        GameObject newStar = GameObject.Instantiate(starPrefab, starCreationPoint.position, Quaternion.identity);

        newStar.transform.parent = transform.parent;
        PaperThiefStar newStarComponent = newStar.GetComponent <PaperThiefStar>();

        if (_sineWave.enabled)
        {
            if (transform.localPosition.y < 1.5f)
            {
                newStarComponent.forceAngleDirection = -1f;
            }
            else if (transform.localPosition.x < -.5f)
            {
                newStarComponent.forceAngleDirection = 1f;
            }
        }
        newStarComponent.makeAppearSound = false;
        //newStarComponent.forceAngleDirection = _sineWave.enabled ? (transform.position.y > 0f ? -1f : 1f) : 0f;

        sfxSource.pitch     = Time.timeScale;
        sfxSource.panStereo = AudioHelper.getAudioPan(transform.position.x) / 1.5f;
        sfxSource.PlayOneShot(starSpawnClip);
    }
Ejemplo n.º 2
0
    public void createStar()
    {
        GameObject newStar = GameObject.Instantiate(starPrefab, starCreationPoint.position, Quaternion.identity);

        newStar.transform.parent = transform.parent;
        PaperThiefStar newStarComponent = newStar.GetComponent <PaperThiefStar>();

        if (_sineWave.enabled)
        {
            if (transform.localPosition.y < 1.5f)
            {
                newStarComponent.forceAngleDirection = -1f;
            }
            else if (transform.localPosition.x < -.5f)
            {
                newStarComponent.forceAngleDirection = 1f;
            }
        }
        //newStarComponent.forceAngleDirection = _sineWave.enabled ? (transform.position.y > 0f ? -1f : 1f) : 0f;
    }