IDs and access (#319)

* something about access

* Fixed deny animation
This commit is contained in:
DamianX
2019-09-01 22:57:22 +02:00
committed by Pieter-Jan Briers
parent 0329150109
commit f3b460c8b4
13 changed files with 205 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ namespace Content.Client.GameObjects.Components.Doors
private Animation CloseAnimation;
private Animation OpenAnimation;
private Animation DenyAnimation;
public override void LoadData(YamlMappingNode node)
{
@@ -23,6 +24,7 @@ namespace Content.Client.GameObjects.Components.Doors
var openSound = node.GetNode("open_sound").AsString();
var closeSound = node.GetNode("close_sound").AsString();
var denySound = node.GetNode("deny_sound").AsString();
CloseAnimation = new Animation {Length = TimeSpan.FromSeconds(1.2f)};
{
@@ -57,6 +59,18 @@ namespace Content.Client.GameObjects.Components.Doors
OpenAnimation.AnimationTracks.Add(sound);
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(openSound, 0));
}
DenyAnimation = new Animation {Length = TimeSpan.FromSeconds(0.45f)};
{
var flick = new AnimationTrackSpriteFlick();
DenyAnimation.AnimationTracks.Add(flick);
flick.LayerKey = DoorVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("deny", 0f));
var sound = new AnimationTrackPlaySound();
DenyAnimation.AnimationTracks.Add(sound);
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(denySound, 0));
}
}
public override void InitializeEntity(IEntity entity)
@@ -102,6 +116,13 @@ namespace Content.Client.GameObjects.Components.Doors
sprite.LayerSetState(DoorVisualLayers.Base, "open");
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, false);
break;
case DoorVisualState.Deny:
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, false);
if (!animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Play(DenyAnimation, AnimationKey);
}
break;
default:
throw new ArgumentOutOfRangeException();
}