Event System

This commit is contained in:
Marco 2025-02-13 16:10:22 +01:00
commit f379eac5c3
10 changed files with 336 additions and 10 deletions

View file

@ -46,17 +46,36 @@ public partial class Door : Activable
public override void Activate(ActivationType activationType = ActivationType.Toggle)
{
switch (State)
switch (activationType)
{
case DoorState.Closed:
case ActivationType.Toggle:
switch (State)
{
case DoorState.Closed:
Open();
break;
case DoorState.Open:
Close();
break;
default:
throw new ArgumentOutOfRangeException();
}
break;
case ActivationType.Enable:
Open();
break;
case DoorState.Open:
case ActivationType.Disable:
Close();
break;
case ActivationType.Use:
break;
case ActivationType.Destroy:
break;
default:
throw new ArgumentOutOfRangeException();
throw new ArgumentOutOfRangeException(nameof(activationType), activationType, null);
}
}
private void SetState(DoorState state)