private static AnimatorController GenerateSelectableAnimatorContoller(AnimationTriggers animationTriggers, Selectable target) { if (target == null) return null; // Where should we create the controller? var path = GetSaveControllerPath(target); if (string.IsNullOrEmpty(path)) return null; // figure out clip names var normalName = string.IsNullOrEmpty(animationTriggers.normalTrigger) ? "Normal" : animationTriggers.normalTrigger; var highlightedName = string.IsNullOrEmpty(animationTriggers.highlightedTrigger) ? "Highlighted" : animationTriggers.highlightedTrigger; var pressedName = string.IsNullOrEmpty(animationTriggers.pressedTrigger) ? "Pressed" : animationTriggers.pressedTrigger; var disabledName = string.IsNullOrEmpty(animationTriggers.disabledTrigger) ? "Disabled" : animationTriggers.disabledTrigger; // Create controller and hook up transitions. var controller = AnimatorController.CreateAnimatorControllerAtPath(path); GenerateTriggerableTransition(normalName, controller); GenerateTriggerableTransition(highlightedName, controller); GenerateTriggerableTransition(pressedName, controller); GenerateTriggerableTransition(disabledName, controller); AssetDatabase.ImportAsset(path); return controller; }
public void SetAnimatorTrigger(AnimationTriggers trigger) { foreach (Animator anim in m_Animator) { anim.SetTrigger(trigger.Value); } }
private static AnimatorController GenerateSelectableAnimatorContoller(AnimationTriggers animationTriggers, Selectable target) { if ((UnityEngine.Object)target == (UnityEngine.Object)null) { return((AnimatorController)null); } string saveControllerPath = SelectableEditor.GetSaveControllerPath(target); if (string.IsNullOrEmpty(saveControllerPath)) { return((AnimatorController)null); } string name1 = !string.IsNullOrEmpty(animationTriggers.normalTrigger) ? animationTriggers.normalTrigger : "Normal"; string name2 = !string.IsNullOrEmpty(animationTriggers.highlightedTrigger) ? animationTriggers.highlightedTrigger : "Highlighted"; string name3 = !string.IsNullOrEmpty(animationTriggers.pressedTrigger) ? animationTriggers.pressedTrigger : "Pressed"; string name4 = !string.IsNullOrEmpty(animationTriggers.disabledTrigger) ? animationTriggers.disabledTrigger : "Disabled"; AnimatorController controllerAtPath = AnimatorController.CreateAnimatorControllerAtPath(saveControllerPath); SelectableEditor.GenerateTriggerableTransition(name1, controllerAtPath); SelectableEditor.GenerateTriggerableTransition(name2, controllerAtPath); SelectableEditor.GenerateTriggerableTransition(name3, controllerAtPath); SelectableEditor.GenerateTriggerableTransition(name4, controllerAtPath); AssetDatabase.ImportAsset(saveControllerPath); return(controllerAtPath); }
static AnimatorController GenerateSelectableAnimatorContoller(AnimationTriggers animationTriggers, SelectableHelper target) { if (target == null) { return(null); } var path = GetSaveControllerPath(target); if (string.IsNullOrEmpty(path)) { return(null); } var normalName = string.IsNullOrEmpty(animationTriggers.normalTrigger) ? "Normal" : animationTriggers.normalTrigger; var highlightedName = string.IsNullOrEmpty(animationTriggers.highlightedTrigger) ? "Highlighted" : animationTriggers.highlightedTrigger; var pressedName = string.IsNullOrEmpty(animationTriggers.pressedTrigger) ? "Pressed" : animationTriggers.pressedTrigger; var disabledName = string.IsNullOrEmpty(animationTriggers.disabledTrigger) ? "Disabled" : animationTriggers.disabledTrigger; var controller = AnimatorController.CreateAnimatorControllerAtPath(path); GenerateTriggerableTransition(normalName, controller); GenerateTriggerableTransition(highlightedName, controller); GenerateTriggerableTransition(pressedName, controller); GenerateTriggerableTransition(disabledName, controller); return(controller); }
private static AnimatorController GenerateSelectableAnimatorContoller(AnimationTriggers animationTriggers, Selectable target) { AnimatorController result; if (target == null) { result = null; } else { string saveControllerPath = SelectableEditor.GetSaveControllerPath(target); if (string.IsNullOrEmpty(saveControllerPath)) { result = null; } else { string name = (!string.IsNullOrEmpty(animationTriggers.normalTrigger)) ? animationTriggers.normalTrigger : "Normal"; string name2 = (!string.IsNullOrEmpty(animationTriggers.highlightedTrigger)) ? animationTriggers.highlightedTrigger : "Highlighted"; string name3 = (!string.IsNullOrEmpty(animationTriggers.pressedTrigger)) ? animationTriggers.pressedTrigger : "Pressed"; string name4 = (!string.IsNullOrEmpty(animationTriggers.disabledTrigger)) ? animationTriggers.disabledTrigger : "Disabled"; AnimatorController animatorController = AnimatorController.CreateAnimatorControllerAtPath(saveControllerPath); SelectableEditor.GenerateTriggerableTransition(name, animatorController); SelectableEditor.GenerateTriggerableTransition(name2, animatorController); SelectableEditor.GenerateTriggerableTransition(name3, animatorController); SelectableEditor.GenerateTriggerableTransition(name4, animatorController); AssetDatabase.ImportAsset(saveControllerPath); result = animatorController; } } return(result); }
private void DoSetValue() { if (selectable == null) { return; } _animationTriggers = selectable.animationTriggers; if (!normalTrigger.IsNone) { _animationTriggers.normalTrigger = normalTrigger.Value; } if (!highlightedTrigger.IsNone) { _animationTriggers.highlightedTrigger = highlightedTrigger.Value; } if (!pressedTrigger.IsNone) { _animationTriggers.pressedTrigger = pressedTrigger.Value; } if (!disabledTrigger.IsNone) { _animationTriggers.disabledTrigger = disabledTrigger.Value; } selectable.animationTriggers = _animationTriggers; }
private static AnimatorController GenerateSelectableAnimatorContoller(AnimationTriggers animationTriggers, Selectable target) { if (target == null) { return(null); } // Where should we create the controller? var path = GetSaveControllerPath(target); if (string.IsNullOrEmpty(path)) { return(null); } // figure out clip names var normalName = string.IsNullOrEmpty(animationTriggers.normalTrigger) ? "Normal" : animationTriggers.normalTrigger; var highlightedName = string.IsNullOrEmpty(animationTriggers.highlightedTrigger) ? "Highlighted" : animationTriggers.highlightedTrigger; var pressedName = string.IsNullOrEmpty(animationTriggers.pressedTrigger) ? "Pressed" : animationTriggers.pressedTrigger; var disabledName = string.IsNullOrEmpty(animationTriggers.disabledTrigger) ? "Disabled" : animationTriggers.disabledTrigger; // Create controller and hook up transitions. var controller = AnimatorController.CreateAnimatorControllerAtPath(path); GenerateTriggerableTransition(normalName, controller); GenerateTriggerableTransition(highlightedName, controller); GenerateTriggerableTransition(pressedName, controller); GenerateTriggerableTransition(disabledName, controller); AssetDatabase.ImportAsset(path); return(controller); }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); m_Assist = (UIToggleAssist)(target); m_Assist.interactable = EditorGUILayout.Toggle("Interactable", m_Assist.interactable); m_Assist.transition = (Selectable.Transition)EditorGUILayout.EnumPopup("Transition", m_Assist.transition); if (m_Assist.transition == Selectable.Transition.ColorTint) { m_Assist.targetGraphic = (Image)EditorGUILayout.ObjectField("\u3000Target Graphic", m_Assist.targetGraphic, typeof(Image), false); ColorBlock temp_colors = m_Assist.colors; temp_colors.normalColor = EditorGUILayout.ColorField("\u3000Normal Color", m_Assist.colors.normalColor); temp_colors.highlightedColor = EditorGUILayout.ColorField("\u3000Highlighted Color", m_Assist.colors.highlightedColor); temp_colors.pressedColor = EditorGUILayout.ColorField("\u3000Pressed Color", m_Assist.colors.pressedColor); temp_colors.disabledColor = EditorGUILayout.ColorField("\u3000Disabled Color", m_Assist.colors.disabledColor); temp_colors.colorMultiplier = EditorGUILayout.Slider("\u3000Color Multiplier", m_Assist.colors.colorMultiplier, 1, 5); temp_colors.fadeDuration = EditorGUILayout.FloatField("\u3000Fade Duration", m_Assist.colors.fadeDuration); m_Assist.colors = temp_colors; } else if (m_Assist.transition == Selectable.Transition.SpriteSwap) { m_Assist.targetGraphic = (Image)EditorGUILayout.ObjectField("\u3000Target Graphic", m_Assist.targetGraphic, typeof(Image), false); SpriteState temp_sprite = m_Assist.spriteState; temp_sprite.highlightedSprite = (Sprite)EditorGUILayout.ObjectField("\u3000Highlighted Sprite", m_Assist.spriteState.highlightedSprite, typeof(Sprite), false); temp_sprite.pressedSprite = (Sprite)EditorGUILayout.ObjectField("\u3000Pressed Sprite", m_Assist.spriteState.pressedSprite, typeof(Sprite), false); temp_sprite.disabledSprite = (Sprite)EditorGUILayout.ObjectField("\u3000Disabled Sprite", m_Assist.spriteState.disabledSprite, typeof(Sprite), false); m_Assist.spriteState = temp_sprite; } else if (m_Assist.transition == Selectable.Transition.Animation) { AnimationTriggers temp_Animation = m_Assist.animationTriggers; temp_Animation.normalTrigger = EditorGUILayout.TextField("\u3000Normal Trigger", m_Assist.animationTriggers.normalTrigger); temp_Animation.highlightedTrigger = EditorGUILayout.TextField("\u3000Highlighted Trigger", m_Assist.animationTriggers.highlightedTrigger); temp_Animation.pressedTrigger = EditorGUILayout.TextField("\u3000Pressed Trigger", m_Assist.animationTriggers.pressedTrigger); temp_Animation.disabledTrigger = EditorGUILayout.TextField("\u3000Disabled Trigger", m_Assist.animationTriggers.disabledTrigger); m_Assist.animationTriggers = temp_Animation; } EditorGUILayout.Space(); Navigation temp_Navigation = m_Assist.navigation; temp_Navigation.mode = (Navigation.Mode)EditorGUILayout.EnumPopup("Navigation", m_Assist.navigation.mode); EditorGUILayout.Space(); m_Assist.isOn = EditorGUILayout.Toggle("Is On", m_Assist.isOn); m_Assist.toggleTransition = (Toggle.ToggleTransition)EditorGUILayout.EnumPopup("Toggle Transition", m_Assist.toggleTransition); m_Assist.graphic = (Graphic)EditorGUILayout.ObjectField("Graphic", m_Assist.graphic, typeof(Graphic), false); m_Assist.group = (ToggleGroup)EditorGUILayout.ObjectField("Group", m_Assist.group, typeof(ToggleGroup), false); EditorGUILayout.Space(); EditorGUILayout.PropertyField(ValueChanged); if (ValueChangedGame != null) { EditorGUILayout.PropertyField(ValueChangedGame); } //刷新数据存储 serializedObject.ApplyModifiedProperties(); }
protected override void ReadFromImpl(object obj) { base.ReadFromImpl(obj); AnimationTriggers uo = (AnimationTriggers)obj; normalTrigger = uo.normalTrigger; highlightedTrigger = uo.highlightedTrigger; pressedTrigger = uo.pressedTrigger; disabledTrigger = uo.disabledTrigger; }
protected override object WriteToImpl(object obj) { obj = base.WriteToImpl(obj); AnimationTriggers uo = (AnimationTriggers)obj; uo.normalTrigger = normalTrigger; uo.highlightedTrigger = highlightedTrigger; uo.pressedTrigger = pressedTrigger; uo.disabledTrigger = disabledTrigger; return(uo); }
public SelectableObjectProperties(Selectable selectable) { animationTriggers = selectable.animationTriggers; colors = selectable.colors; image = selectable.image; interactable = selectable.interactable; navigation = selectable.navigation; spriteState = selectable.spriteState; targetGraphic = selectable.targetGraphic; transition = selectable.transition; }
public void Collect(Component c) { comp = c as S; interactable = comp.interactable; transition = comp.transition; navigation = comp.navigation; targetGraphic = comp.targetGraphic; colors = comp.colors; spriteStates = comp.spriteState; animationTriggers = comp.animationTriggers; enabled = comp.enabled; Collect(comp); }
private bool TriggerEquals(AnimationTriggers t1, AnimationTriggers t2) { if (t1 == t2) { return(true); } if (t1 == null || t2 == null) { return(false); } return(t1.disabledTrigger == t2.disabledTrigger && t1.highlightedTrigger == t2.highlightedTrigger && t1.normalTrigger == t2.normalTrigger && t1.pressedTrigger == t2.pressedTrigger && t1.selectedTrigger == t2.selectedTrigger); }
/// <summary> /// 从<see cref="XmlReader"/>中读取指定名称的<see cref="AnimationTriggers"/>元素。 /// </summary> /// <param name="reader">读取器</param> /// <param name="name">属性名称</param> /// <returns>属性的值</returns> public static AnimationTriggers GetAnimationTriggers(this XmlReader reader, string name) { if (!reader.IsStartElement(name)) { return(new AnimationTriggers()); } var ret = new AnimationTriggers { normalTrigger = reader.GetAttribute(AttributeNormalTrigger), highlightedTrigger = reader.GetAttribute(AttributeHighlightedTrigger), pressedTrigger = reader.GetAttribute(AttributePressedTrigger), disabledTrigger = reader.GetAttribute(AttributeDisabledTrigger), }; return(ret); }
public static int get_highlightedTrigger(IntPtr l) { int result; try { AnimationTriggers animationTriggers = (AnimationTriggers)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, animationTriggers.highlightedTrigger); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int constructor(IntPtr l) { int result; try { AnimationTriggers o = new AnimationTriggers(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public override void OnEnter() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (UpdateCache(go)) { selectable = cachedComponent; } if (selectable != null && resetOnExit.Value) { originalAnimationTriggers = selectable.animationTriggers; } DoSetValue(); Finish(); }
private static int set_animationTriggers(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); Selectable selectable = (Selectable)obj; AnimationTriggers animationTriggers = (AnimationTriggers)ToLua.CheckObject(L, 2, typeof(AnimationTriggers)); selectable.animationTriggers = animationTriggers; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index animationTriggers on a nil value"); } return(result); }
public static int set_highlightedTrigger(IntPtr l) { int result; try { AnimationTriggers animationTriggers = (AnimationTriggers)LuaObject.checkSelf(l); string highlightedTrigger; LuaObject.checkType(l, 2, out highlightedTrigger); animationTriggers.highlightedTrigger = highlightedTrigger; LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
void Start() { bullet = weaponItemRef.bullet; refFireType = weaponItemRef.fireType; damage = weaponItemRef.damage; ammoMax = weaponItemRef.maxAmmo; ammoCurr = ammoMax; secBetweenFire = weaponItemRef.secBetweenFire; reloadTime = weaponItemRef.reloadTime; volleyCount = weaponItemRef.volleyCount; volleyDelay = weaponItemRef.volleyDelay; bulletSpread = weaponItemRef.bulletSpread; bloomInc = weaponItemRef.bloomIncrement; bloomDec = weaponItemRef.bloomDecrement; needsAnimationEvent = weaponItemRef.needsAnimationEvent; if (needsAnimationEvent) { animTriggers = GetComponentInChildren <AnimationTriggers>(); animTriggers.FireTrigger += AnimFireTrigger; animTriggers.FireReset += AnimFireReset; } if (sectionParent == null) { sectionParent = GetComponentInParent <Section>(); } if (mechManager == null) { mechManager = transform.root.GetComponent <MechManager>(); } bloomCurr = 0; //weaponGroup = (int)weaponItemRef.AmmoType; }
public void TriggerAnimation(AnimationTriggers trigger) { _animator.SetTrigger(trigger.ToString()); }
/// <summary> /// 向<see cref="XmlWriter"/>中写入指定的<see cref="AnimationTriggers"/>元素。 /// </summary> /// <param name="writer">写入器</param> /// <param name="name">属性名称</param> /// <param name="value">属性的值</param> public static void WriteAnimationTriggers(this XmlWriter writer, string name, AnimationTriggers value) { writer.WriteStartElement(name); writer.WriteAttributeString(AttributeNormalTrigger, value.normalTrigger); writer.WriteAttributeString(AttributePressedTrigger, value.pressedTrigger); writer.WriteAttributeString(AttributeHighlightedTrigger, value.highlightedTrigger); writer.WriteAttributeString(AttributeDisabledTrigger, value.disabledTrigger); writer.WriteEndElement(); }