private void setOptions() { OptionsComponent options = new OptionsComponent(7); OptionType option = new OptionType("Change Pattern", "Lindsey", Color.Red, new Vector2(24, 60), "Snake Pattern", new Rectangle(24, 60, 120, 30), "Menus/Highlight"); options.add(option); option = new OptionType("Change Color", "Lindsey", Color.Red, new Vector2(24, 90), "Snake Color", new Rectangle(24, 90, 120, 30), "Menus/Highlight"); options.add(option); TransitionWrapper transition = new BaseTransition(15, TransitionState.intro); transition = new FloatOptions(transition, new Vector2(-20, 0)); transition = new FadeOptions(transition); transition.setTransition(options); options.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatOptions(transition, new Vector2(20, 0)); transition = new FadeOptions(transition); options.Select = transition; transition.State = TransitionState.exit; options.Exit = transition; addComponent(options); }
private void setOptions() { OptionsComponent options = new OptionsComponent(7); OptionType option = new OptionType("Restart", "LindseySmall", Color.Red, new Vector2(120, 135), OptionAction.startGame, true, new Rectangle(120, 135, 120, 25), "Menus/Center Highlight"); option.ActivateTransition = false; option.Alignment = TextAlignment.center; options.add(option); option = new OptionType("Quit", "LindseySmall", Color.Red, new Vector2(120, 160), OptionAction.endGame, true, new Rectangle(120, 160, 120, 25), "Menus/Center Highlight"); option.Alignment = TextAlignment.center; options.add(option); TransitionWrapper transition = new BaseTransition(15, TransitionState.intro); transition = new FloatOptions(transition, new Vector2(15, 0)); transition = new FadeOptions(transition); transition.setTransition(options); options.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatOptions(transition, new Vector2(15, 0)); transition = new FadeOptions(transition); options.Select = transition; transition.State = TransitionState.exit; options.Exit = transition; addComponent(options); }
private void setOptions() { OptionsComponent options = new OptionsComponent(7); OptionType option = new OptionType("Start Game", "Lindsey", Color.Red, new Vector2(24, 100), OptionAction.startGame, true, new Rectangle(24, 100, 120, 30), "Menus/Highlight"); option.ActivateTransition = false; options.add(option); option = new OptionType("Select Level", "Lindsey", Color.Red, new Vector2(24, 130), "Select Level", new Rectangle(24, 130, 120, 30), "Menus/Highlight"); options.add(option); option = new OptionType("Options", "Lindsey", Color.Red, new Vector2(24, 160), "Options", new Rectangle(24, 160, 120, 30), "Menus/Highlight"); options.add(option); option = new OptionType("Exit", "Lindsey", Color.Red, new Vector2(24, 190), OptionAction.exit, false, new Rectangle(24, 190, 120, 30), "Menus/Highlight"); options.add(option); TransitionWrapper transition = new BaseTransition(15, TransitionState.intro); transition = new FloatOptions(transition, new Vector2(-20, 0)); transition = new FadeOptions(transition); transition.setTransition(options); options.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatOptions(transition, new Vector2(20, 0)); transition = new FadeOptions(transition); options.Select = transition; transition.State = TransitionState.exit; options.Exit = transition; addComponent(options); }
private void setOptions() { OptionsComponent options = new OptionsComponent(7); OptionType option = new OptionType("On", "Lindsey", Color.Red, new Vector2(120, 240), OptionAction.previous, true, new Rectangle(120, 240, 120, 30), "Menus/Center Highlight"); option.Alignment = TextAlignment.center; option.ActivateTransition = false; options.add(option); option = new OptionType("Off", "Lindsey", Color.Red, new Vector2(120, 270), OptionAction.previous, true, new Rectangle(120, 270, 120, 30), "Menus/Center Highlight"); option.Alignment = TextAlignment.center; option.ActivateTransition = false; options.add(option); TransitionWrapper transition = new BaseTransition(15, TransitionState.intro); transition = new FloatOptions(transition, new Vector2(0, 15)); transition = new FadeOptions(transition); transition.setTransition(options); options.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatOptions(transition, new Vector2(0, 15)); transition = new FadeOptions(transition); options.Select = transition; transition.State = TransitionState.exit; options.Exit = transition; addComponent(options); }
//Initialisation public static NotTransition CreateComponent(GameObject parent, BaseTransition transition) { NotTransition component = parent.AddComponent <NotTransition>(); component.Init(transition); return(component); }
private void setOptions() { OptionsComponent options = new OptionsComponent(7); OptionType option = new OptionType("Clear Scores", "Lindsey", Color.Red, new Vector2(24, 60), OptionAction.previous, false, new Rectangle(24, 60, 120, 30), "Menus/Highlight"); option.ActivateSelected = false; options.add(option); option = new OptionType("Back", "Lindsey", Color.Red, new Vector2(24, 90), OptionAction.previous, true, new Rectangle(24, 90, 120, 30), "Menus/Highlight"); option.ActivateSelected = true; options.add(option); TransitionWrapper transition = new BaseTransition(15, TransitionState.intro); transition = new FloatOptions(transition, new Vector2(-20, 0)); transition = new FadeOptions(transition); transition.setTransition(options); options.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatOptions(transition, new Vector2(20, 0)); transition = new FadeOptions(transition); options.Select = transition; transition.State = TransitionState.exit; options.Exit = transition; addComponent(options); }
public static BaseTransition CreateComponent(GameObject parent) { BaseTransition component = parent.AddComponent <BaseTransition>(); component.Init(); return(component); }
public override void FireEvent() { if (this.transition == null) { this.transition = new BaseTransition(); } if (this.sourceCamera == null || this.destinationCamera == null || this.transition == null) { Debug.LogError("Can't continue this transition with null cameras."); return; } this.transition.InitializeTransition(this.sourceCamera, this.destinationCamera, new List <Camera>(), new List <Camera>(), TypeOfTransition.Dissolve); }
static void Add(Dictionary <RectTransform, TransformInfo> dict, BaseTransition t) { if (t == null) { return; } var casted = (RectTransform)t.transform; if (!dict.ContainsKey(casted)) { dict.Add(casted, new TransformInfo(casted)); } }
private void RestoreTransformState(BaseTransition transition) { if (transition == null) { return; } var casted = (RectTransform)transition.transform; if (_originalStates.ContainsKey(casted)) { _originalStates[casted].ApplyTo(casted); } }
public FSMSoldierStateMachine(BaseSoldier owner) : base() { Owner = owner; FSMSoldierAlertState alertState = new FSMSoldierAlertState(owner); FSMSoldierAttackState attackState = new FSMSoldierAttackState(owner); AddNode(alertState); AddNode(attackState); CurState = alertState; //FSMSoldierTransition<BaseSoldier> trans1 = new FSMSoldierTransition<BaseSoldier>(); //trans1.Src = alertState.ID; //trans1.Dst = attackState.ID; //trans1.TransitCondition((BaseSoldier par) => { // return par.TargetSys.CurTarget && // CombatHolder.Instance.IsInAlertRange(par, par.TargetSys.CurTarget, 30.0f); //}); //AddEdge(trans1); //FSMSoldierTransition<BaseSoldier> trans2 = new FSMSoldierTransition<BaseSoldier>(); //trans2.TransitCondition((BaseSoldier par) => { // return par.TargetSys.CurTarget == null || // !CombatHolder.Instance.IsInAlertRange(par, par.TargetSys.CurTarget, 30.0f); //}); BaseTransition trans1 = new BaseTransition(); trans1.Src = alertState.ID; trans1.Dst = attackState.ID; trans1.TransitCondition(() => { return(Owner.TargetSys.CurTarget != null && Owner.TargetSys.CurTarget.IsAlive); //&& // CombatHolder.Instance.IsInAlertRange(Owner, Owner.TargetSys.CurTarget, 30.0f); }); AddEdge(trans1); BaseTransition trans2 = new BaseTransition(); trans2.TransitCondition(() => { return(Owner.TargetSys.CurTarget == null || !Owner.TargetSys.CurTarget.IsAlive); //|| // !CombatHolder.Instance.IsInAlertRange(Owner, Owner.TargetSys.CurTarget, 30.0f); }); trans2.Src = attackState.ID; trans2.Dst = alertState.ID; AddEdge(trans2); }
// Use this for initialization protected override void Awake() { base.Awake(); //Setup states PatrollingState patrollingState = gameObject.AddComponent <PatrollingState>(); patrollingState.SetNodes(m_patrollingNodes); patrollingState.SetMovementVelocity(m_forwardVelocity); MoveTowardsState moveTowardsState = gameObject.AddComponent <MoveTowardsState>(); moveTowardsState.SetMovementVelocity(m_forwardVelocity); InvestigateState investigateState = gameObject.AddComponent <InvestigateState>(); investigateState.SetMovementVelocity(m_forwardVelocity); IdleState idleState = gameObject.AddComponent <IdleState>(); idleState.SetRandomTime(m_idleMinTime, m_idleMaxTime); AttackingState attackingState = gameObject.AddComponent <AttackingState>(); FleeingState fleeingState = gameObject.AddComponent <FleeingState>(); fleeingState.SetMovementVelocity(m_forwardVelocity); fleeingState.SetFleeingMaxTime(m_fleeingMaxTime); //Assigning transitons patrollingState.AddInterruptTransition(TargetSightTransition.CreateComponent(gameObject, m_detectionRange), moveTowardsState); moveTowardsState.AddInterruptTransition(NotTransition.CreateComponent(gameObject, TargetSightTransition.CreateComponent(gameObject, m_detectionRange)), investigateState); moveTowardsState.AddInterruptTransition(TargetWithinRangeTransition.CreateComponent(gameObject, m_attackingRange), attackingState); investigateState.AddEndTransition(BaseTransition.CreateComponent(gameObject), idleState); investigateState.AddInterruptTransition(TargetSightTransition.CreateComponent(gameObject, m_detectionRange), moveTowardsState); idleState.AddEndTransition(BaseTransition.CreateComponent(gameObject), patrollingState); idleState.AddInterruptTransition(TargetSightTransition.CreateComponent(gameObject, m_detectionRange), moveTowardsState); attackingState.AddEndTransition(BaseTransition.CreateComponent(gameObject), fleeingState); fleeingState.AddEndTransition(BaseTransition.CreateComponent(gameObject), moveTowardsState); fleeingState.AddInterruptTransition(NotTransition.CreateComponent(gameObject, TargetWithinRangeTransition.CreateComponent(gameObject, m_fleeingDistance)), moveTowardsState); //Setup intial state GetComponent <StateManager>().SetInitialState(patrollingState); }
void CheckForCopyPasting() { if (transitions.Length > 0) { if (transitions[0] != null && !transitions[0].parent.Equals(this))//if the transitions parent isn't this object then this object has been copy pasted { BaseTransition temp = null; System.Type type; for (int i = 0; i < transitions.Length; i++) { type = transitions[i].GetType(); if (type.Equals(typeof(AlphaTransition))) { temp = gameObject.AddComponent <AlphaTransition>();//make a correct instance } else if (type.Equals(typeof(MovingTransition))) { temp = gameObject.AddComponent <MovingTransition>(); } else if (type.Equals(typeof(ScalingTransition))) { temp = gameObject.AddComponent <ScalingTransition>(); } else if (type.Equals(typeof(ColourTransition))) { temp = gameObject.AddComponent <ColourTransition>(); } else if (type.Equals(typeof(RotatingTransition))) { temp = gameObject.AddComponent <RotatingTransition>(); } else { temp = gameObject.AddComponent <BaseTransition>();//these are for manual transitions } if (temp != null) { temp.Clone(transitions[i]);//copy the other data temp.parent = this; temp.hideFlags = HideFlags.HideInInspector; transitions[i] = temp; } } } } }
/// <summary> /// Change the current screen. /// This will load the content of the screen if necessary /// </summary> /// <param name="screen">The screen to add to the stack</param> public void SetScreen(BaseScreen screen) { screenStack.Add(screen); if (!screen.isContentLoaded) { Task.Factory.StartNew(() => { this.state = State.Loading; screen.LoadContent(Game1.Instance.Content); this.transition = TransitionFactory.GetTransition(screen.transitionKind); this.transition.Start(); this.state = State.Transitioning; }); } }
void repositoryItemComboBox1_EditValueChanged(object sender, EventArgs e) { ComboBoxEdit edit = sender as ComboBoxEdit; if (edit != null) { TransitionType value = (TransitionType)edit.EditValue; BaseTransition transition = null; switch (value) { case TransitionType.Clock: transition = new DevExpress.Utils.Animation.ClockTransition(); break; case TransitionType.Comb: transition = new DevExpress.Utils.Animation.CombTransition(); break; case TransitionType.Cover: transition = new DevExpress.Utils.Animation.CoverTransition(); break; case TransitionType.Dissolve: transition = new DevExpress.Utils.Animation.DissolveTransition(); break; case TransitionType.Fade: transition = new DevExpress.Utils.Animation.FadeTransition(); break; case TransitionType.Push: transition = new DevExpress.Utils.Animation.PushTransition(); break; case TransitionType.Shape: transition = new DevExpress.Utils.Animation.ShapeTransition(); break; case TransitionType.SlideFade: transition = new DevExpress.Utils.Animation.SlideFadeTransition(); break; } this.workspaceManager1.TransitionType = transition; } }
private void setOptions() { OptionsComponent options = new OptionsComponent(7); OptionType option = new OptionType("Touch Pad", "Lindsey", Color.Red, new Vector2(24, 60), "Touch Pad", new Rectangle(24, 60, 120, 30), "Menus/Highlight"); option.ActivateSelected = false; options.add(option); option = new OptionType("Sound", "Lindsey", Color.Red, new Vector2(24, 90), "Sound", new Rectangle(24, 90, 120, 30), "Menus/Highlight"); option.ActivateSelected = false; options.add(option); option = new OptionType("Snake Options", "Lindsey", Color.Red, new Vector2(24, 120), "Snake Options", new Rectangle(24, 120, 120, 30), "Menus/Highlight"); options.add(option); option = new OptionType("High Scores", "Lindsey", Color.Red, new Vector2(24, 150), "High Scores", new Rectangle(24, 150, 120, 30), "Menus/Highlight"); options.add(option); option = new OptionType("How to Play", "Lindsey", Color.Red, new Vector2(24, 180), "How to Play", new Rectangle(24, 180, 120, 30), "Menus/Highlight"); options.add(option); option = new OptionType("About", "Lindsey", Color.Red, new Vector2(24, 210), "About", new Rectangle(24, 210, 120, 30), "Menus/Highlight"); options.add(option); TransitionWrapper transition = new BaseTransition(15, TransitionState.intro); transition = new FloatOptions(transition, new Vector2(-20, 0)); transition = new FadeOptions(transition); transition.setTransition(options); options.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatOptions(transition, new Vector2(20, 0)); transition = new FadeOptions(transition); options.Select = transition; transition.State = TransitionState.exit; options.Exit = transition; addComponent(options); }
private void setTitle() { TitleComponent title = new TitleComponent("Touch Pad", "Lindsey", Color.Yellow, new Vector2(120, 210), TextAlignment.center); TransitionWrapper transition; transition = new BaseTransition(15, TransitionState.intro); transition = new FloatTitle(transition, new Vector2(0, 15)); transition = new FadeTitle(transition); transition.setTransition(title); title.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatTitle(transition, new Vector2(0, -15)); transition = new FadeTitle(transition); title.Select = transition; transition.State = TransitionState.exit; title.Exit = transition; addComponent(title); }
private void setTitle() { TitleComponent title = new TitleComponent("High Scores", "LindseyLarge", Color.Yellow, new Vector2(25, 0)); TransitionWrapper transition; transition = new BaseTransition(15, TransitionState.intro); transition = new FloatTitle(transition, new Vector2(0, -20)); transition = new FadeTitle(transition); transition.setTransition(title); title.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatTitle(transition, new Vector2(0, 20)); transition = new FadeTitle(transition); title.Select = transition; transition.State = TransitionState.exit; title.Exit = transition; addComponent(title); }
private void setBackground() { BackgroundComponent background = new BackgroundComponent("Menus/Small Menu", new Vector2(25, 210), Color.White); TransitionWrapper transition; transition = new BaseTransition(15, TransitionState.intro); transition = new FloatBackground(transition, new Vector2(0, 15)); transition = new FadeBackground(transition); transition.setTransition(background); background.Intro = transition; transition = new BaseTransition(15, TransitionState.selected); transition = new FloatBackground(transition, new Vector2(0, -15)); transition = new FadeBackground(transition); background.Select = transition; transition.State = TransitionState.exit; background.Exit = transition; addComponent(background); }
/// <summary> /// Check all conditions in all transitions and if conditions are meat enters a new state. /// </summary> /// <param name="handler">State handler object</param> public void HandleTransitions(StateHandler handler) { var state = (handler.CurrentStateInterfaceHandler.CurrentState as BaseState); _transitionDone = false; HandleTransitionLoop(handler, _formAnyStateTransition); HandleTransitionLoop(handler, state.Transitions); if (Type == GraphType.Free || _transitionDone) { return; } for (int i = 0; i < state.ExitStateTransitions.Count; i++) { BaseTransition transition = state.ExitStateTransitions[i]; if (transition.Validate(handler)) { break; } } }
/// <summary> /// Called whilst cloning to add new components as needed /// </summary> /// <param name="transition"></param> void CloneTransition(int i, BaseTransition transition) { if (transition.GetType().Equals(typeof(AlphaTransition))) { transitions[i] = gameObject.AddComponent <AlphaTransition>(); } else if (transition.GetType().Equals(typeof(ColourTransition))) { transitions[i] = gameObject.AddComponent <ColourTransition>(); } else if (transition.GetType().Equals(typeof(MovingTransition))) { transitions[i] = gameObject.AddComponent <MovingTransition>(); } else if (transition.GetType().Equals(typeof(RotatingTransition))) { transitions[i] = gameObject.AddComponent <RotatingTransition>(); } else if (transition.GetType().Equals(typeof(ScalingTransition))) { transitions[i] = gameObject.AddComponent <ScalingTransition>(); } else if (transition.GetType().Equals(typeof(BaseTransition))) { transitions[i] = gameObject.AddComponent <BaseTransition>(); } else { Debug.LogError("Attempted to clone an unrecognized transition!"); } }
public void AddEndTransition(BaseTransition endTransition, BaseState nextState) { endTransition.SetNextState(nextState); m_endTransition = endTransition; }
public void AddInterruptTransition(BaseTransition interruptTransition, BaseState nextState) { interruptTransition.SetNextState(nextState); m_interruptTransitions.Add(interruptTransition); }
private void Init(BaseTransition transition) { m_transition = transition; }
/** * This method runs the state machine - it checks for * transitions, applies them and returns a list of actions. */ public virtual Action Update() { // The variable to hold the actions to perform Action actions = null; // First case - we have no current state. if (CurrentState == null) { // In this case we use the entry action for the initial state. if (InitialState != null) { // Transition to the first state CurrentState = InitialState; // Returns the initial states entry actions actions = CurrentState.GetEntryActions(); } else { // We have nothing to do actions = null; } } // Otherwise we have a current state to work with else { // Start off with no transition Transition transition = null; // Check through each transition in the current state. BaseTransition testTransition = CurrentState.FirstTransition; while (testTransition != null) { if (testTransition.IsTriggered()) { transition = (Transition)testTransition; break; } testTransition = testTransition.Next; } // Check if we found a transition if (transition != null) { // Find our destination StateMachineState nextState = transition.GetTargetState(); // Accumulate our list of actions Action tempList = null; Action last = null; // Add each element to the list in turn actions = CurrentState.GetExitActions(); last = actions.GetLast(); tempList = transition.GetActions(); last.Next = tempList; last = tempList.GetLast(); tempList = nextState.GetActions(); last.Next = tempList; // Update the change of state CurrentState = nextState; } // Otherwise our actions to perform are simply those for the // current state. else { actions = CurrentState.GetActions(); } } return(actions); }
//切换场景 public SceneResut goToScene(string sceneID, SceneTransEffect type, float duration = 0) { Log.info("当前scene" + currentScene + " goTo :" + sceneID); //CLogSys.Log(ELogLevel.Verbose, ELogTag.Map, ("goToScene " + sceneID)); if (ModuleManager.IsOpen(sceneID) == false) { return(SceneResut.Close); } if (currentScene == sceneID) { //CLogSys.Log(ELogLevel.Verbose, ELogTag.Map, "相同场景,不做切换 .." + sceneID); return(SceneResut.Error); } if (isRunning == true) { //CLogSys.Log(ELogLevel.Verbose, ELogTag.Map, "GoToScene isRunning..."); return(SceneResut.Error); } DOTween.PauseAll(); //如果是需要过渡场景,此字段用于存储过渡场景切换用的目标值 willLoadScene = sceneID; string path = ""; switch (type) { //执行场景切换 case SceneTransEffect.None: path = "SceneTrans_None"; break; // case SceneTransEffect.Common: // sceneID = "CommonLoad"; // path = "SceneTrans_None"; // break; case SceneTransEffect.Fade: path = "SceneTrans_Fade"; break; } GameObject go = ResDataManager.instance.GetObjectFromLocalPrefab("GUI/_Common/" + path); if (go == null) { Log.infoError("[SceneManager]预置文件无效:" + path); return(SceneResut.Error); } GameObject prefab = GameObject.Instantiate(go) as GameObject; BaseTransition effect = prefab.GetComponent <BaseTransition>(); effect.willLoadSceneID = sceneID; effect.duration = duration; effect.enabled = true; effect.onLoadProcess = OnLoadProcess; return(SceneResut.Open); }
protected void SetTransitionObject(TransitionType ttype, BaseTransition obj) { m_transitionObjectDict[ttype] = obj; }
void CheckForCopyPasting() { #region Check if selected bool selected = false; if (Selection.gameObjects != null) { for (int i = 0; i < Selection.gameObjects.Length; i++) { if (Selection.gameObjects[i].Equals(gameObject))//if selected { selected = true; break; } } } if (Selection.activeGameObject != null) { if (Selection.activeGameObject.Equals(gameObject)) { selected = true; } } if (!selected) { return; } #endregion if (transitions.Length > 0) { if (transitions[0] != null && !transitions[0].parent.Equals(this))//if the transitions parent isn't this object then this object has been copy pasted { BaseTransition temp = null; System.Type type; for (int i = 0; i < transitions.Length; i++) { type = transitions[i].GetType(); if (type.Equals(typeof(AlphaTransition))) { temp = gameObject.AddComponent <AlphaTransition>();//make a correct instance } else if (type.Equals(typeof(MovingTransition))) { temp = gameObject.AddComponent <MovingTransition>(); } else if (type.Equals(typeof(ScalingTransition))) { temp = gameObject.AddComponent <ScalingTransition>(); } else if (type.Equals(typeof(ColourTransition))) { temp = gameObject.AddComponent <ColourTransition>(); } else if (type.Equals(typeof(RotatingTransition))) { temp = gameObject.AddComponent <RotatingTransition>(); } else { temp = gameObject.AddComponent <BaseTransition>();//these are for manual transitions } if (temp != null) { Debug.LogError("Added transitions to: " + gameObject + " Parent:" + transitions[0].parent + " " + (transitions[0].parent.GetHashCode() == GetHashCode())); temp.Clone(transitions[i]);//copy the other data temp.parent = this; temp.hideFlags = HideFlags.HideInInspector; transitions[i] = temp; } } } } }
private void HandleCreateEvents() { Event e = Event.current; switch (e.type) { case EventType.mouseDown: if (e.button == 1) { GenericMenu genericMenu = new GenericMenu(); IEnumerable <Type> types = AppDomain.CurrentDomain.GetAssemblies().SelectMany(assembly => assembly.GetTypes()).Where(type => type.IsSubclassOf(typeof(State)) && type != typeof(AnyState)); foreach (Type type in types) { object[] attributes = type.GetCustomAttributes(true); string category = string.Empty; bool flag = true; bool isTrigger = false; foreach (object attribute in attributes) { if (attribute is CategoryAttribute) { category = (attribute as CategoryAttribute).Category + "/"; } if (attribute is CanCreateAttribute) { flag = (attribute as CanCreateAttribute).CanCreate; } if (attribute is TriggerAttribute) { isTrigger = true; } } if (flag) { genericMenu.AddItem(new GUIContent((isTrigger?"Create Trigger/":"Create State/") + category + type.ToString().Split('.').Last()), false, new GenericMenu.MenuFunction2(this.OnCreateStateCallback), new object[] { type, Event.current.mousePosition }); } } genericMenu.ShowAsContext(); e.Use(); } break; case EventType.mouseUp: if (connectionIndex != -1) { foreach (State node in controller.states) { if (node.position.Contains(e.mousePosition) && node.GetType() != typeof(AnyState)) { BaseTransition transition = ScriptableObject.CreateInstance <BaseTransition>(); // new BaseTransition (controller.states [connectionIndex].id, node.id, controller); transition.fromState = controller.states [connectionIndex]; transition.toState = node; AssetDatabase.AddObjectToAsset(transition, transition.fromState); AssetDatabase.SaveAssets(); transition.fromState.transitions.Add(transition); } } connectionIndex = -1; } break; } }
private ScreenManager() { screenStack = new List <BaseScreen>(); transition = new FadeInTransition(); }