Example #1
0
        public void OnCapturePointOwnerChanged(FlagCapturePoint flagCapturePoint, Team ownerTeam)
        {
            this._capturePointOwners[flagCapturePoint.FlagIndex] = ownerTeam;
            Action <FlagCapturePoint, Team> ownerChangedEvent = this.OnCapturePointOwnerChangedEvent;

            if (ownerChangedEvent != null)
            {
                ownerChangedEvent(flagCapturePoint, ownerTeam);
            }
            if (this._myRepresentative == null || this._myRepresentative.MissionPeer.Team == null)
            {
                return;
            }
            MatrixFrame cameraFrame = Mission.Current.GetCameraFrame();
            Vec3        position    = cameraFrame.origin + cameraFrame.rotation.u;

            if (this._myRepresentative.MissionPeer.Team == ownerTeam)
            {
                MBSoundEvent.PlaySound(SoundEvent.GetEventIdFromString("event:/alerts/report/flag_captured"), position);
            }
            else
            {
                MBSoundEvent.PlaySound(SoundEvent.GetEventIdFromString("event:/alerts/report/flag_lost"), position);
            }
        }
Example #2
0
        public ResourceSelectionDlg(SoundEvent.IResourceProvider mgr)
        {
            InitializeComponent();

            _view.Resources = mgr;
            _view.SelectionChanged += new LibraryView.ResourceEventHandler(_view_SelectionChanged);
        }
Example #3
0
 void _view_SelectionChanged(SoundEvent.IResource res)
 {
     if (res == null)
         SelectedItem = "";
     else
         SelectedItem = res.FullName;
 }
 public override void OnPlay(AnimEventManager.EventPlayerData behaviour)
 {
     if (!string.IsNullOrEmpty(base.sound) && SoundEvent.ShouldPlaySound(behaviour.controller, base.sound, base.looping, isDynamic))
     {
         int        num        = -1;
         GameObject gameObject = behaviour.controller.gameObject;
         if (counterModulus >= -1)
         {
             HandleVector <int> .Handle h = GameComps.WhiteBoards.GetHandle(gameObject);
             if (!h.IsValid())
             {
                 h = GameComps.WhiteBoards.Add(gameObject);
             }
             num = (GameComps.WhiteBoards.HasValue(h, base.soundHash) ? ((int)GameComps.WhiteBoards.GetValue(h, base.soundHash)) : 0);
             int num2 = (counterModulus != -1) ? ((num + 1) % counterModulus) : 0;
             GameComps.WhiteBoards.SetValue(h, base.soundHash, num2);
         }
         Vector3       position = behaviour.GetComponent <Transform>().GetPosition();
         EventInstance instance = SoundEvent.BeginOneShot(base.sound, position);
         if (instance.isValid())
         {
             if (num >= 0)
             {
                 instance.setParameterValue("eventCount", (float)num);
             }
             SoundEvent.EndOneShot(instance);
         }
     }
 }
    protected override void OnDragTool(int cell, int distFromOrigin)
    {
        if (path.Count == 0)
        {
            return;
        }
        PathNode pathNode = path[path.Count - 1];

        if (pathNode.cell == cell)
        {
            return;
        }
        placeSound = GlobalAssets.GetSound("Place_building_" + def.AudioSize, false);
        Vector3       pos      = Grid.CellToPos(cell);
        EventInstance instance = SoundEvent.BeginOneShot(placeSound, pos);

        if (path.Count > 1)
        {
            int      num       = cell;
            PathNode pathNode2 = path[path.Count - 2];
            if (num == pathNode2.cell)
            {
                if ((Object)previousCellConnection != (Object)null)
                {
                    previousCellConnection.ConnectedEvent(previousCell);
                    KMonoBehaviour.PlaySound(GlobalAssets.GetSound("OutletDisconnected", false));
                    previousCellConnection = null;
                }
                previousCell = cell;
                CheckForConnection(cell, def.PrefabID, string.Empty, ref previousCellConnection, false);
                PathNode pathNode3 = path[path.Count - 1];
                Object.Destroy(pathNode3.visualizer);
                PathNode pathNode4 = path[path.Count - 1];
                TileVisualizer.RefreshCell(pathNode4.cell, def.TileLayer, def.ReplacementLayer);
                path.RemoveAt(path.Count - 1);
                buildingCount = ((buildingCount != 1) ? (buildingCount - 1) : (buildingCount = 14));
                instance.setParameterValue("tileCount", (float)buildingCount);
                SoundEvent.EndOneShot(instance);
                goto IL_029c;
            }
        }
        if (!path.Exists((PathNode n) => n.cell == cell))
        {
            bool valid = CheckValidPathPiece(cell);
            path.Add(new PathNode
            {
                cell       = cell,
                visualizer = null,
                valid      = valid
            });
            CheckForConnection(cell, def.PrefabID, "OutletConnected", ref previousCellConnection, true);
            buildingCount = buildingCount % 14 + 1;
            instance.setParameterValue("tileCount", (float)buildingCount);
            SoundEvent.EndOneShot(instance);
        }
        goto IL_029c;
IL_029c:
        visualizer.SetActive(path.Count < 2);
        ResourceRemainingDisplayScreen.instance.SetNumberOfPendingConstructions(path.Count);
    }
 public override void OnLeftClickDown(Vector3 cursor_pos)
 {
     if (!((Object)visualizer == (Object)null))
     {
         path.Clear();
         int cell = Grid.PosToCell(cursor_pos);
         if (Grid.IsValidCell(cell) && Grid.IsVisible(cell))
         {
             bool valid = CheckValidPathPiece(cell);
             path.Add(new PathNode
             {
                 cell       = cell,
                 visualizer = null,
                 valid      = valid
             });
             CheckForConnection(cell, def.PrefabID, "OutletConnected", ref previousCellConnection, true);
         }
         visUpdater = StartCoroutine(VisUpdater());
         visualizer.GetComponent <KBatchedAnimController>().StopAndClear();
         ResourceRemainingDisplayScreen.instance.SetNumberOfPendingConstructions(1);
         placeSound = GlobalAssets.GetSound("Place_building_" + def.AudioSize, false);
         if (placeSound != null)
         {
             buildingCount = buildingCount % 14 + 1;
             Vector3       pos      = Grid.CellToPos(cell);
             EventInstance instance = SoundEvent.BeginOneShot(placeSound, pos);
             if (def.AudioSize == "small")
             {
                 instance.setParameterValue("tileCount", (float)buildingCount);
             }
             SoundEvent.EndOneShot(instance);
         }
         base.OnLeftClickDown(cursor_pos);
     }
 }
Example #7
0
        private IEnumerator StartBattleCoroutine()
        {
            // 대사
            _dialogueController.ClearPages();
            _dialogueController.AddNextPage("야생의 " + _enemyPokemon.Info._name + "이(가) 나타났다!");
            _dialogueController.AddNextPage("가랏! " + _myPokemon.Info._name + "!", true);

            StartCoroutine(_uiManager._mainUI.FadeInBattle(1.5f));
            yield return(new WaitForSeconds(1.5f));

            _uiManager.SetActive(true);

            _uiManager._mainUI.UpdateEnemyImage(true);
            _dialogueController.NextDialogue();
            yield return(_waitDialogueUpdating);

            // 새내기 이동
            _uiManager._mainUI.MoveIpsangSide();
            yield return(new WaitWhile(() => _uiManager._mainUI._isIpsangMoving));

            // 소환 이펙트
            _uiManager._mainUI.UpdatePlayerImage(true, true);
            SoundEvent.Trigger(_hitSound, SoundStatus.Stop);
            SoundEvent.Trigger(_appearSound);
            yield return(_waitInputing);

            _dialogueController.EndDialogue();

            SelectAction();
        }
Example #8
0
    //Manage the Memory after cycle processes are done
    private void LateUpdate()
    {
        List <SoundEvent> toDelete = new List <SoundEvent>();

        Memory.ForEach((SoundEvent e) => { if (Time.time - e.eventTime > secondsOfMemory)
                                           {
                                               toDelete.Add(e);
                                           }
                       });
        foreach (SoundEvent e in toDelete)
        {
            Memory.Remove(e);
        }

        if (Memory.Count == 0)
        {
            Vector2    tmp       = (UnityEngine.Random.insideUnitCircle * UnityEngine.Random.Range(3f, ListenDistance));
            Vector3    newTarget = transform.position + new Vector3(tmp.x, transform.position.y, tmp.y);
            SoundEvent randEvent = new SoundEvent {
                eventTime  = Time.time,
                source     = newTarget,
                strength   = 2,
                isInternal = true
            };
            Memory.Add(randEvent);
        }
    }
        public void OnCaptureResult(CaptureTheFlagCaptureResultEnum result)
        {
            if (GameNetwork.IsDedicatedServer || !GameNetwork.MyPeer.IsSynchronized)
            {
                return;
            }
            MissionPeer component = GameNetwork.MyPeer.GetComponent <MissionPeer>();

            switch (result)
            {
            case CaptureTheFlagCaptureResultEnum.AttackersWin:
                if (component == null)
                {
                    break;
                }
                SoundEvent.PlaySound2D(component.Team.Side == BattleSideEnum.Attacker ? "event:/ui/mission/multiplayer/mp_victory" : "event:/ui/mission/multiplayer/mp_defeat");
                break;

            case CaptureTheFlagCaptureResultEnum.DefendersWin:
                if (component == null)
                {
                    break;
                }
                SoundEvent.PlaySound2D(component.Team.Side == BattleSideEnum.Defender ? "event:/ui/mission/multiplayer/mp_victory" : "event:/ui/mission/multiplayer/mp_defeat");
                break;
            }
        }
Example #10
0
 public void Execute(ReplyContext context, object config)
 {
     if (!string.IsNullOrEmpty(context.Args) && Agent.Main != null)
     {
         Mission.Current.MakeSound(SoundEvent.GetEventIdFromString(context.Args), Agent.Main.AgentVisuals.GetGlobalFrame().origin, false, true, Agent.Main.Index, -1);
     }
 }
    /**
     * Plays a sound
     */
    public static void PostEvent(string name)
    {
        if (MusicManager.instance == null)
        {
            return;
        }

        SoundEvent soundEvent = MusicManager.instance.GetClipFromName(name);

        if (soundEvent == null)
        {
            Debug.Log("Event not found : " + name);
            return;
        }

        // Process event type
        if (soundEvent.Play)
        {
            MusicManager.instance.PlayEvent(soundEvent);
        }
        else if (soundEvent.Stop)
        {
            MusicManager.instance.StopEvent(soundEvent);
        }
    }
Example #12
0
 public void Recycle(SoundEvent soundEvent)
 {
     if (pool.Count < size)
     {
         pool.Add(soundEvent);
     }
 }
Example #13
0
    public override void PlaySound(AnimEventManager.EventPlayerData behaviour)
    {
        Vector3 position  = behaviour.GetComponent <Transform>().GetPosition();
        Worker  component = behaviour.GetComponent <Worker>();

        if ((UnityEngine.Object)component == (UnityEngine.Object)null)
        {
            SoundEvent.PlayOneShot(GlobalAssets.GetSound("Building_Dmg_Metal", false), position);
        }
        else
        {
            Workable workable = component.workable;
            if ((UnityEngine.Object)workable != (UnityEngine.Object)null)
            {
                Building component2 = workable.GetComponent <Building>();
                if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
                {
                    BuildingDef def   = component2.Def;
                    string      name  = StringFormatter.Combine(base.name, "_", def.AudioCategory);
                    string      sound = GlobalAssets.GetSound(name, false);
                    if (sound == null)
                    {
                        name  = "Building_Dmg_Metal";
                        sound = GlobalAssets.GetSound(name, false);
                    }
                    if (sound != null)
                    {
                        SoundEvent.PlayOneShot(sound, position);
                    }
                }
            }
        }
    }
Example #14
0
 // Use this for initialization
 void Start()
 {
     filter = gameObject.AddComponent <AudioLowPassFilter>();
     filter.cutoffFrequency = startCutoff;
     source        = GetComponent <SoundEvent>();
     source.volume = startVolume;
 }
 private void TriggerAudio()
 {
     if (!SpeedControlScreen.Instance.IsPaused)
     {
         CameraController instance = CameraController.Instance;
         int num = 0;
         List <AudioInfo> list = new List <AudioInfo>();
         for (int i = 0; i < this.audioInfo.Count; i++)
         {
             CameraController cameraController = instance;
             AudioInfo        audioInfo        = this.audioInfo[i];
             if (cameraController.IsVisiblePos(audioInfo.position))
             {
                 list.Add(this.audioInfo[i]);
                 num++;
             }
         }
         for (int j = 0; j < list.Count; j++)
         {
             AudioInfo audioInfo2 = list[j];
             if (audioInfo2.distance != float.PositiveInfinity)
             {
                 EventInstance instance2 = SoundEvent.BeginOneShot(overlaySound, audioInfo2.position);
                 instance2.setParameterValue("blobCount", (float)audioInfo2.blobCount);
                 instance2.setParameterValue("networkCount", (float)num);
                 SoundEvent.EndOneShot(instance2);
             }
         }
     }
 }
    public void OnTriggerEnter(Collider collider)
    {
        if (_wait)
        {
            return;
        }

        base.OnTriggerEnter(collider);
        if (!collider.gameObject.CompareTag("Bubble"))
        {
            return;
        }

        collider.gameObject.GetComponent <SphereCollider>().enabled = false;

        Events.instance.Raise(new HitEvent(HitEvent.Type.Spawn, collider, collider.gameObject));
        Events.instance.Raise(SoundEvent.WithClip(BossHitClips[Random.Range(0, BossHitClips.Length - 1)]));

        Destroy(collider.gameObject);

        float amtHit = _startingHpWidth / (Health / _playerScript.Strength);

        HealthFill.fillAmount -= amtHit;
        _playerHits           += _playerScript.Strength;

        // Adjust health bar and stop unless boss is dead
        if (!(Health - _playerHits <= .1f))
        {
            return;
        }

        // Destroy Wizard
        StartCoroutine(DestroyWizard());
    }
        public void OnCapturePointOwnerChanged(FlagCapturePoint flagCapturePoint, Team ownerTeam)
        {
            this._capturePointOwners[flagCapturePoint.FlagIndex] = ownerTeam;
            Action <FlagCapturePoint, Team> ownerChangedEvent = this.OnCapturePointOwnerChangedEvent;

            if (ownerChangedEvent != null)
            {
                ownerChangedEvent(flagCapturePoint, ownerTeam);
            }
            if (ownerTeam != null && ownerTeam.Side == BattleSideEnum.Defender && ((double)this._remainingTimeForBellSoundToStop > 8.0 && flagCapturePoint == this._masterFlag))
            {
                this._bellSoundEvent.Stop();
                this._bellSoundEvent = (SoundEvent)null;
                this._remainingTimeForBellSoundToStop = float.MinValue;
                this._lastBellSoundPercentage        += 0.2f;
            }
            if (this._myRepresentative == null || this._myRepresentative.MissionPeer.Team == null)
            {
                return;
            }
            MatrixFrame cameraFrame = Mission.Current.GetCameraFrame();
            Vec3        position    = cameraFrame.origin + cameraFrame.rotation.u;

            if (this._myRepresentative.MissionPeer.Team == ownerTeam)
            {
                MBSoundEvent.PlaySound(SoundEvent.GetEventIdFromString("event:/alerts/report/flag_captured"), position);
            }
            else
            {
                MBSoundEvent.PlaySound(SoundEvent.GetEventIdFromString("event:/alerts/report/flag_lost"), position);
            }
        }
Example #18
0
        public void PlaySoundEffect(SoundEvent sevent)
        {
            if (!SettingsManager.Get <bool>("EnableMenuSounds"))
            {
                return;
            }

            var eventName = sevent.ToString().Replace("_", "");

            if (!Sounds.ContainsKey(eventName))
            {
                //This should happen if no corresponding definition is found for the event (such as a missing definition file).
                Log.AddMessage("SoundEffectManager doesn't contain an entry for: " + eventName, LogLevel.WARN);
                Sounds[eventName] = "";
                return;
            }
            if (string.IsNullOrEmpty(Sounds[eventName]))
            {
                return;
            }
            if (!File.Exists(Sounds[eventName]))
            {
                Log.AddMessage("SoundEffectManager: File specified doesn't exist: " + Sounds[eventName], LogLevel.WARN);
                return;
            }

            AudioManager.PlaySoundEffect(Sounds[eventName]);
        }
Example #19
0
        public void SoundEventDeserialize()
        {
            string     json       = "{\"replace\":false,\"subtitle\":\"Some subtitle\",\"sounds\":[{\"name\":\"" + TestModModid + ":test\",\"volume\":1.0,\"pitch\":1.0,\"weight\":1,\"stream\":false,\"attenuation_distance\":0,\"preload\":false,\"type\":\"file\"},{\"name\":\"" + TestModModid + ":testCopy2\",\"volume\":0.5,\"pitch\":2.0,\"weight\":2,\"stream\":true,\"attenuation_distance\":1,\"preload\":true,\"type\":\"event\"}]}";
            SoundEvent soundEvent = JsonConvert.DeserializeObject <SoundEvent>(json, soundEventConverter);

            Assert.IsNotNull(soundEvent);
            Assert.AreEqual(false, soundEvent.Replace);
            Assert.AreEqual("Some subtitle", soundEvent.Subtitle);
            Assert.IsNotNull(soundEvent.Files);
            Assert.AreEqual(2, soundEvent.Files.Count);
            Assert.IsNotNull(soundEvent.Files[0]);
            Assert.IsNotNull(soundEvent.Files[1]);
            Assert.AreEqual($"{TestModModid}:test", soundEvent.Files[0].Name);
            Assert.AreEqual(1.0, soundEvent.Files[0].Volume);
            Assert.AreEqual(1.0, soundEvent.Files[0].Pitch);
            Assert.AreEqual(1, soundEvent.Files[0].Weight);
            Assert.AreEqual(false, soundEvent.Files[0].Stream);
            Assert.AreEqual(0, soundEvent.Files[0].AttenuationDistance);
            Assert.AreEqual(false, soundEvent.Files[0].Preload);
            Assert.AreEqual(Sound.SoundType.file, soundEvent.Files[0].Type);
            Assert.AreEqual($"{TestModModid}:testCopy2", soundEvent.Files[1].Name);
            Assert.AreEqual(0.5, soundEvent.Files[1].Volume);
            Assert.AreEqual(2.0, soundEvent.Files[1].Pitch);
            Assert.AreEqual(2, soundEvent.Files[1].Weight);
            Assert.AreEqual(true, soundEvent.Files[1].Stream);
            Assert.AreEqual(1, soundEvent.Files[1].AttenuationDistance);
            Assert.AreEqual(true, soundEvent.Files[1].Preload);
            Assert.AreEqual(Sound.SoundType.@event, soundEvent.Files[1].Type);
        }
Example #20
0
    public void PlayLoop(int soundID, Surface.Substance substance, Surface.Cue cue, float volume,
                         Vector3 position = new Vector3(), Transform transformToFollow = null)
    {
        if (loopSoundEventDict.ContainsKey(soundID))
        {
            //we've already created our loop, so merely update it with the current volume
            if (loopSoundEventDict[soundID] != null)
            {
                loopSoundEventDict[soundID].volume = volume;
            }
        }
        else
        {
            //Debug.Log("new loop created.");
            //TODO: Check the type of substance and only create a new AudioSource for new types of sounds

            //create entry for our looped sound so we can end it later
            GameObject go = new GameObject(substance + ":" + cue);
            SoundEvent se = go.AddComponent <SoundEvent>();
            se.Initialize(surfaceDataDict[substance].GetSound(cue), SoundEvent.Category.Loop);

            if (transformToFollow != null)
            {
                //if we are following a transform position, the position should be ignored
                se.SetFollowTransform(transformToFollow);
            }
            else
            {
                se.SetPosition(position);
            }
            se.volume = volume;
            loopSoundEventDict.Add(soundID, se);
            loopSoundEventDict[soundID].Play();
        }
    }
Example #21
0
 public static void LogSoundEvent(SoundEvent e)
 {
     if (mtLoggingOn)
     {
         TelemetryTools.Telemetry.Instance.SendEvent("SoundEvent:" + SoundEventToString(e));
     }
 }
        void OnSoundEvent(SoundEvent soundEvent)
        {
            switch (soundEvent)
            {
            case SoundEvent.SyllableStart:
                pointFeatures[visualiserPosition] = (byte)(pointFeatures[visualiserPosition] | (1 << 0));
                break;

            case SoundEvent.SyllableEnd:
                pointFeatures[visualiserPosition] = (byte)(pointFeatures[visualiserPosition] & (255 - (1 << 0)));
                break;

            case SoundEvent.InputStart:
                pointFeatures[visualiserPosition] = (byte)(pointFeatures[visualiserPosition] | (1 << 1));
                break;

            case SoundEvent.InputEnd:
                pointFeatures[visualiserPosition] = (byte)(pointFeatures[visualiserPosition] & (255 - (1 << 0)));
                break;

            case SoundEvent.AudioStart:
                audioPlaying = true;
                break;

            case SoundEvent.AudioEnd:
                audioPlaying       = false;
                visualiserPosition = 0;
                visualiserPoints   = new float[(int)halfCameraWidth * 2];
                break;

            case SoundEvent.SyllablePeak:
                pointFeatures[visualiserPosition] = (byte)(pointFeatures[visualiserPosition] | (1 << 2));
                break;
            }
        }
Example #23
0
    public void TriggerEvent()
    {
        if (!hasBeenTriggered)
        {
            switch (eventToTrigger.eventType)
            {
            case EventType.Sound:
                SoundEvent soundEvent = (SoundEvent)eventToTrigger;
                audioSource.PlayOneShot(soundEvent.audioClip, soundEvent.volumeSetting);
                break;

            case EventType.Animation:
                AnimationEvent animationEvent = (AnimationEvent)eventToTrigger;
                animatedObject.GetComponent <Animator>().SetTrigger(animationEvent.parameterToTrigger);
                break;

            case EventType.Debug:
                Debug.Log("Event Triggered");
                break;

            case EventType.GhostEvent:
                GhostEvent ghostEvent = (GhostEvent)eventToTrigger;
                switch (ghostEvent.thisGhostEvent)
                {
                case GhostEventType.ActivateGhost:
                    ghost.OnFirstActivateGhost();
                    break;
                }
                break;
            }
            hasBeenTriggered = true;
        }
    }
Example #24
0
        private void HandleServerEventFormationWipedMessage(FormationWipedMessage message)
        {
            MatrixFrame cameraFrame = Mission.Current.GetCameraFrame();
            Vec3        position    = cameraFrame.origin + cameraFrame.rotation.u;

            MBSoundEvent.PlaySound(SoundEvent.GetEventIdFromString("event:/alerts/report/squad_wiped"), position);
        }
Example #25
0
 // Update is called once per frame
 void Update()
 {
     if (fade)
     {
         filter.cutoffFrequency        += (Time.deltaTime / transitionTime) * (endCutoff - startCutoff);
         source.externalVolumeModifier += (Time.deltaTime / transitionTime) * (endVolume - startVolume);
         if (filter.cutoffFrequency >= endCutoff && source.externalVolumeModifier >= endVolume)
         {
             fade = false;
             print("custom fade complete");
             Destroy(this);
         }
     }
     if (!source)
     {
         print("Sound Event = null");
         source = gameObject.GetComponent <SoundEvent>();
         source.externalVolumeModifier = startVolume;
     }
     if (!filter)
     {
         print("filter = null");
         filter = gameObject.AddComponent <AudioLowPassFilter>();
         filter.cutoffFrequency = startCutoff;
     }
 }
    public static void PlayGUISound(SoundEvent type)
    {
        if (!m_enabled)
        {
            return;
        }

        AudioClip clip   = null;
        float     volume = instance.m_soundVolume;

        switch (type)
        {
        case SoundEvent.ButtonPressedGeneric:
            clip = instance.m_buttonPressedGenericSound;
            break;
        }

        if (clip == null)
        {
            return;
        }

        instance.audio.transform.position = Camera.main.transform.position;
        instance.audio.clip = clip;
        instance.audio.loop = false;
        instance.audio.Play();
    }
    public override void PlaySound(AnimEventManager.EventPlayerData behaviour)
    {
        Vector3     position    = behaviour.GetComponent <Transform>().GetPosition();
        int         cell        = Grid.PosToCell(position);
        GameObject  gameObject  = null;
        BuildingDef buildingDef = null;

        if (Grid.IsValidCell(cell))
        {
            gameObject = Grid.Objects[cell, 1];
            if ((Object)gameObject != (Object)null && (Object)gameObject.GetComponent <Ladder>() != (Object)null)
            {
                Building component = gameObject.GetComponent <BuildingComplete>();
                if ((Object)component != (Object)null)
                {
                    buildingDef = component.Def;
                }
            }
        }
        if ((Object)buildingDef != (Object)null)
        {
            string name  = (!(buildingDef.PrefabID == "LadderFast")) ? base.name : StringFormatter.Combine(base.name, "_Plastic");
            string sound = GlobalAssets.GetSound(name, false);
            if (sound != null)
            {
                SoundEvent.PlayOneShot(sound, position);
            }
        }
    }
Example #28
0
        protected override void Attack()
        {
            /// 공격 범위 정하기
            Transform attackRange = _idlePunchRange;

            if (_isCrouch)
            {
                attackRange = _crouchKickRange;
                SoundEvent.Trigger("하단");
            }
            else if (!_isGround)
            {
                attackRange = _jumpKickRange;
                SoundEvent.Trigger("점프킥");
            }
            else
            {
                attackRange = _idlePunchRange;
                SoundEvent.Trigger("주먹");
            }

            Collider2D[] collider2Ds = Physics2D.OverlapBoxAll(attackRange.position, _attackSize, 0);

            foreach (Collider2D collider in collider2Ds)
            {
                if (collider.tag == "Enemy")
                {
                    collider.GetComponent <Enemy>().Hitted(attackRange);
                }
            }

            _playerAnimator.SetTrigger("Attack");
            _attackCurrentTime = _attackCollTime;
        }
Example #29
0
    static void PlayEvent(SoundEvent e)
    {
        if (Time.realtimeSinceStartup > e.lastTimePlay + e.IntervalBetweenReplay)
        {
            if (Time.realtimeSinceStartup - e.lastTimePlay < e.IntervalBetweenReplay * 3)
            {
                e.countInThisSery++;
            }
            else
            {
                e.countInThisSery = 0;
            }

            e.lastTimePlay = Time.realtimeSinceStartup;

            if (e.countInThisSery < e.maxInSeries)
            {
                AudioClip c = e.GetClip();
                if (c != null)
                {
                    instance.src.PlayOneShot(c, 1f);
                }
            }
        }
    }
Example #30
0
 protected virtual void PlaySound(char ch)
 {
     if (ch != ' ' && ch != '\n')
     {
         SoundEvent.Trigger(_typingSfx);
     }
 }
Example #31
0
 public void CheckReinforcement(int numberOfTroops)
 {
     if (!this.IsInitialSpawnOver)
     {
         return;
     }
     for (int index = 0; index < 2; ++index)
     {
         int val1 = numberOfTroops;
         if (val1 > 0 && this._numberOfTroopsInQueueForReinforcement[index] > 0 && this._missionSides[index].TroopSpawningActive)
         {
             int number = Math.Min(MBMath.Floor((float)val1 * this.BattleSizeEffect), this._numberOfTroopsInQueueForReinforcement[index]);
             this._missionSides[index].SpawnTroops(number, true);
             InformationManager.AddQuickInformation(this._missionSides[index].IsPlayerSide ? GameTexts.FindText("str_new_reinforcements_have_arrived_for_ally_side") : GameTexts.FindText("str_new_reinforcements_have_arrived_for_enemy_side"));
             MatrixFrame cameraFrame = Mission.Current.GetCameraFrame();
             Vec3        position    = cameraFrame.origin + cameraFrame.rotation.u;
             MBSoundEvent.PlaySound(this._missionSides[index].IsPlayerSide ? SoundEvent.GetEventIdFromString("event:/alerts/report/reinforcements_ally") : SoundEvent.GetEventIdFromString("event:/alerts/report/reinforcements_enemy"), position);
             int num1 = Math.Min(val1, this._numberOfTroopsInQueueForReinforcement[index]);
             this._numberOfTroopsInQueueForReinforcement[index] -= num1;
             int num2 = num1 - number;
             this.GetActivePhaseForSide((BattleSideEnum)index).RemainingSpawnNumber += num2;
             Debug.Print("Side: " + (object)(BattleSideEnum)index, color: Debug.DebugColor.Green, debugFilter: 64UL);
             Debug.Print("NumberOfTroopsRemovedFromQueue: " + (object)num1, color: Debug.DebugColor.Green, debugFilter: 64UL);
             Debug.Print("NumberOfTroopsAddedToRemainingPool: " + (object)num2, color: Debug.DebugColor.Green, debugFilter: 64UL);
         }
     }
 }
        /** @private */
        public void arriveAtFrame(Frame frame, TimelineState timelineState, AnimationState animationState, bool isCross)
        {
            if (frame.Evt != null && this.HasEventListener(FrameEvent.ANIMATION_FRAME_EVENT))
            {
                FrameEvent frameEvent = new FrameEvent(FrameEvent.ANIMATION_FRAME_EVENT);
                frameEvent.AnimationState = animationState;
                frameEvent.FrameLabel     = frame.Evt;
                _eventList.Add(frameEvent);
            }

            if (frame.Sound != null && _soundManager.HasEventListener(SoundEvent.SOUND))
            {
                SoundEvent soundEvent = new SoundEvent(SoundEvent.SOUND);
                soundEvent.Armature       = this;
                soundEvent.AnimationState = animationState;
                soundEvent.Sound          = frame.Sound;
                _soundManager.DispatchEvent(soundEvent);
            }

            if (frame.Action != null)
            {
                if (animationState.IsPlaying)
                {
                    Animation.GotoAndPlay(frame.Action);
                }
            }
        }
Example #33
0
 public ItemNode(string name, SoundEvent.IResource res)
 {
     Name = name;
     Format = "";
     Length = TimeSpan.FromSeconds(res.Length).Format(0, "M:ss");
     Path = "";
     Resource = res;
 }
Example #34
0
 public static void Notify(SoundEvent soundEvent)
 {
     switch (soundEvent)
     {
         case SoundEvent.DiceFallsOnGround:
             SoundCtrl.PlayDice();
             break;
         case SoundEvent.FigureMakesStep:
             SoundCtrl.PlayStep();
             break;
         default:
             break;
     }
 }
Example #35
0
 private static extern uint SndGetSound(SoundEvent seSoundEvent, ref SNDFILEINFO pSoundFileInfo);
 public void Visit(SoundEvent.Provider provider)
 {
     Control = new SoundEventControl(provider, _colorProvider);
 }
Example #37
0
 public void Visit(SoundEvent.Provider provider)
 {
     Element = new SoundEventElement()
     {
         Name = provider.Name,
         BaseColor = Color.Gray,
         Resource = provider.ResourceName
     };
 }
 /**
  * call this to attach this event to a parent SoundEvent in a
  * rendering tree. Uses a specific internal trick of 'negative time'
  * to accomodate for the duration of the event. (Climax is at end of event)
  */
 public void AttachTo(SoundEvent ev)
 {
     ev.AddEvent(-_duration,this);
 }
Example #39
0
 void libraryView1_SelectionChanged(SoundEvent.IResource res)
 {
     MessageBox.Show(res.Length.ToString());
 }
Example #40
0
 public static extern uint SndSetSound(SoundEvent seSoundEvent,
     SoundFileInfo pSoundFileInfo, bool fSuppressUI);
Example #41
0
 private void _libView_SelectionChanged(SoundEvent.IResource res)
 {
     _btnNewEvent.Enabled = (res != null);
 }