cards/CardDolphin.cs
using Sandbox;
using System.Threading.Tasks;
using System.Xml.Linq;
public class CardDolphin : Card
{
public override bool IsAlive => true;
public override bool ShouldHandleEvent( EventType eventType )
{
return eventType == EventType.Mismatch && !Manager.Instance.ChosenCards.Contains(this) && Manager.Instance.Stats[StatType.ConsecutiveMismatches] == 3;
}
public override async Task HandleEventAsync( EventType eventType )
{
Manager.Instance.PushEventMessage( this, eventType );
await Task.DelayRealtime( 250 );
Manager.Instance.PlayCardSfx( "card_flip", this, volume: 0.8f, pitch: Game.Random.Float( 1.15f, 1.2f ) );
await Task.DelayRealtime( 100 );
Manager.Instance.PlayCardSfx( "dolphin", this, volume: 0.8f, pitch: Game.Random.Float( 1f, 1.15f ) );
await Manager.Instance.RevealCard( this );
await Task.DelayRealtime( Game.Random.Int(400, 700) );
Manager.Instance.HideCard( this );
Manager.Instance.PlayCardSfx( "card_flip", this, volume: 0.7f, pitch: Game.Random.Float( 0.65f, 0.75f ) );
Manager.Instance.PopEventMessage();
}
}