/// <summary> /// Get animaiton components /// </summary> private void Awake() { if (ColorBlender == null) { ColorBlender = GetComponent <ColorTransition>(); } if (MovePosition == null) { MovePosition = GetComponent <MoveToPosition>(); } if (ScaleSize == null) { ScaleSize = GetComponent <ScaleToValue>(); } // get renderer Renderer renderer = GetComponent <Renderer>(); if (renderer != null) { mMaterial = renderer.material; } }
override protected void rhythmUpdate(int beat) { int sizeP = positions.Length; if (sizeP <= 1) { return; } int idxP = beat + offsetP; if (indicesP.Length > 0) { int idxA = indicesP[idxP % indicesP.Length]; int idxB = indicesP[(idxP + 1) % indicesP.Length]; StartCoroutine(move(positions[idxA % sizeP], positions[idxB % sizeP], secondsPerBeat)); } else { StartCoroutine(move(positions[idxP % sizeP], positions[(idxP + 1) % sizeP], secondsPerBeat)); } int sizeC = colorTransitions.Length; if (sizeC < 0) { return; } int idxC = beat + offsetC; if (indicesC.Length > 0) { idxC = indicesC[idxC % indicesC.Length]; } if (idxC < 0) { return; } ColorTransition t = colorTransitions[idxC % sizeC]; if (t.smooth) { StartCoroutine(changeSmooth(t.startColor, t.endColor, secondsPerBeat)); } else { if (shared) { renderer.sharedMaterial.color = t.endColor; } else { renderer.material.color = t.endColor; } } }
private void Awake() { blackTransition = transitionBlack.GetComponent <ColorTransition>(); gameInput.enabled = false; InitScenePositions(); //InitScenes(); }
public ColorTransitionAnimation(MonoBehaviour obj, ColorTransition transition, float duration = 1f, bool noChildren = false, Action after = null) { this.texts = noChildren ? new SpriteRenderer[] { obj.GetComponentInChildren <SpriteRenderer>() } : obj.GetComponentsInChildren <SpriteRenderer>(); this.Progress = 0f; this.HasFinished = false; this.duration = duration; this.transition = transition; this.obj = obj; this.after = after; }
/// <summary> /// set the ColorBlender /// </summary> private void Awake() { if (ColorBlender == null) { ColorBlender = GetComponent <ColorTransition>(); } if (ColorBlender == null) { Debug.LogError("ColorBlender is not on the gameObject: " + name); Destroy(this); } }
void Awake() { // get the TextMesh mTextMesh = GetComponent <TextMesh>(); if (mTextMesh != null && mTextColorTheme != null) { mTextMesh.color = mTextColorTheme.GetThemeValue(Interactive.ButtonStateEnum.Default); } // get the ColorBlender if on self if (ColorBlender == null) { ColorBlender = GetComponent <ColorTransition>(); } }
private void timer2_Tick(object sender, EventArgs e) { if (roundOne) { panel1.BackColor = Color.Blue; ColorTransition.ShowSync(panel1); Transition.ShowSync(label2); timer2.Stop(); timerPause1s.Start(); roundOne = false; roundTwo = true; } else if (roundTwo) { panel1.BackColor = Color.Red; ColorTransition.ShowSync(panel1); Transition.ShowSync(label3); timer2.Stop(); timerPause1s.Start(); roundTwo = false; roundThree = true; } else if (roundThree) { panel1.BackColor = Color.Gold; ColorTransition.ShowSync(panel1); Transition.ShowSync(label4); timer2.Stop(); timerPause1s.Start(); roundThree = false; roundFour = true; } else if (roundFour) { panel1.BackColor = Color.Green; ColorTransition.ShowSync(panel1); Transition.ShowSync(label5); timer2.Stop(); timerPause1s.Start(); roundFour = false; finalRound = true; } }
private IEnumerator StartAnimation() { var invisible = new Color(1f, 1f, 1f, 0.5f); var fadeOut = new ColorTransition(Color.white, invisible, ColorTransition.KEEP_VISIBLE_COLORS); var fadeIn = new ColorTransition(invisible, Color.white, ColorTransition.KEEP_VISIBLE_COLORS); var blinkDuration = 0.2f; var blinkAnimations = new List <PremadeAnimation>(); for (var i = 0; i < 5; i++) { blinkAnimations.Add(new ColorTransitionAnimation(witchSprite, fadeOut, duration: blinkDuration)); blinkAnimations.Add(new ColorTransitionAnimation(witchSprite, fadeIn, duration: blinkDuration)); } var animation = new AnimationChain(witchSprite, blinkAnimations).Start(); yield return(new WaitUntil(() => animation.HasFinished)); this.recovering = false; }
void Awake() { // get the color blender if (ColorBlender == null) { ColorBlender = GetComponent <ColorTransition>(); } // get the renderer and material Renderer renderer = GetComponent <Renderer>(); if (renderer != null) { mMaterial = renderer.material; } if (mMaterial != null && mColorTheme != null) { mMaterial.color = mColorTheme.GetThemeValue(State); } }
void Awake() { // get the color tweener if (ColorBlender == null) { ColorBlender = GetComponent <ColorTransition>(); } // get the renderer and material Renderer renderer = GetComponent <Renderer>(); if (renderer != null) { mMaterial = renderer.material; } if (mMaterial != null && mColorTheme != null) { mMaterial.color = mColorTheme.GetThemeValue(Interactive.ButtonStateEnum.Default); } }
private void timerPause1s_Tick(object sender, EventArgs e) { if (roundOne) { Transition.HideSync(label1); ColorTransition.HideSync(panel1); timer2.Start(); timerPause1s.Stop(); } else if (roundTwo) { Transition.HideSync(label2); ColorTransition.HideSync(panel1); timer2.Start(); timerPause1s.Stop(); } else if (roundThree) { Transition.HideSync(label3); ColorTransition.HideSync(panel1); timer2.Start(); timerPause1s.Stop(); } else if (roundFour) { Transition.HideSync(label4); ColorTransition.HideSync(panel1); timer2.Start(); timerPause1s.Stop(); } else if (finalRound) { timerPause1s.Stop(); this.Close(); } }
void OnMouseUp() { colorTransition = ColorTransition.DoTransition(gameObject, new GradientColorKey[] { new GradientColorKey(Color.blue, 0), new GradientColorKey(Color.black, 0.5f), new GradientColorKey(Color.green, 1) }); colorTransition.Duration = 1; colorTransition.LoopMode = TransitionLoopModes.PlayOnce; }
void OnMouseExit() { colorTransition = ColorTransition.DoTransition(gameObject, new GradientColorKey[] { new GradientColorKey(Color.white, 0), new GradientColorKey(Color.yellow, 1) }); colorTransition.Duration = 0.5f; colorTransition.LoopMode = TransitionLoopModes.PlayOnce; }
// Use this for initialization void Start() { _colorTransition = GetComponent <ColorTransition>(); _cutOff = GetComponent <ImageCutOff>(); }
protected override void LoadContent() { Content.RootDirectory = "Content"; Graphics.PreferredBackBufferWidth = SCREEN_WIDTH; Graphics.PreferredBackBufferHeight = SCREEN_HEIGHT; Graphics.IsFullScreen = false; Graphics.ApplyChanges(); IsMouseVisible = true; Debug = new CollisionRenderer (GraphicsDevice); StateManager = new StateManager(); SpriteBatch = new SpriteBatch (GraphicsDevice); C = Content; BloomRenderer = new BloomComponent(this); BloomRenderer.LoadContent(); InventoryManager = new InventoryManager(); DialogFont = C.Load<SpriteFont> ("fonts/debug"); HoverFont = C.Load<SpriteFont> ("fonts/debug"); DialogManager = new DialogManager { MessageBounds = new Rectangle(15, 15 + (int)InventoryManager.Bounds.Bottom, SCREEN_WIDTH, 300), Font = DialogFont, }; Player = new Player(); StateManager.Add (new TentState()); StateManager.Add (new CampState()); StateManager.Add (new ForestState()); StateManager.Set ("Tent"); Activated += (s, a) => Active = true; Deactivated += (s, a) => Active = false; FadeIn = new ColorTransition (Graphics.GraphicsDevice, SCREEN_WIDTH, SCREEN_HEIGHT, 0.45f, Color.Black, Color.Transparent); FadeOut = new ColorTransition (Graphics.GraphicsDevice, SCREEN_WIDTH, SCREEN_HEIGHT, 0.45f, Color.Transparent, Color.Black); }
public static ColorTransitionAnimation buildFadeIn(MonoBehaviour obj, float duration = 1f, bool noChildren = false, Action after = null) { var fadeOutTransition = new ColorTransition(new Color(1f, 1f, 1f, 0f), Color.white, BlinkAnimation.KEEP_VISIBLE_COLORS); return(new ColorTransitionAnimation(obj, fadeOutTransition, duration, noChildren, after)); }