// changes color of drawables as they move public void ChangeColor(MoveDel action, Color endColor, float d) { tweenerColorR = new Tweener(attributes.color.R, endColor.R, d, action); tweenerColorG = new Tweener(attributes.color.G, endColor.G, d, action); tweenerColorB = new Tweener(attributes.color.B, endColor.B, d, action); tweenerA = new Tweener(attributes.color.A, endColor.A, d, action); }
// method to set all the tweeners to null public void ClearTweeners() { tweenerX = null; tweenerColorR = null; tweenerY = null; tweenerRotate = null; tweenerDepth = null; tweenerColorG = null; tweenerColorB = null; tweenerA = null; tweenerScaleX = null; tweenerScaleY = null; }
// changes depth of drawables w delay public void ChangeDepth(MoveDel action, float endDepth, float d, float delay) { tweenerDepth = new Tweener(attributes.depth, endDepth, delay, d, action); }
// public void WhenDoneMoving(Tweener.EndHandler process) { tweenerX.Ended += process; }
// rescales drawables with a delay // not needed public void Scale(MoveDel action, Vector2 endScale, float d, float delay) { tweenerScaleX = new Tweener(attributes.scale.X, endScale.X, delay, d, action); tweenerScaleY = new Tweener(attributes.scale.Y, endScale.Y, delay, d, action); }
// public void WhenDoneFading(Tweener.EndHandler process) { tweenerA.Ended += process; }
// rotates drawables public void Rotate(MoveDel action, float endRotation, float d) { tweenerRotate = new Tweener(attributes.rotation, endRotation, d, action); }
// moves drawables with a delay public void Move(MoveDel action, Vector2 endPosition, float d, float delay) { isMoving = true; tweenerX = new Tweener(attributes.position.X, endPosition.X, delay, d, action); tweenerY = new Tweener(attributes.position.Y, endPosition.Y, delay, d, action); tweenerX.Ended += delegate() { this.isMoving = false; tweenerX = null;}; tweenerY.Ended += delegate() { tweenerY = null; }; }
// makes drawables fade away given a certain amount of time public void Fade(float d) { Color oldColor = attributes.color; ChangeColor(Actions.LinearMove, Color.Transparent, d); tweenerColorB.Ended += delegate() { tweenerColorB = null; }; tweenerColorR.Ended += delegate() { tweenerColorR = null; }; tweenerColorG.Ended += delegate() { tweenerColorG = null; }; tweenerA.Ended += delegate() { isSeeable = false; tweenerA = null; attributes.color = oldColor; }; }
// uses tweeners to tell when times are begun and ended, semi-roundabout public void SetTimer(int timerNumber, float endTime, Tweener.EndHandler whenEnded) { timer[timerNumber] = new Tweener(0, 1, endTime, Actions.LinearMove); timer[timerNumber].Ended += whenEnded; }