32 lines
650 B
C#
32 lines
650 B
C#
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Bullets/Crusher.cs")]
|
|
public partial class Crusher : Control
|
|
{
|
|
[Export(PropertyHint.None, "")]
|
|
private VisibleOnScreenNotifier2D visibility;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private AudioStream sound;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private float shake = 1f;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private float shakeTime = 10f;
|
|
|
|
public void DoNoise()
|
|
{
|
|
if (visibility == null || visibility.IsOnScreen())
|
|
{
|
|
CameraController.Shake(shakeTime, shake);
|
|
Audio.PlaySound(sound);
|
|
}
|
|
}
|
|
|
|
}
|