Play() public method

public Play ( ) : void
return void
コード例 #1
0
    public void ResetTutorial()
    {
        _currentStage = 1;
        ChangeSounds(_tutorialSounds[0], true);
        _chladniTalkBoard.Play();
        _welcomeSoundHasPlayed = true;
        int filelength = 14;

        _spotLightHandler.ChangeLight((SpotlightHandler.LightState)_currentStage, filelength);
        if (CompleteDelay > 0)
        {
            stageStartTime  = Time.time;
            readyToComplete = false;
        }
    }
コード例 #2
0
 public void DoScan()
 {
     transform.localEulerAngles = StartRotation;
     gameObject.SetActive(true);
     shouldDoRotation = true;
     _resetBeamSound.Play();
 }
コード例 #3
0
 void Start()
 {
     _backgroundSound       = this.gameObject.AddComponent <FMODUnity.StudioEventEmitter>();
     _backgroundSound.Event = GLOB.OutsidePeopleSound;
     _backgroundSound.EventInstance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(new Vector3(8, 0, 4)));
     _backgroundSound.Play();
 }
コード例 #4
0
    private GameObject CreatePowerup(Powerup.Type type, Vector3 location)
    {
        FMODUnity.StudioEventEmitter sound = GetComponent <FMODUnity.StudioEventEmitter> ();
        if (sound != null)
        {
            sound.Play();
        }

        GameObject powerup = PowerupModel(type);

        powerup.transform.localScale = Vector3.one * 2;
        powerup.transform.position   = location + transform.position;
        powerup.transform.rotation   = Quaternion.Euler(new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360)));


        powerup.AddComponent <Rigidbody>();
        powerup.AddComponent <SphereCollider> ();
        powerup.AddComponent <PowerupController>().type = type;

        ParticleSystem ps = Instantiate(spawnEffect);

        ps.transform.parent        = powerup.transform;
        ps.transform.localPosition = powerup.GetComponent <SphereCollider> ().center;
        ParticleSystem.MinMaxGradient x = ps.main.startColor;
        x.color = Color.red;

        return(powerup);
    }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     interactable = Utils.GetRequiredComponent <Interactable>(this);
     interactable.OnInteractEnd += ChangeStation;
     musicEv = Utils.GetRequiredComponent <FMODUnity.StudioEventEmitter>(this);
     musicEv.Play();
 }
コード例 #6
0
    private IEnumerator PlaySequence()
    {
        enabled = false;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = false;
        if (_particle_system)
        {
            _particle_system.Play();
        }
        _fire_sound.Play();
        float timer;

        for (int i = 0; i < _crystals.Length; i++)
        {
            _music_sequence[i].Play();
            _crystals[i].State = true;
            timer = delay;
            while (timer > 0)
            {
                yield return(null);

                timer -= Time.deltaTime;
            }
            _crystals[i].State = false;
        }
        enabled = true;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = true;
        if (_particle_system)
        {
            _particle_system.Stop();
        }
        _puzzle_manager.ResetPuzzle();
        _fire_sound.Stop();
    }
コード例 #7
0
    protected override void SolvePuzzle()
    {
        base.SolvePuzzle();
        var dtor = Wall.GetComponent <DelayedTurnOffRock>();

        if (dtor)
        {
            //PK's effect
            if (Wall.activeInHierarchy)
            {
                DissapearSound.Play();
                dtor.TurnOff();
                SoundFinish.Play();
                StartCoroutine(DelayedSolve());
            }
        }
        else if (WallCrystalObstacle)
        {
            //Fra's effect (FadeOut like crystals)
            if (WallCrystalObstacle.gameObject.activeInHierarchy)
            {
                WallCrystalObstacle.AnimateThenSetActive(0.5f, false);
                SoundFinish.Play();
                StartCoroutine(DelayedSolve());
            }
        }
        else
        {
            Wall.SetActive(false);
        }
        if (Effect)
        {
            Effect.SetActive(true);
        }
    }
コード例 #8
0
ファイル: ChargeAttack.cs プロジェクト: jaimuepe/Artifacts
    IEnumerator ChargeCoroutine(Vector3 target)
    {
        chasePlayer.enabled       = false;
        lookTowardsPlayer.enabled = false;
        animator.SetBool("enraged", true);

        // play animation

        sr.color = Color.red;
        yield return(new WaitForSeconds(timeBeforeCharge));

        emitter.Play();
        Vector3 direction = (target - myTransform.position).normalized;

        for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / chargeTime)
        {
            if (!GameManager.instance.gamePaused)
            {
                myTransform.position += chargeSpeed * new Vector3(direction.x, direction.y, 0);
            }
            yield return(null);
        }

        animator.SetBool("enraged", false);
        chasePlayer.enabled       = true;
        lookTowardsPlayer.enabled = true;
        sr.color = Color.white;
    }
コード例 #9
0
ファイル: MagGun.cs プロジェクト: ritli/CodenameFermi
    void MagPullUpdate()
    {
        if (magPulling && !propFlying)
        {
            attractorParticles.transform.localScale = Vector3.Lerp(attractorParticles.transform.localScale, Vector3.one, Time.deltaTime * 5f);

            attractorParticles.SetEmission(true);

            if (!magStateSwapped)
            {
                emitter.Play();

                magStateSwapped = true;
            }
        }

        else
        {
            attractorParticles.transform.localScale = Vector3.Lerp(attractorParticles.transform.localScale, Vector3.zero, Time.deltaTime * 15f);
            attractorParticles.SetEmission(false);

            if (magStateSwapped)
            {
                emitter.Stop();
                FMODUnity.RuntimeManager.PlayOneShot("event:/MagLoopEnd");

                magStateSwapped = false;
            }
        }

        magAttachTimeElapsed += Time.deltaTime;
    }
コード例 #10
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        eventEmitter = animator.gameObject.GetComponent<FMODUnity.StudioEventEmitter>();

        if (eventEmitter != null)
            eventEmitter.Play();    // lamp and lanterns play flickering sound
    }
コード例 #11
0
 // Update is called once per frame
 void Grow()
 {
     if (growth != 0)
     {
         grow.Play();
     }
 }
コード例 #12
0
    private void SetLightState(LightState pLightState)
    {
        _lightsShouldChange = false;
        if (_lightState >= 0 && (int)_lightState <= (int)LightState.TABLET)
        {
            startRotation1 = StepRotation1[(int)_lightState];
            startRotation2 = StepRotation2[(int)_lightState];
        }
        else //If the current light state is invalid.
        {
            startRotation1 = TargetMoveObject1.localEulerAngles; //NOTE: Could cause issues if dealing with negative rotations. (I.E. A -20 rotation would be read as a 340 rotation.)
            startRotation2 = TargetMoveObject2.localEulerAngles;
        }

        if ((int)pLightState > (int)LightState.SLIDERA) //If the new light state is invalid, turn lights off.
        {
            _lightState = LightState.FINISHED;
        }
        else
        {
            _lightState = pLightState;
        }
        SwitchLights(_lightState);
        _spotlightEmitter.Play();
    }
コード例 #13
0
    void ActivatePowerup()
    {
        particleController.playItemParticleSystem(currentItem);
        switch (currentItem)
        {
        case Item.Type.STICKY_THROWABLE:
            throwSound.Play();
            GameObject sticky = Instantiate(atlas.snowballThrowable);
            sticky.AddComponent <PowerupController> ().type = Powerup.Type.STICKY;
            IEnumerator stickyC = ThrowItem(sticky);
            StartCoroutine(stickyC);
            chargeLeft -= stats.TOTAL_ITEM_CHARGE / stats.THROW_USES;
            break;

        case Item.Type.BANANA_THROWABLE:
            throwSound.Play();
            GameObject banana = Instantiate(atlas.bananaThrowable);
            banana.AddComponent <PowerupController> ().type = Powerup.Type.BANANA;
            banana.AddComponent <Rigidbody> ().isKinematic  = false;
            IEnumerator bananaC = ThrowItem(banana);
            StartCoroutine(bananaC);
            chargeLeft -= stats.TOTAL_ITEM_CHARGE / stats.THROW_USES;
            break;

        case Item.Type.SUPER_BOOST:
            SetItemCooldown(stats.SUPER_BOOST_COOLDOWN);
            playerMovement.Boost(stats.SUPER_BOOST_POWER);
            chargeLeft -= stats.TOTAL_ITEM_CHARGE / stats.SUPER_BOOST_USES;
            fireSound.Play();
            break;
        }
    }
コード例 #14
0
    //Timer coroutine that takes place every second
    public IEnumerator StartCountdown(int ISeconds, int IMinutes)
    {
        JukeBoxSFX.Play();
        yield return(new WaitForSeconds(1));

        cam.GetComponent <FMODUnity.StudioEventEmitter>().Play();

        currCountdownSeconds = ISeconds;                 //temp variable to store the given seconds
        currCountdownMinutes = Minutes;                  //temp variable to store the given minutes
        //int i = 0;
        int    TotalSeconds = ISeconds + (Minutes * 60); //maximun amount of seconds that will last this loop
        string time         = "";                        // init the string for the UI

        while (TotalSeconds > 0)
        {
            yield return(new WaitForSeconds(1.0f));

            TotalSeconds--;
            currCountdownSeconds--;
            time = currCountdownMinutes.ToString("00") + ":" + currCountdownSeconds.ToString("00");
            if (currCountdownSeconds == 0)
            {
                currCountdownSeconds = 60;
            }
            if (currCountdownSeconds == 60 && TotalSeconds > 0)
            {
                currCountdownMinutes--;
            }

            timerTxt.text = time;
        }
        Debug.Log("Time out");
    }
コード例 #15
0
ファイル: AudioManager.cs プロジェクト: Foldover/ggj19
 public void PlayEmitterOnce(FMODUnity.StudioEventEmitter fmodComponent)
 {
     if (!fmodComponent.IsPlaying())
     {
         fmodComponent.Play();
     }
 }
コード例 #16
0
    void Update()
    {
        if (transform.position.y <= fallBoundary)
        {
            DamagePlayer(9999999);     //Kill Player if he falls through map.
        }

        if (damaged)
        {
            damageImage.color = flashColour;
        }
        else
        {
            damageImage.color = Color.Lerp(damageImage.color, Color.clear, flashSpeed * Time.deltaTime);
        }

        if (health.CurrentVal == 0)
        {
            musicControl.DeathMusic();
            ToggleGameOver();
            eventEmitterRef.Play();
            time -= Time.deltaTime;
        }


        damaged = false;
    }
コード例 #17
0
    private GameObject CreateItem(Item.Type type)
    {
        spawnEffect.Play();
        FMODUnity.StudioEventEmitter x = GetComponent <FMODUnity.StudioEventEmitter> ();
        if (x != null)
        {
            x.Play();
        }
        switch (type)
        {
        case Item.Type.SUPER_BOOST:
            GameObject boost = Instantiate(atlas.fireBoostItem);
            boost.AddComponent <ItemController>().type = type;
            return(boost);

        case Item.Type.STICKY_THROWABLE:
            GameObject throwable = Instantiate(atlas.snowballItem);
            throwable.AddComponent <ItemController>().type = type;
            return(throwable);

        case Item.Type.BANANA_THROWABLE:
            GameObject banana = Instantiate(atlas.bananaItem);
            banana.AddComponent <ItemController>().type = type;
            return(banana);

        default:
            return(null);
        }
    }
コード例 #18
0
    // Update is called once per frame
    protected override void Update()
    {
        base.Update();
        if (_isBeingGrabbed)
        {
            float fwdDotProduct   = Vector3.Dot(transform.forward, velocity);
            float upDotProduct    = Vector3.Dot(transform.up, velocity);
            float rightDotProduct = Vector3.Dot(transform.right, velocity);

            Vector3 velocityVector = new Vector3(rightDotProduct, upDotProduct, fwdDotProduct);
            if (velocity.magnitude > _shakeSensitivity)
            {
                if (!_sandShakeSoundEmitter.IsPlaying())
                {
                    _sandShakeSoundEmitter.Play();
                }
            }
        }
        if (this.transform.worldToLocalMatrix[1, 1] < 0 && _isBeingGrabbed == true)
        {
            SpawnSand();
            fadeStartTime = Time.time;
        }
        else if (_sandPourSoundEmitter.IsPlaying())
        {
            FadeOutSandPour();
        }
    }
コード例 #19
0
 void ObjectReleased(object sender, InteractableObjectEventArgs e)
 {
     if (_overHalfWay && !_leverResetSound.IsPlaying())
     {
         _leverResetSound.Play();
     }
 }
    private IEnumerator PlaySequence()
    {
        enabled = false;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = false;
        float timer;

        if (ParticleSystem)
        {
            ParticleSystem.Play();
        }
        _fire_sound.Play();
        for (int i = 0; i < _crystal_sound_sequence.Length; i++)
        {
            _crystal_sound_sequence[i].Play();
            timer = delay;
            while (timer > 0)
            {
                yield return(null);

                timer -= Time.deltaTime;
            }
        }
        enabled = true;
        PlayerStatus.Instance.GetComponent <Movement>().ControlsEnabled = true;
        if (ParticleSystem)
        {
            ParticleSystem.Stop();
        }
        _fire_sound.Stop();
    }
コード例 #21
0
 public void PlayEndClickSound()
 {
     if (!_leverEndClickSound.IsPlaying())
     {
         _leverEndClickSound.Play();
         goingBack = true;
     }
 }
コード例 #22
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!triggered && collision.CompareTag("Player"))
     {
         triggered = true;
         emitter.Play();
     }
 }
コード例 #23
0
    IEnumerator SoundSpacing()
    {
        yield return(new WaitForSeconds(walkTiming));

        walkSound.Play();

        coroutineStarted = false;
    }
コード例 #24
0
ファイル: Character.cs プロジェクト: r2cris/GHC-jam
    public void CommentSomething(int likeID)
    {
        //if (!canTalk) { return; }
        GameObject op = Instantiate(opinionPrefab, head.transform.position, Quaternion.identity);

        opinion = op.GetComponentsInChildren <SpriteRenderer>()[1];
        //Debug.Log(likeID + likes[likeID].topic.ToString());
        Sprite[] Spritestoshow = likes[likeID].topicSprites;
        int      p             = Random.Range(0, Spritestoshow.Length);

        opinion.sprite = Spritestoshow[p];
        //Goods++;


        eventEmitterRef.Play();
        Destroy(op, opinionLifetime);
    }
コード例 #25
0
 protected override void ObjectGrabbed(object sender, InteractableObjectEventArgs e)
 {
     base.ObjectGrabbed(sender, e);
     if (!_sliderSoundSoundEmitter.IsPlaying())
     {
         _sliderSoundSoundEmitter.Play();
     }
 }
コード例 #26
0
 public void StopBossMusic()
 {
     if (bgm != null)
     {
         bossMusic.Stop();
         bgm.Play();
     }
 }
コード例 #27
0
    // Start is called before the first frame update
    void Awake()
    {
        ambience.Play();
        music.Play();

        player = GameObject.FindWithTag("Player");
        plants = GameObject.FindGameObjectsWithTag("MultiInteractable");
    }
コード例 #28
0
 public void ChangeStation(Interactable source)
 {
     if (isPlaying)
     {
         musicEv.Stop();
         musicEv.Play();
     }
 }
コード例 #29
0
 protected override void ObjectGrabbed(object sender, InteractableObjectEventArgs e)
 {
     base.ObjectGrabbed(sender, e);
     if (!_bottlePickUpSound.IsPlaying())
     {
         _bottlePickUpSound.Play();
     }
 }
コード例 #30
0
    // Start is called before the first frame update
    void Awake()
    {
        ambience.Play();
        music.Play();

        player = GameObject.FindWithTag("Player");
        plants = GameObject.FindGameObjectsWithTag("Plant");
    }
コード例 #31
0
 protected override void OnActivate()
 {
     _emitter?.Play();
     if (_deactivate_after_interaction)
     {
         this.enabled = false;
     }
 }
コード例 #32
0
    void Start()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Input.gyro.enabled = true;

        _timer = symbolCooldown;

        emitter = GetComponent<FMODUnity.StudioEventEmitter>();
        emitter.Play();

        //studioSystem = FMODUnity.RuntimeManager.StudioSystem;
        //FMODUnity.RuntimeManager.PlayOneShot("event:/Teste");
    }