/// <summary> /// Start animating a light behaviour with the specified ID. If the specified ID is empty, it will start animating all light behaviour entries. /// If specified light behaviours are already animating, calling this does nothing. /// Multiple light behaviours can have the same ID. /// </summary> public void StartLightBehaviour(string id = "") { foreach (var container in _animations) { if (container.LightBehaviour.ID == id || id == string.Empty) { if (!_animationPlayer.HasRunningAnimation(KeyPrefix + container.Key)) { container.LightBehaviour.UpdatePlaybackValues(container.Animation); _animationPlayer.Play(container.Animation, KeyPrefix + container.Key); } } } }
private void ActivateAnimation(ISpriteComponent spriteComponent, AnimationPlayerComponent animationPlayer, string key) { if (!_animations.TryGetValue(key, out var animation)) { return; } if (!animationPlayer.HasRunningAnimation(key)) { spriteComponent.LayerSetVisible(LayerMap[key], true); animationPlayer.Play(animation, key); } }