public TransitionLine GetLine(TransitionKind kind) { TransitionLine ln = null; Lines.TryGetValue(kind, out ln); return(ln); }
public void UpdateTransitionEnabled(TransitionKind kind, bool enabled) { // // Update whether the transitions are enabled. // foreach (var transition in _entries) { if (transition.Kind == kind) { transition.IsEnabled = enabled; } } // // If we have started, but there is no transition playing, then being a new transition. // - See comment in NextTransition() about "_started". // if (_started && (_transitionPlaying == TransitionKind.None)) { NextTransition(); } }
public TransitionLine(TransitionKind kind, TransitionGraphics drawer, int yPos, int height) { Kind = kind; ParentDrawer = drawer; OffsetY = yPos; Height = height; }
/// <summary> /// Get an transition based on it's kind. /// It will new the transition if it hasn't been used yet. /// This will also call the Reset from BaseTransition /// </summary> /// <param name="kind">The kind of transition</param> /// <returns>An resetted transition based on the kind</returns> public static BaseTransition GetTransition(TransitionKind kind) { if (transitions == null) { transitions = new Dictionary <TransitionKind, BaseTransition>(); } if (!transitions.Keys.Contains <TransitionKind>(kind)) { switch (kind) { case TransitionKind.FadeIn: transitions.Add(kind, new FadeInTransition()); break; case TransitionKind.FadeOut: transitions.Add(kind, new FadeOutTransition()); break; } } BaseTransition transition = transitions[kind]; transition.Reset(); return(transition); }
/// <summary> /// Creates a new Transition instance. /// </summary> /// <param name="game"> /// A reference to our Game instance. /// </param> /// <param name="transitionTime"> /// The total amount of time the transition will take. /// </param> /// <param name="kind"> /// The type of transition. /// </param> public Transition(Game1 game, TimeSpan transitionTime, TransitionKind kind) { _game = game; TransitionTimeRemaining = TransitionTime = transitionTime; Kind = kind; CreateRenderTarget(); }
public Handler(State targetState, TransitionKind kind, Action <Dictionary <string, object> > action, Func <Dictionary <string, object>, bool> guard) { this.targetState = targetState; this.kind = kind; this.action = action; this.guard = guard; }
public Transition(State sourceState, Handler handler) { this.sourceState = sourceState; this.targetState = handler.targetState; this.kind = handler.kind; this.action = handler.action; this.guard = handler.guard; }
public void createHandler(string eventName, State target, TransitionKind kind, Action <Dictionary <string, object> > action, Func <Dictionary <string, object>, bool> guard) { Handler handler = new Handler(target, kind, action, guard); if (!handlers.ContainsKey(eventName)) { handlers[eventName] = new List <Handler>(); } handlers[eventName].Add(handler); }
public Transition(Vertex source, Vertex rootSource, Vertex target, Vertex rootTarget, Func <bool> guard, Action effect, TransitionKind kind) { Source = source; RootSource = rootSource; Target = target; RootTarget = rootTarget; Guard = guard; Effect = effect; Kind = kind; }
public TransitionLine SetFocusLine(TransitionKind lnKind) { foreach (var ln in Lines.Values) { ln.IsFocused = false; } if (lnKind == TransitionKind.Unknown) { return(null); } Lines[lnKind].IsFocused = true; return(Lines[lnKind]); }
private IEnumerator Fade_raw(float duration, TransitionKind transitionKind) { float timeCursor = 0; float startVolume = this.Volume; while (timeCursor < duration) { timeCursor += Time.deltaTime; float a = transitionKind == TransitionKind.In ? (timeCursor / duration) : (1 - (timeCursor / duration)); Volume = startVolume * a; yield return(null); } Volume = startVolume * (transitionKind == TransitionKind.In ? 1 : 0); }
public TransitionEntry( TransitionKind kind, NextTileHandler nextTile, CreateTransitionHandler createTransition, TransitionOptions options, TransitionDesaturationMode desaturationMode) { Kind = kind; NextTile = nextTile; CreateTransition = createTransition; Options = options; DesaturationMode = desaturationMode; IsEnabled = true; }
/// <summary> /// Creates a new instance of the Transition class. /// </summary> /// <param name="source">The source of the transition.</param> /// <param name="target">The target of the transition</param> /// <param name="kind">The kind of the transition defining its behavior. Note that this may be overriden for to Internal if no target vertex is supplied.</param> public Transition(Vertex <TInstance> source, Vertex <TInstance> target = null, TransitionKind kind = TransitionKind.External) { this.Source = source; this.Target = target; this.Kind = target != null ? kind : TransitionKind.Internal; this.guard = (source is PseudoState <TInstance>) ? Transition <TInstance> .TrueGuard : (message, instance) => message == this.Source; this.Source.Outgoing.Add(this); if (this.Target != null) { this.Target.Incoming.Add(this); } this.Source.Root.Clean = false; }
public void RefreshTransitionLine(TransitionKind kind) { if (kind != TransitionKind.Unknown) { Lines[kind].Refresh(); } else { foreach (TransitionKind tk in Enum.GetValues(typeof(TransitionKind))) { if (tk != TransitionKind.Unknown) { Lines[tk].Refresh(); } } } }
/// <summary> /// Get an transition based on it's kind. /// It will new the transition if it hasn't been used yet. /// This will also call the Reset from BaseTransition /// </summary> /// <param name="kind">The kind of transition</param> /// <returns>An resetted transition based on the kind</returns> public static BaseTransition GetTransition(TransitionKind kind) { if(transitions == null) { transitions = new Dictionary<TransitionKind, BaseTransition>(); } if (!transitions.Keys.Contains<TransitionKind>(kind)) { switch(kind) { case TransitionKind.FadeIn: transitions.Add(kind, new FadeInTransition()); break; case TransitionKind.FadeOut: transitions.Add(kind, new FadeOutTransition()); break; } } BaseTransition transition = transitions[kind]; transition.Reset(); return transition; }
public Transition_Element(ElementInfo e, TransitionKind kind) { Element = e; Kind = kind; }
public StateMachine AddAutoTransition(State source, State target, Func <bool> guard = null, Action effect = null, TransitionKind kind = TransitionKind.External) { Assert.IsTrue(!(source is FinalState)); Region lca = LCA(source, target); Assert.AreEqual(lca.StateMachine, this); Vertex rootSource = FindRoot(source, lca); Vertex rootTarget = FindRoot(target, lca); Assert.IsNotNull(rootSource); Assert.IsNotNull(rootTarget); Transition t = new Transition(source, rootSource, target, rootTarget, guard, effect, kind); lca.AddAutoTransitionImpl(t); return(this); }
public BaseScreen(Vector2 position, TransitionKind transitionKind) { this.position = position; this.isFullscreen = false; this.transitionKind = transitionKind; }
/// <summary> /// Creates a new FadeTransition instance. /// </summary> /// <param name="game"> /// A reference to our Game instance. /// </param> /// <param name="transitionTime"> /// The total amount of time the transition will take. /// </param> /// <param name="kind"> /// The type of transition. /// </param> public FadeTransition(Game1 game, TimeSpan transitionTime, TransitionKind kind) : base(game, transitionTime, kind) { }
public Transition_Element_Create(ElementInfo e, TransitionKind kind, float timeBegin, float timeLen) : base(e, kind) { ResultTransform = System.Activator.CreateInstance(ElementTransform.TransTypes[Kind], Element, timeBegin, timeLen) as ElementTransform; }
public static T AddHandler <T>(this T state, string eventName, State target, TransitionKind kind) where T : State { state.createHandler(eventName, target, kind, null, null); return(state); }
public ControlTransition(TransitionKind kind) { this.Kind = kind; }
/// <summary> /// Creates a new EvenOddTransition instance. /// </summary> /// <param name="game"> /// A reference to our Game instance. /// </param> /// <param name="tileSize"> /// The width and height, in pixels, of a tile. /// </param> /// <param name="transitionTime"> /// The total amount of time the transition will take. /// </param> /// <param name="kind"> /// The type of transition. /// </param> public EvenOddTileTransition(Game1 game, int tileSize, TimeSpan transitionTime, TransitionKind kind) : base(game, transitionTime, kind) { _transitionHalfTime = TransitionTime.TotalSeconds / 2; _tileSize = tileSize; }
public void UpdateTransitionEnabled(TransitionKind kind, bool enabled) { // Update whether the transitions are enabled. foreach (var transition in _entries) { if (transition.Kind == kind) { transition.IsEnabled = enabled; } } // If we have started, but there is no transition playing, then being a new transition. // - See comment in NextTransition() about "_started". if (_started && (_currentTransition == null)) { NextTransition(); } }
public Transition_Element_Split(ElementInfo e, TransitionKind kind, ElementTransform trans, float time) : base(e, kind) { TargetTransform = trans; Time = time; }
public static T AddHandler <T>(this T state, string eventName, State target, TransitionKind kind, Action <Dictionary <string, object> > action, Func <Dictionary <string, object>, bool> guard) where T : State { state.createHandler(eventName, target, kind, action, guard); return(state); }
public Transition_Element_Add(ElementInfo e, TransitionKind kind) : base(e, kind) { }
public BaseScreen(TransitionKind transitionKind = TransitionKind.FadeIn) { this.position = Vector2.Zero; this.isFullscreen = true; this.transitionKind = transitionKind; }
/// <summary> /// /// </summary> /// <param name="target"></param> /// <param name="kind"></param> /// <returns></returns> public Transition <TInstance> To(Vertex <TInstance> target = null, TransitionKind kind = TransitionKind.External) { return(new Transition <TInstance>(this, target, kind)); }
public void Fade(float duration, TransitionKind transitionKind) { StartCoroutine(Fade_raw(duration, transitionKind)); }