private void OnTriggerEnter2D(Collider2D collision) { PlayerControls pc = collision.GetComponent <PlayerControls>(); MonsterCharacter mc = collision.GetComponent <MonsterCharacter>(); if (pc == null || mc == null) { return; } if (mc.ammunition[AmmoType] >= mc.maxAmmo[AmmoType]) { return; } mc.ammunition[AmmoType] = Mathf.Min(mc.ammunition[AmmoType] + AmmoAmount, mc.maxAmmo[AmmoType]); mc.OnAmmoPickup.Invoke(AmmoType); if (PickupSound != null) { Sounds.Create2DSound(PickupSound, Sounds.MixerGroup.Effects, Volume, MinPitch, MaxPitch); } Destroy(gameObject); }
private void Awake() { button = GetComponent <SimpleButton>(); Messaging.GUI.OpenWindow.AddListener((s) => { if (s == CheckWindowName) { Refresh(); } }); button.OnClick.AddListener(() => { if (PlayerInfoHolder.LoadedHolders.Count > 0) { if (ClickSound != null) { Sounds.Create2DSound(ClickSound, Sounds.MixerGroup.Interface, .2f, 1f, 1f, 255); } Messaging.GUI.OpenWindow.Invoke(OpenWindowName); } else if (DisabledSound != null) { Sounds.Create2DSound(DisabledSound, Sounds.MixerGroup.Interface, .4f, 1f, 1f, 0); } }); }
private void OnTriggerEnter2D(Collider2D collision) { PlayerControls pc = collision.GetComponent <PlayerControls>(); MonsterCharacter mc = collision.GetComponent <MonsterCharacter>(); if (pc == null || mc == null) { return; } if (mc.HitPoints >= mc.MaxHitPoints) { return; } mc.HitPoints += HealAmount; mc.OnHealthPickup.Invoke(); if (PickupSound != null) { Sounds.Create2DSound(PickupSound, Sounds.MixerGroup.Effects, Volume, MinPitch, MaxPitch); } Destroy(gameObject); }
private void Awake() { GetComponent <GUIButton>().onClick.AddListener(() => { if (string.IsNullOrEmpty(TargetLevel)) { if (FailSound != null) { Sounds.Create2DSound(FailSound, Sounds.MixerGroup.Interface, .6f, 1f, 1f, 255); } return; } Messaging.Mission.BeginMission.Invoke(); Messaging.GUI.CloseWindows.Invoke(); if (LevelLoader.LevelLoaded) { Messaging.System.SetTimeScale.Invoke(TimeScale.Standard); Messaging.GUI.ChangeCursor.Invoke(1); } }); Messaging.Mission.SetNextMission.AddListener((s) => { TargetLevel = s; gameObject.SetActive(!string.IsNullOrEmpty(TargetLevel)); }); gameObject.SetActive(false); }
public void OnPointerEnter(PointerEventData eventData) { if (EnterSound != null) { Sounds.Create2DSound(EnterSound, Sounds.MixerGroup.Interface, .2f, 1f, 1f, 255); } OnCursorEnter.Invoke(); }
public void OnPointerClick(PointerEventData eventData) { if (ClickSound != null) { Sounds.Create2DSound(ClickSound, Sounds.MixerGroup.Interface, .2f, 1f, 1f, 255); } OnClick.Invoke(); }
public void OnPointerEnter(PointerEventData eventData) { image.color = image.sprite == null ? Color.clear : EnterColor; if (EnterSound != null) { Sounds.Create2DSound(EnterSound, Sounds.MixerGroup.Interface, .2f, 1f, 1f, 255); } OnCursorEnter.Invoke(); }