Exemple #1
0
 private void PlaySound(SoundType soundType)
 {
     if (currentSounds.ContainsKey(soundType))
     {
         KFMOD.PlayOneShot(currentSounds[soundType]);
     }
 }
Exemple #2
0
        private void Emit(object data)
        {
            GameObject gameObject = (GameObject)data;

            global::Components.Cmps <MinionIdentity> liveMinionIdentities = global::Components.LiveMinionIdentities;
            Vector2 a = gameObject.transform.GetPosition();

            for (int i = 0; i < liveMinionIdentities.Count; i++)
            {
                MinionIdentity minionIdentity = liveMinionIdentities[i];
                if (minionIdentity.gameObject != gameObject.gameObject)
                {
                    Vector2 b   = minionIdentity.transform.GetPosition();
                    float   num = Vector2.SqrMagnitude(a - b);
                    if (num <= 2.25f)
                    {
                        minionIdentity.Trigger((int)GameHashes.Cringe, Strings.Get("STRINGS.DUPLICANTS.DISEASES.PUTRIDODOUR.CRINGE_EFFECT").String);
                        minionIdentity.gameObject.GetSMI <ThoughtGraph.Instance>().AddThought(Db.Get().Thoughts.PutridOdour);
                    }
                }
            }

            int   gameCell = Grid.PosToCell(gameObject.transform.GetPosition());
            float temp     = Db.Get().Amounts.Temperature.Lookup(this).value;

            SimMessages.AddRemoveSubstance(gameCell, SimHashes.ContaminatedOxygen, CellEventLogger.Instance.ElementConsumerSimUpdate, 0.0025f, temp, DiseaseInfo.Invalid.idx, DiseaseInfo.Invalid.count);
            KFMOD.PlayOneShot(GlobalAssets.GetSound("Dupe_Flatulence"), base.transform.GetPosition());
        }
 public override void OnKeyDown(KButtonEvent e)
 {
     if (e.TryConsume(Action.RotateBuilding))
     {
         if ((Object)visualizer != (Object)null)
         {
             Rotatable component = visualizer.GetComponent <Rotatable>();
             if ((Object)component != (Object)null)
             {
                 KFMOD.PlayOneShot(GlobalAssets.GetSound("HUD_Rotate", false));
                 buildingOrientation = component.Rotate();
                 if (Grid.IsValidBuildingCell(lastCell))
                 {
                     Vector3 pos = Grid.CellToPosCCC(lastCell, Grid.SceneLayer.Building);
                     UpdateVis(pos);
                 }
                 if (base.Dragging && lastDragCell != -1)
                 {
                     TryBuild(lastDragCell);
                 }
             }
         }
     }
     else
     {
         base.OnKeyDown(e);
     }
 }
Exemple #4
0
    private void OnDiscoveredSpaceClicked()
    {
        KFMOD.PlayOneShot(GlobalAssets.GetSound(GetSound(), false));
        MusicManager.instance.PlaySong("Stinger_Surface", false);
        CameraController.Instance.SetTargetPos(cameraFocusPos, 8f, true);
        SeasonManager component = SaveGame.Instance.GetComponent <SeasonManager>();

        component.ForceBeginMeteorSeasonWithShower();
    }
 public void PlayStartSound()
 {
     if (KInputManager.isFocused && playSounds)
     {
         string text = currentSounds[0];
         if (text != null && text.Length > 0)
         {
             KFMOD.PlayOneShot(text);
         }
     }
 }
Exemple #6
0
 public void Select(KSelectable new_selected, bool skipSound = false)
 {
     if (!((Object)new_selected == (Object)previousSelection))
     {
         previousSelection = new_selected;
         if ((Object)selected != (Object)null)
         {
             selected.Unselect();
         }
         GameObject gameObject = null;
         if ((Object)new_selected != (Object)null)
         {
             SelectToolHoverTextCard component = GetComponent <SelectToolHoverTextCard>();
             if ((Object)component != (Object)null)
             {
                 int currentSelectedSelectableIndex     = component.currentSelectedSelectableIndex;
                 int recentNumberOfDisplayedSelectables = component.recentNumberOfDisplayedSelectables;
                 if (recentNumberOfDisplayedSelectables != 0)
                 {
                     currentSelectedSelectableIndex = (currentSelectedSelectableIndex + 1) % recentNumberOfDisplayedSelectables;
                     if (!skipSound)
                     {
                         if (recentNumberOfDisplayedSelectables == 1)
                         {
                             KFMOD.PlayOneShot(GlobalAssets.GetSound("Select_empty", false));
                         }
                         else
                         {
                             EventInstance instance = KFMOD.BeginOneShot(GlobalAssets.GetSound("Select_full", false), Vector3.zero);
                             instance.setParameterValue("selection", (float)currentSelectedSelectableIndex);
                             SoundEvent.EndOneShot(instance);
                         }
                         playedSoundThisFrame = true;
                     }
                 }
             }
             if ((Object)new_selected == (Object)hover)
             {
                 ClearHover();
             }
             new_selected.Select();
             gameObject = new_selected.gameObject;
             selectMarker.SetTargetTransform(gameObject.transform);
             selectMarker.gameObject.SetActive(!new_selected.DisableSelectMarker);
         }
         else if ((Object)selectMarker != (Object)null)
         {
             selectMarker.gameObject.SetActive(false);
         }
         selected = new_selected;
         Game.Instance.Trigger(-1503271301, gameObject);
     }
 }
 private void PlayClickSound()
 {
     if (play_sound_on_click)
     {
         if (states[state].on_click_override_sound_path == string.Empty)
         {
             KFMOD.PlayOneShot(GlobalAssets.GetSound("HUD_Click", false));
         }
         else
         {
             KFMOD.PlayOneShot(GlobalAssets.GetSound(states[state].on_click_override_sound_path, false));
         }
     }
 }
Exemple #8
0
    private void PlayTileDamageSound(Element element, Vector3 pos)
    {
        string text = element.substance.GetMiningBreakSound();

        if (text == null)
        {
            text = (element.HasTag(GameTags.RefinedMetal) ? "RefinedMetal" : ((!element.HasTag(GameTags.Metal)) ? "Rock" : "RawMetal"));
        }
        text = "MeteorDamage_" + text;
        text = GlobalAssets.GetSound(text, false);
        if ((bool)CameraController.Instance && CameraController.Instance.IsAudibleSound(pos, text))
        {
            KFMOD.PlayOneShot(text, CameraController.Instance.GetVerticallyScaledPosition(pos));
        }
    }
 public virtual void OnPointerDown(PointerEventData eventData)
 {
     clickHeldDown = true;
     if (play_sound_on_click)
     {
         if (states[state].on_click_override_sound_path == string.Empty)
         {
             KFMOD.PlayOneShot(GlobalAssets.GetSound("HUD_Click", false));
         }
         else
         {
             KFMOD.PlayOneShot(GlobalAssets.GetSound(states[state].on_click_override_sound_path, false));
         }
     }
 }
 public virtual void OnPointerUp(PointerEventData eventData)
 {
     if (clickHeldDown)
     {
         if (play_sound_on_release && states[state].on_release_override_sound_path != string.Empty)
         {
             KFMOD.PlayOneShot(GlobalAssets.GetSound(states[state].on_release_override_sound_path, false));
         }
         clickHeldDown = false;
         if (onStopHold != null)
         {
             onStopHold();
         }
     }
     totalHeldTime = 0f;
 }
Exemple #11
0
 private void PlayBuildingDamageSound(BuildingDef def, Vector3 pos)
 {
     if ((Object)def != (Object)null)
     {
         string name  = StringFormatter.Combine("MeteorDamage_Building_", def.AudioCategory);
         string sound = GlobalAssets.GetSound(name, false);
         if (sound == null)
         {
             name  = "MeteorDamage_Building_Metal";
             sound = GlobalAssets.GetSound(name, false);
         }
         if (sound != null && (bool)CameraController.Instance && CameraController.Instance.IsAudibleSound(pos, sound))
         {
             KFMOD.PlayOneShot(sound, CameraController.Instance.GetVerticallyScaledPosition(pos));
         }
     }
 }
Exemple #12
0
    public void OnPointerDown(PointerEventData eventData)
    {
        MinionIdentity minionIdentity = skillsScreen.CurrentlySelectedMinion as MinionIdentity;
        MinionResume   component      = minionIdentity.GetComponent <MinionResume>();

        MinionResume.SkillMasteryConditions[] skillMasteryConditions = component.GetSkillMasteryConditions(skillID);
        bool flag = component.CanMasterSkill(skillMasteryConditions);

        if ((UnityEngine.Object)component != (UnityEngine.Object)null && !component.HasMasteredSkill(skillID) && flag)
        {
            KFMOD.PlayOneShot(GlobalAssets.GetSound("HUD_Click", false));
        }
        else
        {
            KFMOD.PlayOneShot(GlobalAssets.GetSound("Negative", false));
        }
    }
 public void Play(int sound_event_idx)
 {
     if (Enabled)
     {
         WidgetSoundEvent widgetSoundEvent = default(WidgetSoundEvent);
         for (int i = 0; i < widget_sound_events().Length; i++)
         {
             if (sound_event_idx == widget_sound_events()[i].idx)
             {
                 widgetSoundEvent = widget_sound_events()[sound_event_idx];
                 break;
             }
         }
         if (KInputManager.isFocused && widgetSoundEvent.PlaySound && widgetSoundEvent.Name != null && widgetSoundEvent.Name.Length >= 0 && !(widgetSoundEvent.Name == string.Empty))
         {
             KFMOD.PlayOneShot(getSoundPath((!(widgetSoundEvent.OverrideAssetName == string.Empty)) ? widgetSoundEvent.OverrideAssetName : GetDefaultPath(widgetSoundEvent.idx)));
         }
     }
 }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state     = alive;
     base.serializable = true;
     alive.ParamTransition(death, dying_duplicant, (Instance smi, Death p) => p != null && smi.IsDuplicant).ParamTransition(death, dying_creature, (Instance smi, Death p) => p != null && !smi.IsDuplicant);
     dying_duplicant.ToggleAnims("anim_emotes_default_kanim", 0f).ToggleTag(GameTags.Dying).ToggleChore((Instance smi) => new DieChore(smi.master, death.Get(smi)), die);
     dying_creature.ToggleBehaviour(GameTags.Creatures.Die, (Instance smi) => true, delegate(Instance smi)
     {
         smi.GoTo(dead);
     });
     die.ToggleTag(GameTags.Dying).Enter("Die", delegate(Instance smi)
     {
         Death death2 = death.Get(smi);
         if (smi.IsDuplicant)
         {
             DeathMessage message = new DeathMessage(smi.gameObject, death2);
             KFMOD.PlayOneShot(GlobalAssets.GetSound("Death_Notification_localized", false), smi.master.transform.GetPosition());
             KFMOD.PlayOneShot(GlobalAssets.GetSound("Death_Notification_ST", false));
             Messenger.Instance.QueueMessage(message);
         }
     }).GoTo(dead);
     dead.ToggleAnims("anim_emotes_default_kanim", 0f).defaultState = dead.ground.TriggerOnEnter(GameHashes.Died, null).ToggleTag(GameTags.Dead).Enter(delegate(Instance smi)
     {
         smi.ApplyDeath();
         Game.Instance.Trigger(282337316, smi.gameObject);
     });
     dead.ground.Enter(delegate(Instance smi)
     {
         Death death = this.death.Get(smi);
         if (death == null)
         {
             death = Db.Get().Deaths.Generic;
         }
         if (smi.IsDuplicant)
         {
             smi.GetComponent <KAnimControllerBase>().Play(death.loopAnim, KAnim.PlayMode.Loop, 1f, 0f);
         }
     }).EventTransition(GameHashes.OnStore, dead.carried, (Instance smi) => smi.IsDuplicant && smi.HasTag(GameTags.Stored));
     dead.carried.ToggleAnims("anim_dead_carried_kanim", 0f).PlayAnim("idle_default", KAnim.PlayMode.Loop).EventTransition(GameHashes.OnStore, dead.ground, (Instance smi) => !smi.HasTag(GameTags.Stored));
 }
 protected override void OnShow(bool show)
 {
     if (show)
     {
         KFMOD.PlayOneShot(GlobalAssets.GetSound("Dialog_Popup", false));
         AudioMixer.instance.Start(AudioMixerSnapshots.Get().MENUNewDuplicantSnapshot);
         MusicManager.instance.PlaySong("Music_SelectDuplicant", false);
         hasShown = true;
     }
     else
     {
         AudioMixer.instance.Stop(AudioMixerSnapshots.Get().MENUNewDuplicantSnapshot, STOP_MODE.ALLOWFADEOUT);
         if (MusicManager.instance.SongIsPlaying("Music_SelectDuplicant"))
         {
             MusicManager.instance.StopSong("Music_SelectDuplicant", true, STOP_MODE.ALLOWFADEOUT);
         }
         if (Immigration.Instance.ImmigrantsAvailable && hasShown)
         {
             AudioMixer.instance.Start(AudioMixerSnapshots.Get().PortalLPDimmedSnapshot);
         }
     }
     base.OnShow(show);
 }
    private void Emit(object data)
    {
        GameObject gameObject = (GameObject)data;
        float      value      = Db.Get().Amounts.Temperature.Lookup(this).value;
        Equippable equippable = GetComponent <SuitEquipper>().IsWearingAirtightSuit();

        if ((Object)equippable != (Object)null)
        {
            equippable.GetComponent <Storage>().AddGasChunk(SimHashes.Methane, 0.1f, value, byte.MaxValue, 0, false, true);
        }
        else
        {
            Components.Cmps <MinionIdentity> liveMinionIdentities = Components.LiveMinionIdentities;
            Vector2 a = gameObject.transform.GetPosition();
            for (int i = 0; i < liveMinionIdentities.Count; i++)
            {
                MinionIdentity minionIdentity = liveMinionIdentities[i];
                if ((Object)minionIdentity.gameObject != (Object)gameObject.gameObject)
                {
                    Vector2 b   = minionIdentity.transform.GetPosition();
                    float   num = Vector2.SqrMagnitude(a - b);
                    if (num <= 2.25f)
                    {
                        minionIdentity.Trigger(508119890, Strings.Get("STRINGS.DUPLICANTS.DISEASES.PUTRIDODOUR.CRINGE_EFFECT").String);
                        minionIdentity.gameObject.GetSMI <ThoughtGraph.Instance>().AddThought(Db.Get().Thoughts.PutridOdour);
                    }
                }
            }
            int gameCell = Grid.PosToCell(gameObject.transform.GetPosition());
            SimMessages.AddRemoveSubstance(gameCell, SimHashes.Methane, CellEventLogger.Instance.ElementConsumerSimUpdate, 0.1f, value, byte.MaxValue, 0, true, -1);
            KBatchedAnimController kBatchedAnimController = FXHelpers.CreateEffect("odor_fx_kanim", gameObject.transform.GetPosition(), gameObject.transform, true, Grid.SceneLayer.Front, false);
            kBatchedAnimController.Play(WorkLoopAnims, KAnim.PlayMode.Once);
            kBatchedAnimController.destroyOnAnimComplete = true;
        }
        KFMOD.PlayOneShot(GlobalAssets.GetSound("Dupe_Flatulence", false), base.transform.GetPosition());
    }
Exemple #17
0
 public void OnPointerClick(PointerEventData eventData)
 {
     skillsScreen.CurrentlySelectedMinion = minion;
     KFMOD.PlayOneShot(GlobalAssets.GetSound("HUD_Click", false));
 }