private void InitializeHold() { string animName = Agent.AnimSet.GetBlockAnim(BlockState.HOLD, Agent.BlackBoard.weaponSelected); AnimationTools.PlayAnim(Agent.AnimEngine, animName, 0.05f); _endOfStateTime = _blockHoldEndTime; _blockState = BlockState.HOLD; Agent.BlackBoard.motionType = MotionType.BLOCK; }
public void HideDock() { if (!DockIsVisible) { return; } double dockHeight = DockIcons.ActualHeight + Distance + TopMargin; AnimationTools.TranslateY(SettingsManager.Settings.DockHideDuration, DockTop + dockHeight, Canvas.TopProperty, DockIcons); DockIsVisible = false; }
/// <summary> /// Hides time slider. /// </summary> private void TimeGrid_MouseLeave(object sender, MouseEventArgs e) { if (UseAnimation) { AnimationTools.FadeOut(TimeSlider); } else { TimeSlider.Visibility = Visibility.Hidden; } }
private void InitializeEnd() { string animName = Agent.AnimSet.GetBlockAnim(global::BlockState.END, Agent.BlackBoard.weaponSelected); AnimationTools.PlayAnim(Agent.AnimEngine, animName, 0.05f); _endOfStateTime = Time.timeSinceLevelLoad + Agent.AnimEngine[animName].length * 0.9f; Agent.BlackBoard.motionType = MotionType.NONE; _blockState = BlockState.END; }
protected override void Initialize(FSMEvent ev = null) { _eventInjury = ev as AnimFSMEventInjuryBoss; _curInjuryPhaseIDX = 0; string animName = Agent.AnimSet.GetInjuryPhaseAnim(_curInjuryPhaseIDX); AnimationTools.PlayAnim(Agent.AnimEngine, animName, 0.1f); _endOfStateTime = Agent.AnimEngine[animName].length + Time.timeSinceLevelLoad; Agent.BlackBoard.motionType = MotionType.NONE; }
/// <summary> /// Hides tool buttons. /// </summary> private void ToolGrid_MouseLeave(object sender, MouseEventArgs e) { if (UseAnimation) { AnimationTools.FadeOut(ToggleRepeatButton); } else { ToggleRepeatButton.Visibility = Visibility.Hidden; } }
void Start() { // StartCoroutine(WaitCoroutine(2)); // StartCoroutine(UpdateCoroutine()); // StartCoroutine(AnimationTools.MultiTranslateCoroutine(this, 5, Easings.EasingFunctionDelegate(m_EasingFunction))); StartCoroutine(InOutActionCoroutine( () => { MDebug.Log("in"); }, () => { MDebug.Log("out"); }, AnimationTools.MultiTranslateCoroutine(this, 5, Easings.EasingFunctionDelegate(m_EasingFunction)) )); }
private static AnimationInterface DrawBehaviourAnimationAnimationData(ICEWorldBehaviour _control, AnimationInterface _animation_data) { Animation _animation = _control.GetComponentInChildren <Animation>(); if (_animation != null && _animation.enabled == true) { Info.Help(Info.ANIMATION_ANIMATION); if (EditorApplication.isPlaying) { EditorGUILayout.LabelField("Name", _animation_data.Name); } else { string _animation_name = AnimationPopup(_animation, _animation_data.Name, "Animation (" + _animation_data.Length.ToString() + " secs.)", Info.ANIMATION_NAME); if (_animation_name != _animation_data.Name) { AnimationState _state = AnimationTools.GetAnimationStateByName(_control.gameObject, _animation_name); if (_state != null) { if (_state.clip != null) { _state.clip.legacy = true; } _animation_data.TransitionDuration = 0.25f; _animation_data.wrapMode = _state.wrapMode; _animation_data.DefaultWrapMode = _state.wrapMode; _animation_data.Speed = _state.speed; _animation_data.DefaultSpeed = _state.speed; _animation_data.Name = _state.name; _animation_data.Length = _state.length; } } } EditorGUI.indentLevel++; _animation_data.wrapMode = DrawBehaviourAnimationWrapMode(_animation_data.wrapMode); DrawBehaviourAnimationData(ref _animation_data.Speed, ref _animation_data.AutoSpeed, ref _animation_data.TransitionDuration, ref _animation_data.AutoTransitionDuration, _animation_data.DefaultSpeed); if (_animation_data.AutoTransitionDuration) { _animation_data.TransitionDuration = _animation_data.Length / 3; } EditorGUI.indentLevel--; } else { EditorGUILayout.HelpBox("Check your Animation Component", MessageType.Warning); } return(_animation_data); }
public void PlayAnim(Animation anim, string mixAnimName, float fadeInTime, QueueMode queueMode = QueueMode.PlayNow) { foreach (var mixData in mixDatum) { if (mixData.newAnimationName == mixAnimName) { AnimationTools.PlayAnim(anim, mixAnimName, fadeInTime, queueMode, PlayMode.StopSameLayer /*不可以是StopAll*/); } } }
protected override void Initialize(FSMEvent ev) { _eventAttackRoll = ev as AnimFSMEventAttackRoll; _state = AttackRollState.PREPARE; AnimationTools.PlayAnim(Agent.AnimEngine, "attackRollStart", 0.4f); base.Initialize(_eventAttackRoll); Agent.BlackBoard.motionType = MotionType.NONE; _endOfStateTime = Agent.AnimEngine["attackRollStart"].length * 0.95f + Time.timeSinceLevelLoad; _hitTimer = 0; UpdateFinalRotation(); //Agent.SoundPlay(Agent.RollSounds[0]); }
/// <summary> /// Hides sound buttons. /// </summary> private void SoundGrid_MouseLeave(object sender, MouseEventArgs e) { if (UseAnimation) { AnimationTools.FadeOut(VolumeSlider); AnimationTools.FadeOut(ToggleMuteButton); } else { VolumeSlider.Visibility = Visibility.Hidden; ToggleMuteButton.Visibility = Visibility.Hidden; } }
private static AnimatorInterface WizardAnimationPopupMecanim(string _title, ICECreatureControl _control, AnimatorInterface _animator_data) { Animator m_animator = _control.GetComponent <Animator>(); if (m_animator != null && m_animator.enabled == true && m_animator.runtimeAnimatorController != null && m_animator.avatar != null) { if (!EditorApplication.isPlaying) { _animator_data.Type = AnimatorControlType.DIRECT; ICEEditorLayout.BeginHorizontal(); _animator_data.Index = AnimationEditor.AnimatorIntPopupBase(m_animator, _animator_data.Index, _title); ICEEditorLayout.EndHorizontal(); if (AnimationTools.GetAnimationClipCount(m_animator) == 0) { Info.Warning(Info.BEHAVIOUR_ANIMATION_ANIMATOR_ERROR_NO_CLIPS); } else { AnimationClip _animation_clip = AnimationTools.GetAnimationClipByIndex(m_animator, _animator_data.Index); if (_animation_clip != null) { if (_animator_data.Name != _animation_clip.name) { _animator_data.Init(); } _animation_clip.wrapMode = WrapMode.Loop; _animation_clip.legacy = false; _animator_data.StateName = AnimationEditor.GetAnimatorStateName(m_animator, _animation_clip.name); _animator_data.Name = _animation_clip.name; _animator_data.Length = _animation_clip.length; _animator_data.Speed = 1; _animator_data.TransitionDuration = 0.05f; } } } else { ICEEditorLayout.Label("Name", "Animation name.", _animator_data.Name); } } else { } return(_animator_data); }
protected override void Initialize(FSMEvent ev = null) { _eventRotate = ev as AnimFSMEventRotate; //_currentRotationTime = 0; _rotationProgress = 0; _startRotation = Agent.Transform.rotation; Vector3 finalDir; if (_eventRotate.target != null) { finalDir = (_eventRotate.target.Position + (_eventRotate.target.BlackBoard.moveDir * _eventRotate.target.BlackBoard.speed * 0.5f)) - Agent.Transform.position; finalDir.Normalize(); } else if (_eventRotate.direction != Vector3.zero) { finalDir = _eventRotate.direction; } else { finalDir = Agent.Transform.forward; } if (Vector3.Dot(finalDir, Agent.Transform.right) > 0) { _animName = Agent.AnimSet.GetRotateAnim(Agent.BlackBoard.motionType, RotationType.RIGHT); } else { _animName = Agent.AnimSet.GetRotateAnim(Agent.BlackBoard.motionType, RotationType.LEFT); } AnimationTools.PlayAnim(Agent.AnimEngine, _animName, 0.01f, QueueMode.CompleteOthers); _finalRotation.SetLookRotation(finalDir); /*_rotationTime = Vector3.Angle(Agent.Transform.forward, finalDir) / (360 * Agent.BlackBoard.rotationSmooth); * * if (_rotationTime == 0) * { * IsFinished = true; * _eventRotate.IsFinished = true; * } * * float animLen = Agent.AnimEngine[_animName].length; * int multi = Mathf.CeilToInt(_rotationTime / animLen); * * _rotationTime = animLen * multi + Time.timeSinceLevelLoad;*/ }
/// <summary> /// Shows time slider. /// </summary> private void TimeGrid_MouseEnter(object sender, MouseEventArgs e) { if (!VideoControl.SourceProvider.MediaPlayer.CouldPlay) { return; } if (UseAnimation) { AnimationTools.FadeIn(TimeSlider); } else { TimeSlider.Visibility = Visibility.Visible; } }
protected override void Initialize(FSMEvent ev) { _eventWhirl = ev as AnimFSMEventAttackWhirl; AnimationTools.PlayAnim(Agent.AnimEngine, _eventWhirl.data.animName, 0.2f); //UpdateFinalRotation(); Agent.BlackBoard.motionType = MotionType.ATTACK;// MotionType.WALK; _rotationProgress = 0; _timeToEndState = Agent.AnimEngine[_eventWhirl.data.animName].length * 0.9f + Time.timeSinceLevelLoad; _hitTimer = Time.timeSinceLevelLoad + 0.75f; // Owner.PlayLoopSound(Owner.BerserkSound, 1, AnimEngine[Action.Data.AnimName].length - 1, 0.5f, 0.9f); _timeToStartEffect = Time.timeSinceLevelLoad + 1; _timeToEndEffect = Time.timeSinceLevelLoad + Agent.AnimEngine[_eventWhirl.data.animName].length - 1; }
public override void OnUpdate() { if (_eventSword != null && _timeToFinishWeapon < Time.timeSinceLevelLoad) // 拔刀或者收刀完毕 { Agent.BlackBoard.weaponState = _eventSword.show ? WeaponState.IN_HAND : WeaponState.NOT_IN_HANDS; _eventSword.IsFinished = true; _eventSword = null; _timeToFinishWeapon = 0; AnimationTools.PlayAnim(Agent.AnimEngine, Agent.AnimSet.GetIdleAnim( Agent.BlackBoard.weaponSelected, Agent.BlackBoard.weaponState), 0.2f); // 播放待机动作 } if (Agent.IsPlayer == false) { //Owner.BlackBoard.Vigor = Owner.BlackBoard.Vigor + 0.2f; } }
private void DetachDraggedIcon() { int index = container.Children.IndexOf(draggedIcon); container.Children.Remove(draggedIcon); lastCount = container.CountIconsBefore(index); placeholder = new Separator { Width = SettingsManager.Settings.OuterIconSize, Visibility = Visibility.Hidden }; container.Children.Insert(index, placeholder); draggedIconImage = draggedIcon.IconImage; AnimationTools.FadeOut(0.15, draggedIconImage, 0.5); draggedIcon.IconGrid.Children.Remove(draggedIconImage); canvas.Children.Add(draggedIconImage); }
/// <summary> /// Hides media buttons. /// </summary> private void MediaGrid_MouseLeave(object sender, MouseEventArgs e) { if (UseAnimation) { AnimationTools.FadeOut(ResizeButton); AnimationTools.FadeOut(FindMediaButton); AnimationTools.FadeOut(BrowserButton); AnimationTools.FadeOut(MaximizeButton); } else { ResizeButton.Visibility = Visibility.Hidden; FindMediaButton.Visibility = Visibility.Hidden; BrowserButton.Visibility = Visibility.Hidden; MaximizeButton.Visibility = Visibility.Hidden; } }
public static string AnimationPopup(Animation _animation, string _name, string _title = "", string _help = "") { ICEEditorLayout.BeginHorizontal(); _name = AnimationPopupBase(_animation, _name, _title); if (ICEEditorLayout.SystemButtonSmall("SEL", "")) { AnimationState _state = AnimationTools.GetAnimationStateByName(_animation, _name); if (_state != null && _state.clip != null) { Selection.activeObject = _state.clip; } } ICEEditorLayout.EndHorizontal(_help); return(_name); }
/// <summary> /// Shows sound buttons. /// </summary> private void SoundGrid_MouseEnter(object sender, MouseEventArgs e) { if (!VideoControl.SourceProvider.MediaPlayer.CouldPlay) { return; } if (UseAnimation) { AnimationTools.FadeIn(VolumeSlider); AnimationTools.FadeIn(ToggleMuteButton); } else { VolumeSlider.Visibility = Visibility.Visible; ToggleMuteButton.Visibility = Visibility.Visible; } }
protected override void Initialize(FSMEvent ev) { _eventAttack = ev as AnimFSMEventAttackBow; _startRotation = Agent.Transform.rotation; _eventAttack.attackPhaseDone = false; _fireTime = 0; float angle = 0; if (_eventAttack.target != null) { Vector3 dir = _eventAttack.target.Position - Agent.Transform.position; if (dir.sqrMagnitude > 0.1f * 0.1f) { dir.Normalize(); angle = Vector3.Angle(Agent.Transform.forward, dir); } else { dir = Agent.Transform.forward; } _finalRotation.SetLookRotation(dir); _rotationTime = angle / 180.0f; } else { _finalRotation.SetLookRotation(_eventAttack.attackDir); _rotationTime = Vector3.Angle(Agent.Transform.forward, _eventAttack.attackDir) / 1040.0f; } _rotationOk = (_rotationTime == 0); _curRotationTime = 0; _endOfStateTime = Time.timeSinceLevelLoad + Mathf.Max(Agent.AnimEngine[_eventAttack.animAttackData.animName].length / Agent.AnimEngine[_eventAttack.animAttackData.animName].speed, _eventAttack.animAttackData.attackEndTime); _fireTime = Time.timeSinceLevelLoad + _eventAttack.animAttackData.hitTime; Agent.BlackBoard.motionType = MotionType.ATTACK; AnimationTools.PlayAnim(Agent.AnimEngine, _eventAttack.animAttackData.animName, 0.1f); }
public static int AnimatorIntPopupBase(Animator _animator, int _selected, string _title = "") { if (_animator == null || _animator.runtimeAnimatorController == null) { return(-1); } AnimationClip[] _clips = AnimationTools.GetAnimationClips(_animator); string[] _animation_names = new string[_clips.Length]; //_animator.runtimeAnimatorController.animationClips.Length ]; int[] _animation_index = new int[_clips.Length]; //_animator.runtimeAnimatorController.animationClips.Length ]; int i = 0; foreach (AnimationClip _clip in _clips) // _animator.runtimeAnimatorController.animationClips ) { _animation_index[i] = i; _animation_names[i] = _clip.name; i++; } if (_title == "") { _title = "Animation"; } _selected = (int)EditorGUILayout.IntPopup(_title, _selected, _animation_names, _animation_index); _selected = (int)ICEEditorLayout.PlusMinusGroup(_selected, 1, ICEEditorStyle.CMDButtonDouble); if (_selected < 0) { _selected = 0; } else if (_selected >= _clips.Length - 1) { _selected = _clips.Length - 1; } return(_selected); }
private static int AnimatorIntPopup(Animator _animator, int _selected, string _title = "") { ICEEditorLayout.BeginHorizontal(); _selected = AnimatorIntPopupBase(_animator, _selected, _title); if (ICEEditorLayout.SystemButtonSmall("SEL", "")) { AnimationClip _animation_clip = AnimationTools.GetAnimationClipByIndex(_animator, _selected); if (_animation_clip != null) { Selection.activeObject = _animation_clip; } } ICEEditorLayout.EndHorizontal(Info.ANIMATION_ANIMATOR_POPUP); return(_selected); }
private static AnimationInterface WizardAnimationPopupLegacy(string _title, ICECreatureControl _control, AnimationInterface _animation_data) { Animation m_animation = _control.GetComponentInChildren <Animation>(); if (m_animation != null && m_animation.enabled == true) { if (EditorApplication.isPlaying) { EditorGUILayout.LabelField("Name", _animation_data.Name); } else { _animation_data.Name = AnimationEditor.AnimationPopupBase(m_animation, _animation_data.Name, _title); AnimationState _state = AnimationTools.GetAnimationStateByName(_control.gameObject, _animation_data.Name); if (_state != null) { if (_state.clip != null) { _state.clip.legacy = true; } if (_animation_data.Name != _state.name) { _animation_data.Name = _state.name; _animation_data.Length = _state.length; _animation_data.Speed = _state.speed; _animation_data.TransitionDuration = 0.25f; _animation_data.wrapMode = _state.wrapMode; _animation_data.Length = _state.length; _animation_data.DefaultSpeed = _state.speed; _animation_data.DefaultWrapMode = _state.wrapMode; } } } } else { EditorGUILayout.HelpBox("Check your Animation Component", MessageType.Warning); } return(_animation_data); }
protected override void Initialize(FSMEvent ev) { _eventRoll = ev as AnimFSMEventRoll; _currentMoveTime = 0; _currentRotationTime = 0; _startRotation = Agent.Transform.rotation; _startPosition = Agent.Transform.position; Vector3 finalDir; if (_eventRoll.toTarget != null) { finalDir = _eventRoll.toTarget.Position - Agent.Transform.position; finalDir.Normalize(); _finalPosition = _eventRoll.toTarget.Position - finalDir * Agent.BlackBoard.weaponRange; } else { finalDir = _eventRoll.direction; _finalPosition = _startPosition + _eventRoll.direction * Agent.BlackBoard.rollDistance; } string animName = Agent.AnimSet.GetRollAnim(Agent.BlackBoard.weaponSelected, Agent.BlackBoard.weaponState); AnimationTools.PlayAnim(Agent.AnimEngine, animName, 0.1f); _finalRotation.SetLookRotation(finalDir); _rotationTime = Vector3.Angle(Agent.Transform.forward, finalDir) / 1000.0f; _moveTime = Agent.AnimEngine[animName].length * 0.85f; _endOfStateTime = Agent.AnimEngine[animName].length * 0.9f + Time.timeSinceLevelLoad; _rotationOk = _rotationTime == 0; _positionOK = false; Agent.BlackBoard.motionType = MotionType.ROLL; if (Agent.BlackBoard.showMotionEffect) { ParticleTools.Instance.Play(Agent.particleSystemRollTust, Agent.gameObject.ForwardRadian(), 0f); } }
public static int AnimationIntPopupBase(Animation _animation, int _selected, string _title = "") { if (_animation == null) { return(0); } string[] _animation_names = new string[AnimationTools.GetAnimationClipCount(_animation)]; int[] _animation_index = new int[AnimationTools.GetAnimationClipCount(_animation)]; int i = 0; foreach (AnimationState _animation_state in _animation) { _animation_index[i] = i; _animation_names[i] = _animation_state.name; i++; } if (_title == "") { _title = "Animation"; } _selected = (int)EditorGUILayout.IntPopup(_title, _selected, _animation_names, _animation_index); //new GUIContent( _title , "Animation name and length in seconds" ) _selected = (int)ICEEditorLayout.PlusMinusGroup(_selected, 1, ICEEditorStyle.CMDButtonDouble); if (_selected < 0) { _selected = 0; } else if (_selected >= AnimationTools.GetAnimationClipCount(_animation) - 1) { _selected = AnimationTools.GetAnimationClipCount(_animation) - 1; } return(_selected); }
private void InitializeBlockFailed() { string animName = Agent.AnimSet.GetBlockAnim(BlockState.BLOCK_FAIL, Agent.BlackBoard.weaponSelected); AnimationTools.PlayAnim(Agent.AnimEngine, animName, 0.05f); _startRotation = Agent.Transform.rotation; _startPosition = Agent.Transform.position; Vector3 dir = _eventBlock.attacker.Position - Agent.Transform.position; float angle = 0; if (dir.sqrMagnitude > 0.1f * 0.1f) { dir.Normalize(); angle = Vector3.Angle(Agent.Transform.forward, dir); } else { dir = Agent.Transform.forward; } _finalRotation.SetLookRotation(dir); _finalPosition = _startPosition - dir * 2; _rotationTime = angle / 500.0f; _moveTime = Agent.AnimEngine[animName].length * 0.8f; _rotationOK = _rotationTime == 0; _positionOK = _moveTime == 0; _curRotationTime = 0; _curMoveTime = 0; AnimationTools.PlayAnim(Agent.AnimEngine, animName, 0.05f); _endOfStateTime = Time.timeSinceLevelLoad + Agent.AnimEngine[animName].length * 0.9f; _blockState = BlockState.BLOCK_FAIL; Agent.BlackBoard.motionType = MotionType.INJURY; }
private void MouseReleased(Point pos) { if (draggedIcon == null || !MouseDown) { return; } MouseDown = false; if (IsDragging) { if (container.IsPositionWithinBounds(pos)) { draggedIcon.Info.Pinned = true; PlaceDraggedIcon(); } else { AnimationTools.FadeOut(0.2, draggedIconImage, 0, () => canvas.Children.Remove(draggedIconImage)); if (draggedIcon.Windows.Any()) { DockIcon icon = new DockIcon(draggedIcon.Info); foreach (Window w in draggedIcon.Windows) { icon.Windows.Add(w); } icon.Info.Pinned = false; container.Children.Add(icon); } } if (SettingsManager.Settings.SaveAutomatically) { container.SaveSettings(); } } else { draggedIcon.Run(); } Dispose(); container.ReleaseMouseCapture(); }
/// <summary> /// Shows media buttons. /// </summary> private void MediaGrid_MouseEnter(object sender, MouseEventArgs e) { if (!VideoControl.SourceProvider.MediaPlayer.CouldPlay) { return; } if (UseAnimation) { AnimationTools.FadeIn(ResizeButton); AnimationTools.FadeIn(FindMediaButton); AnimationTools.FadeIn(BrowserButton); AnimationTools.FadeIn(MaximizeButton); } else { ResizeButton.Visibility = Visibility.Visible; FindMediaButton.Visibility = Visibility.Visible; BrowserButton.Visibility = Visibility.Visible; MaximizeButton.Visibility = Visibility.Visible; } }
protected override void Initialize(FSMEvent ev = null) { _eventBlock = ev as AnimFSMEventBlock; string animName = Agent.AnimSet.GetBlockAnim(BlockState.START, Agent.BlackBoard.weaponSelected); _startRotation = Agent.Transform.rotation; _startPosition = Agent.Transform.position; Vector3 dir = _eventBlock.attacker.Position - Agent.Transform.position; float angle = 0; if (dir.sqrMagnitude > 0.1f * 0.1f) { dir.Normalize(); angle = Vector3.Angle(Agent.Transform.forward, dir); } else { dir = Agent.Transform.forward; } _finalRotation.SetLookRotation(dir); _rotationTime = angle / 500.0f; _moveTime = 0; _rotationOK = _rotationTime == 0; _positionOK = _moveTime == 0; _curRotationTime = 0; _curMoveTime = 0; AnimationTools.PlayAnim(Agent.AnimEngine, animName, 0.05f); _endOfStateTime = Time.timeSinceLevelLoad + Agent.AnimEngine[animName].length * 0.9f; _blockHoldEndTime = Time.timeSinceLevelLoad + _eventBlock.holdTime; _blockState = BlockState.START; }