public AnimationGroup(Animation animation, double duration) : this(duration) { Animations.Add(animation); }
public void Add(Animation animation, double duration, bool loops = false) { _animationGroups.Add(new AnimationGroup(animation, duration){Loops = loops}); }
public void Remove(Animation animation) { var removePairs = new List<Tuple<AnimationGroup, Animation>>(); foreach(AnimationGroup group in _animationGroups) { foreach(Animation anim in group.Animations) { if(anim == animation) { removePairs.Add(new Tuple<AnimationGroup, Animation>(group, anim)); } } } foreach(Tuple<AnimationGroup, Animation> removePair in removePairs) { removePair.Item1.Animations.Remove(removePair.Item2); if(removePair.Item1.Animations.Count == 0) { RemoveGroup(removePair.Item1); } } }
public ParticleSystem(Game game, Player player, bool isSand = false) : base(game) { DrawOrder = 50; Player = player; Particles = new Dictionary<string, Particle>(1000); IsSand = isSand; _particleQueue = new HashSet<Particle>(); _createParticleQueue = new HashSet<Particle>(); if(IsSand) { _fireParticles = new ParticleSystem(Game, Player); Children.Add(_fireParticles); _burningSound = Storage.Sound("SandBurning").CreateInstance(); _burningSound.Volume = 0.0f; _burningSound.IsLooped = true; _burningSound.Play(); _updateRemoteSandTimer = new Animation { CompletedDelegate = UpdateRemoteSand }; _updateRemoteSandTimerGroup = new AnimationGroup(_updateRemoteSandTimer, 60) { Loops = true }; Storage.AnimationController.AddGroup(_updateRemoteSandTimerGroup); } }
private void DecrementCounter() { CurrentValue--; if(CurrentValue == 0) { Storage.AnimationController.RemoveGroup(_countdownAnimationGroup); _countdownAnimation = null; _countdownAnimationGroup = null; if(_completeDelegate != null) { _completeDelegate(); } } }
public void Start(int num, int ms, CountdownComplete completeDelegate) { if(Storage.DebugMode) { ms = ms / 10; } _maxValue = CurrentValue = num; _frameTime = ms; _completeDelegate = completeDelegate; if(_countdownAnimationGroup != null) { Storage.AnimationController.RemoveGroup(_countdownAnimationGroup); _countdownAnimation = null; _countdownAnimationGroup = null; } _countdownAnimation = new Animation { CompletedDelegate = DecrementCounter }; _countdownAnimationGroup = new AnimationGroup(_countdownAnimation, ms) { Loops = true }; Storage.AnimationController.AddGroup(_countdownAnimationGroup); }
public void WinPulse(Team team, Button.Action completedAction) { _winPulseTeam = team; _winPulseAnimation = new Animation(this, "PulseValue", 0.0f, 10.0f, Easing.EaseInOut, EasingType.Linear); _winPulseAnimationGroup = new AnimationGroup(_winPulseAnimation, 10000.0f) {Loops = true}; Storage.AnimationController.AddGroup(_winPulseAnimationGroup); }
public void EndWinPulse() { if(_winPulseAnimationGroup != null) { Storage.AnimationController.RemoveGroup(_winPulseAnimationGroup); _winPulseAnimationGroup = null; _winPulseAnimation = null; } }