protected override void SimpleInit() { AnimationComponent animComponent; if (!ObjectPrivate.TryGetFirstComponent <AnimationComponent>(out animComponent)) { Log.Write(LogLevel.Error, "SimpleAnimation.Init", "Object must have an animation added at edit time for SimpleAnimation to work"); return; } animation = animComponent.DefaultAnimation; initialAnimationParameters = animation.GetParameters(); Subscribe(null); if (EnableEvent != "") { SubscribeToAll(EnableEvent, Subscribe); } if (DisableEvent != "") { SubscribeToAll(DisableEvent, Unsubscribe); } }
protected override void SimpleInit() { AnimationComponent animComponent; if (!ObjectPrivate.TryGetFirstComponent <AnimationComponent>(out animComponent)) { Log.Write(LogLevel.Error, "SimpleAnimation.Init", "Object must have an animation added at edit time for SimpleAnimation to work"); return; } animation = animComponent.DefaultAnimation; if (!string.IsNullOrWhiteSpace(RangeA)) { string[] frames = RangeA.Split(new char[] { ':', ',' }, StringSplitOptions.RemoveEmptyEntries); if (frames.Length != 2 || !int.TryParse(frames[0].Trim(), out RangeAStart) || !int.TryParse(frames[1].Trim(), out RangeAEnd)) { SimpleLog(LogLevel.Error, "Invalid RangeA parameter: '" + RangeA + "'. Should be two integers separated by a colon, ex 0:10"); RangeAStart = RangeAEnd = 0; } } if (!string.IsNullOrWhiteSpace(RangeA)) { string[] frames = RangeB.Split(new char[] { ':', ',' }, StringSplitOptions.RemoveEmptyEntries); if (frames.Length != 2 || !int.TryParse(frames[0].Trim(), out RangeBStart) || !int.TryParse(frames[1].Trim(), out RangeBEnd)) { SimpleLog(LogLevel.Error, "Invalid RangeB parameter: '" + RangeB + "'. Should be two integers separated by a colon, ex 0:10"); RangeBStart = RangeBEnd = 0; } } initialAnimationParameters = animation.GetParameters(); Subscribe(null); if (EnableEvent != "") { SubscribeToAll(EnableEvent, Subscribe); } if (DisableEvent != "") { SubscribeToAll(DisableEvent, Unsubscribe); } }