示例#1
0
 public void PlaySelectSound()
 {
     if (selectClip != null)
     {
         AudioInstance.PlayClipAtPoint(selectClip, Vector3.zero);
     }
 }
示例#2
0
    public float Raise(Vector3 position, Quaternion rotation, Vector3 scale, Transform parent = null)
    {
        float fxTime = 0;

        if (sfx != null)
        {
            AudioInstance.PlayClipAtPoint(sfx, position, outputMixer, pitchRange);
            fxTime = sfx.length;
        }

        foreach (GameObject visualFX in visualFX)
        {
            GameObject instance = FXPool.getFXObject(visualFX, poolSize);
            instance.transform.position = position;
            instance.transform.rotation = rotation;
            instance.transform.SetParent(parent);
            instance.transform.localScale = scale;
            instance.SetActive(true);
            VisualFX vFX = instance.GetComponent <VisualFX>();
            if (vFX != null)
            {
                if (fxTime < vFX.displayTime)
                {
                    fxTime = vFX.displayTime;
                }
                vFX.Play();
            }
        }
        return(fxTime);
    }
示例#3
0
    void SelectGameObject(GameObject target)
    {
        if (selectedGameObject != null)
        {
            Animator[]      animators       = selectedGameObject.GetComponentsInChildren <Animator>();
            ButtonAnimation buttonAnimation = selectedGameObject.GetComponent <ButtonAnimation>();
            for (int i = 0; i < animators.Length; i++)
            {
                animators[i].SetTrigger("exit");
            }
            if (buttonAnimation != null)
            {
                buttonAnimation.ChangeState(ButtonAnimation.state.Idle);
            }
        }

        if (highlightClip != null)
        {
            AudioInstance.PlayClipAtPoint(highlightClip, Vector3.zero);
        }

        selectedGameObject = target;
        if (target != null)
        {
            rt.SetParent(target.transform);
            rt.anchoredPosition = Vector2.zero;

            AnimatedButton animatedButton = selectedGameObject.GetComponent <AnimatedButton>();
            if (animatedButton != null)
            {
                animatedButton.Select();
            }
            else if (target.GetComponent <IPointerClickHandler>() != null)
            {
                Animator[] animators = target.GetComponentsInChildren <Animator>();
                for (int i = 0; i < animators.Length; i++)
                {
                    animators[i].SetTrigger("enter");
                }
            }
        }
        else
        {
            transform.position = new Vector2(-5000, -5000);
        }
    }
示例#4
0
    public void Raise(Vector3 position, out AudioSource audioSource, out GameObject[] vfx)
    {
        if (sfx != null)
        {
            if (loopSFX)
            {
                audioSource = AudioInstance.LoopClipAtPoint(sfx, position, outputMixer, pitchRange);
            }
            else
            {
                AudioInstance.PlayClipAtPoint(sfx, position, outputMixer, pitchRange);
                audioSource = null;
            }
        }
        else
        {
            audioSource = null;
        }

        vfx = new GameObject[visualFX.Length];
        for (int i = 0; i < visualFX.Length; i++)
        {
            GameObject visualfx = visualFX[i];
            GameObject instance = FXPool.getFXObject(visualfx, poolSize);
            instance.transform.position = position;
            instance.transform.rotation = visualfx.transform.rotation;
            instance.transform.SetParent(null);
            instance.transform.localScale = Vector3.one;
            instance.SetActive(true);
            VisualFX vFX = instance.GetComponent <VisualFX>();
            if (vFX != null)
            {
                vFX.Play();
            }
            vfx[i] = instance;
        }
    }