private void ApplyAnimationStyle(IndicatorAnimation value) { var index = (int)value; if (null == stylesCache[index]) { var assembly = typeof(BusyIndicatorAnimation).GetTypeInfo().Assembly; var resourceName = "LibraProgramming.Windows.UI.Xaml.BusyIndicatorAnimation." + index + ".xaml"; using (var reader = new StreamReader(assembly.GetManifestResourceStream(resourceName))) { var xaml = reader.ReadToEnd(); stylesCache[index] = XamlReader.Load(xaml) as Style; } } animation?.Stop(); AnimationStyle = stylesCache[index]; if (null != animation && String.Equals(RunningStateName, CurrentVisualState)) { animation.Start(); } }
void Awake() { _gameManager = (GameManager)FindObjectOfType(typeof(GameManager)); _indicators = transform.FindChild("GameIndicators").GetComponent <IndicatorAnimation>(); _navAgent = GetComponent <NavMeshAgent>(); _gameManager.timeManager.OnNewYear += CheckAge; _gameManager.timeManager.OnNewMonth += DeplishCarrot; _sprite = GetComponent <SpriteRenderer>(); }
/* * private void OnContentPositionChanged(ContentPosition value) * { * SynchronizeContentPosition(); * } */ private void OnIndicatorAnimationChanged(IndicatorAnimation value) { ApplyAnimationStyle(value); }