public override void Reset(AnimType animType) { if (m_RectTrans == null) { m_RectTrans = GetComponent<RectTransform>(); } }
public void Save(XmlWriter writer) { writer.WriteElementString("AnimType", AnimType.ToString()); writer.WriteElementString("AnimIndex", AnimIndex.ToString()); writer.WriteElementString("FrameLength", FrameLength.ToString()); writer.WriteElementString("Anim1", Anim1.ToString()); writer.WriteElementString("Anim2", Anim2.ToString()); writer.WriteElementString("Anim3", Anim3.ToString()); }
void SetType() { GaugeType = (PositionMax != PositionMin ? AnimType.Translate : 0) | (ScaleMax != ScaleMin ? AnimType.Scale : 0) | (RotationMax != RotationMin ? AnimType.Rotate : 0) | (ColorMax != ColorMin ? AnimType.Color : 0) | (EnableAt > 0f ? AnimType.Enable : 0) | (ParticlesAt > 0f ? AnimType.Particles : 0); }
public void StartAnim(AnimType animType, bool isOpen) { if (!Application.isPlaying) { return; } this.isOpen = isOpen; TweenAlpha component = GetComponent <TweenAlpha>(); if (component != null) { component.onFinished.Clear(); } iTween.Stop(base.gameObject); switch (animType) { case AnimType.POPUP: if (IsOpen) { PopUpIn(); } else { PopUpOut(); } break; case AnimType.FEAD: if (IsOpen) { FadeIn(); } else { FadeOut(); } break; case AnimType.SLIDE: if (IsOpen) { SlideIn(0, 0.5f); } else { SlideOut(0, 0.5f); } break; } if (Black != null) { float alpha = (!isOpen) ? 0f : 0.5f; TweenAlpha.Begin(Black, fadeTime, alpha); } isFinished = false; }
public void FocusTo(float targetScale, Vector2 targetWorldPosition, AnimCallback animMidCB, bool force2PointAnim) { mAnimMidCB = animMidCB; var effectiveTargetScale = m_WorldToViewScale * targetScale; var effectiveTargetTranslation = m_WorldToViewTranslation + (-targetWorldPosition * effectiveTargetScale); if (force2PointAnim || ViewInWorldSpace.Contains(targetWorldPosition)) { mAnimType = AnimType.Anim_2Point; mAnimDuration = 2; m_Scale_Anim_Start = m_Scale; m_Scale_Anim_Target = effectiveTargetScale / m_WorldToViewScale; m_Scale_Anim_Delta = m_Scale_Anim_Target - m_Scale_Anim_Start; m_Translation_Anim_Start = m_Translation; m_Translation_Anim_Target = effectiveTargetTranslation - m_WorldToViewTranslation; m_Translation_Anim_Delta = m_Translation_Anim_Target - m_Translation_Anim_Start; } else { var currentWorldPos = -(m_WorldToViewTranslation_Effective - m_WorldToViewTranslation) / m_WorldToViewScale_Effective; var midWorldPos = 0.5f * (currentWorldPos + targetWorldPosition); float marginPercent = 0.01f; var w = Mathf.Abs(targetWorldPosition.x - currentWorldPos.x) + marginPercent * m_WorldSpace.width; var h = Mathf.Abs(targetWorldPosition.y - currentWorldPos.y) + marginPercent * m_WorldSpace.height; var zw = m_WorldSpace.width / w; var zh = m_WorldSpace.height / h; var z = Mathf.Min(zw, zh); z = Mathf.Min(m_Scale.x, z); var midScale = new Vector2(z, z);//0.5f * (Vector2.one + m_Scale); var effectiveMidScale = m_WorldToViewScale * midScale; var effectiveMidTranslation = m_WorldToViewTranslation + (-midWorldPos * effectiveMidScale); mAnimType = AnimType.Anim_3Point; m_Scale_Anim_Start = m_Scale; m_Scale_Anim_Mid = midScale; m_Scale_Anim_Target = effectiveTargetScale / m_WorldToViewScale; m_Scale_Anim_Delta = m_Scale_Anim_Mid - m_Scale_Anim_Start; m_Scale_Anim_Mid_Delta = m_Scale_Anim_Target - m_Scale_Anim_Mid; m_Translation_Anim_Start = m_Translation; m_Translation_Anim_Mid = effectiveMidTranslation - m_WorldToViewTranslation; m_Translation_Anim_Target = effectiveTargetTranslation - m_WorldToViewTranslation; m_Translation_Anim_Delta = m_Translation_Anim_Mid - m_Translation_Anim_Start; m_Translation_Anim_Mid_Delta = m_Translation_Anim_Target - m_Translation_Anim_Mid; mAnimDuration = 4; } mbAnimated = true; mAnimTimer = new System.Diagnostics.Stopwatch(); mAnimTimer.Start(); }
public void SetCurrAnimType(AnimType at) { if (currAnimType != at) { curFram = 0; fTime = 0; } this.currAnimType = at; }
public void Stop(AnimType animType) { if (animType == AnimType.Path) { pathTween.SetLoops(0); gameObject.GetComponent <RectTransform>().localPosition = originPos; pathTween.Kill(); StartCoroutine(ClearTrail()); } }
public static void AddAnim(Object obj, object target, ParamType paramType, AnimType animType = AnimType.Linear, float timeFactor = 0.1f, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None, object initValue = null) { GameObject gameObject = ToGameObject(obj); switch (paramType) { case ParamType.Scale: case ParamType.ScaleX: case ParamType.ScaleY: case ParamType.ScaleZ: case ParamType.RotationZ: case ParamType.Position: case ParamType.PositionX: case ParamType.PositionY: case ParamType.PositionZ: Instance.Animations.Add(new TransformAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.SizeDeltaX: case ParamType.SizeDeltaY: case ParamType.AnchoredPositionX: case ParamType.AnchoredPositionY: Instance.Animations.Add(new RectTransformAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.PrimitiveRadius: case ParamType.PrimitiveWidth: case ParamType.PrimitiveArc: Instance.Animations.Add(new PrimitiveAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.GaugeLength: case ParamType.GaugeRate: case ParamType.GaugeWidth: Instance.Animations.Add(new GaugeAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.Color: case ParamType.AlphaColor: Instance.Animations.Add(new ColorAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.TextColor: case ParamType.TextAlphaColor: Instance.Animations.Add(new TextAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.Any: break; default: print("unknown anim type!"); break; } }
public void SetClipToEnd(AnimType animType) { var clip = GetClip(animType); if (!clip) { return; } anim[clip.name].normalizedTime = anim[clip.name].speed >= 0f ? 1f : 0f; }
public MagicTexture(Texture2D source_, Rectangle sourceRect_, Facing face_, int ID_, string name_ = null) { ID = ID_; face = face_; source = source_; sourceRect = sourceRect_; frame = sourceRect_; name = name_; frameCount = 1; animType = AnimType.Once; }
protected override void UIOpenAnimation(System.Action callback) { animType = AnimType.Open; delta = 0f; saveDelta = 0f; invTime = 1f / dialogOpenMovingTime; start = new Vector3(ScreenSizeGetter.width * -0.5f, 0f, 0f); end = Vector3.zero; finishCallback = callback; curve = UISystem.GetOpenDialogCurve(); }
public bool RetrieveAnimation(AnimType focusType, AnimType type) { AnimationNode f = GetAnimation(focusType); if (f == null) { SetSelectedBRRESFile(type, null); return(false); } SetSelectedBRRESFile(type, RetrieveAnimation(f.Name, type)); return(GetAnimation(type) != null); }
public CoolTexture(AnimType at_, Texture2D src_, Rectangle[] srcRects_, int fc_, float ft_, Point[] ct_, string name_) { name = name_; animType = at_; src = src_; srcRects = srcRects_; frameCount = fc_; frameCounter = 1; frameTime = ft_; frameTimer = ft_; centers = ct_; }
private void PlayAnim(AnimType type) { switch (type) { case AnimType.BlueSwipe: anim.Play("BlurSwipe"); break; default: break; } }
/// <summary> /// Constructs a new AnimSet /// </summary> /// <param name="newSlides">An array of sprite locations on the sprite sheet for each from of the animation</param> /// <param name="newSpriteSheet">The sprite sheet to get the slides from</param> /// <param name="newBounds">The bounds and position that the animation will be drawn as. Note that the sprite retrieved /// from the spritesheet will be scaled to fit this width and height /// </param> /// <param name="newType">The animation type of this set</param> /// <param name="totalTimeToPlay">The total time it will take to go through one entire animation</param> public AnimSet(Rectangle[] newSlides, Texture2D newSpriteSheet, Rectangle newBounds, AnimType newType, int totalTimeToPlay) { slides = newSlides; spriteSheet = newSpriteSheet; spriteBounds = newBounds; myType = newType; slideInterval = totalTimeToPlay / slides.Length; softStop = false; hardStop = true; isMovingForward = true; }
protected override void UICloseAnimation(System.Action callback) { animType = AnimType.Close; delta = 0f; saveDelta = 0f; invTime = 1f / dialogCloseMovingTime; start = Vector3.zero; end = new Vector3(ScreenSizeGetter.width * 0.5f, 0f, 0f); finishCallback = callback; curve = UISystem.GetCloseDialogCurve(); }
/// <summary> /// Метод начала анимации /// </summary> public void TextAnimation(float time, AnimType mode) { animationTime = time; if (mode == AnimType.show) { a = 1; } else { a = -1; } }
public void Trigger(bool forward, bool startAtLastSprite = true, System.Action finished = null) { if (startAtLastSprite) { int index = keyPointIndex; for (int i = 0; i < keyPoints.Length; i++) { if (keyPoints[i].Sprite == sprite) { index = i; break; } } if (forward) { keyPointIndex = index + 1; if (keyPointIndex >= keyPoints.Length) { enabled = false; finished?.Invoke(); return; } } else { keyPointIndex = index - 1; if (keyPointIndex < 0) { enabled = false; finished?.Invoke(); return; } } } else if (forward) { keyPointIndex = 1; sprite = keyPoints[0].Sprite; } else { sprite = keyPoints[keyPoints.Length - 1].Sprite; keyPointIndex = keyPoints.Length - 2; } indexForward = forward; type = forward? AnimType.OneTime: AnimType.BackwardOneTime; triggerFinished += finished; enabled = true; }
public AnimatorAct(Animator animator, string name, float value, float delta = 0.0f) : this(animator, name) { animType = AnimType.integal; value2 = value; if (delta <= 0.0f || delta >= 1.0f) { delta = 0.0f; } else { changeDelta = delta; } }
/// <summary> /// Запуск анимации, где задается один из параметров функции /// </summary> public void EnableAnimation(AnimType mode) { if (mode == AnimType.show) { a = 1; } else { a = -1; } time = 0f; isMove = true; }
public static void Ping(Vector3 worldPosition, Color color, float sizeMultiplier, AnimType animType = AnimType.Expand) { Ping( worldPosition, Vector3.zero, color: color, sizeMultiplier: sizeMultiplier, animType: animType ); }
public static void Ping(Func <Vector3> worldPositionFunc, Color color, float sizeMultiplier, AnimType animType = AnimType.Expand) { Ping( Vector3.zero, worldPosition0Func: worldPositionFunc, color: color, sizeMultiplier: sizeMultiplier, animType: animType ); }
public void UpdateEditor(AnimType type) { if (type != AnimType.SRT) { leftPanel.UpdateSRT0Selection(null); } if (type != AnimType.PAT) { leftPanel.UpdatePAT0Selection(null); } if (type != AnimType.SCN) { foreach (MDL0Node m in _targetModels) { m.SetSCN0(null); } } switch (type) { case AnimType.CHR: break; case AnimType.SRT: leftPanel.UpdateSRT0Selection(SelectedSRT0); break; case AnimType.SHP: shp0Editor.UpdateSHP0Indices(); break; case AnimType.PAT: pat0Editor.UpdateBoxes(); leftPanel.UpdatePAT0Selection(SelectedPAT0); break; case AnimType.VIS: vis0Editor.UpdateAnimation(); break; case AnimType.SCN: //foreach (MDL0Node m in _targetModels) // m.SetSCN0(_scn0); scn0Editor.tabControl1_Selected(null, new TabControlEventArgs(null, scn0Editor.tabIndex, TabControlAction.Selected)); break; case AnimType.CLR: clr0Editor.UpdateAnimation(); break; } }
/// <summary> /// Constructs a new AnimSet /// </summary> /// <param name="newSlides">An array of sprite locations on the sprite sheet for each from of the animation</param> /// <param name="newSpriteSheet">The sprite sheet to get the slides from</param> /// <param name="newBounds">The bounds and position that the animation will be drawn as. Note that the sprite retrieved /// from the spritesheet will be scaled to fit this width and height /// </param> /// <param name="newType">The animation type of this set</param> /// <param name="newInterval">The interval to wait between each frame/slide</param> public AnimSet(Rectangle[] newSlides, Texture2D newSpriteSheet, Rectangle newBounds, AnimType newType, float newInterval) { slides = newSlides; spriteSheet = newSpriteSheet; spriteBounds = newBounds; myType = newType; slideInterval = newInterval; timerToSlide = slideInterval; timerToStart = 0; softStop = false; hardStop = true; isMovingForward = true; }
void Start() { runAnimSpriteMapping = new Dictionary <AnimDir, Sprite[]>(); idelAnimSpriteMapping = new Dictionary <AnimDir, Sprite[]>(); deadAnimSpriteMapping = new Dictionary <AnimDir, Sprite[]>(); m_bStop = true; currAnimDir = currAnimDir == AnimDir.NONE ? AnimDir.Bottom : currAnimDir; currAnimType = AnimType.IDEL; var runAnim = GameObject.Instantiate(runAnimGo) as GameObject; var avatarAnim = runAnim.GetComponent <AvatarAnimVo>(); runAnimSpriteMapping.Add(AnimDir.Bottom, avatarAnim.s1); runAnimSpriteMapping.Add(AnimDir.Bottom_Left, avatarAnim.s2); runAnimSpriteMapping.Add(AnimDir.Left, avatarAnim.s3); runAnimSpriteMapping.Add(AnimDir.Left_Top, avatarAnim.s4); runAnimSpriteMapping.Add(AnimDir.Top, avatarAnim.s5); runAnimSpriteMapping.Add(AnimDir.Top_Right, avatarAnim.s4); runAnimSpriteMapping.Add(AnimDir.Right, avatarAnim.s3); runAnimSpriteMapping.Add(AnimDir.Right_Bottom, avatarAnim.s2); var idelAnim = GameObject.Instantiate(idelAnimGo) as GameObject; avatarAnim = idelAnim.GetComponent <AvatarAnimVo>(); idelAnimSpriteMapping.Add(AnimDir.Bottom, avatarAnim.s1); idelAnimSpriteMapping.Add(AnimDir.Bottom_Left, avatarAnim.s2); idelAnimSpriteMapping.Add(AnimDir.Left, avatarAnim.s3); idelAnimSpriteMapping.Add(AnimDir.Left_Top, avatarAnim.s4); idelAnimSpriteMapping.Add(AnimDir.Top, avatarAnim.s5); idelAnimSpriteMapping.Add(AnimDir.Top_Right, avatarAnim.s4); idelAnimSpriteMapping.Add(AnimDir.Right, avatarAnim.s3); idelAnimSpriteMapping.Add(AnimDir.Right_Bottom, avatarAnim.s2); if (deadAnimGo) { var deadAnim = (GameObject.Instantiate(deadAnimGo) as GameObject).GetComponent <AvatarAnimVo>(); deadAnimSpriteMapping.Add(AnimDir.Bottom, deadAnim.s1); deadAnimSpriteMapping.Add(AnimDir.Bottom_Left, deadAnim.s2); deadAnimSpriteMapping.Add(AnimDir.Left, deadAnim.s3); deadAnimSpriteMapping.Add(AnimDir.Left_Top, deadAnim.s4); deadAnimSpriteMapping.Add(AnimDir.Top, deadAnim.s5); deadAnimSpriteMapping.Add(AnimDir.Top_Right, deadAnim.s4); deadAnimSpriteMapping.Add(AnimDir.Right, deadAnim.s3); deadAnimSpriteMapping.Add(AnimDir.Right_Bottom, deadAnim.s2); } }
public GameObject CreatModel(string goName, PosType pos, SpinWithMouse spin, AnimType type = AnimType.None, int rota = 180, float z = 0) { this.type = type; model = null; DestroyModel(pos); SetEmbattleBG(pos); model = Resource.CreateCharacter(goName, parent.gameObject); if (goName == "boss_009") { model.transform.localPosition = new Vector3(0, 0.2f, 0); } model.transform.localRotation = Quaternion.Euler(0, rota, 0); if (z != 0) { model.transform.localPosition = new Vector3(0, 0, z); } Transform redCircle = model.transform.FindChild("Effect_targetselected01"); if (redCircle != null) { redCircle.gameObject.SetActive(false); } NGUITools.SetLayer(model, LayerMask.NameToLayer("UI")); model.tag = Tag.monster; //if (pos == PosType.SelectPos) //{ // model.transform.localScale = model.transform.localScale * 1.4f; //} GameObject taizi = transform.Find("TitlePos/fazhenxuanren_taizi").gameObject; if (taizi != null && pos == PosType.TitlePos) { model.transform.parent = taizi.transform; spin.target = taizi.transform; } else if (pos == PosType.SelectPos) { spin.target = SelectPos; } else if (spin != null) { spin.target = model.transform; } if (null != model) { PlayAppearedAnim(model); } return(model); }
public void AnimChanged(AnimType type) { if (type == TargetAnimType) { UpdateEditor(); UpdateKeyframePanel(); } AnimationNode node = GetAnimation(type); if (node == null) { pnlPlayback.numFrameIndex.Maximum = _maxFrame = 0; pnlPlayback.numTotalFrames.Minimum = 0; _updating = true; pnlPlayback.numTotalFrames.Value = 0; selectedAnimationToolStripMenuItem.Enabled = false; _updating = false; pnlPlayback.btnPlay.Enabled = pnlPlayback.numTotalFrames.Enabled = pnlPlayback.numFrameIndex.Enabled = false; pnlPlayback.btnLast.Enabled = false; pnlPlayback.btnFirst.Enabled = false; pnlPlayback.Enabled = false; EnableTransformEdit = true; SetFrame(0); } else { _maxFrame = node.FrameCount; _updating = true; pnlPlayback.btnPlay.Enabled = pnlPlayback.numFrameIndex.Enabled = pnlPlayback.numTotalFrames.Enabled = true; pnlPlayback.Enabled = true; pnlPlayback.numTotalFrames.Value = _maxFrame; selectedAnimationToolStripMenuItem.Enabled = true; _updating = false; pnlPlayback.numFrameIndex.Maximum = _maxFrame; SetFrame(1); EnableTransformEdit = !_playing; UpdateToolButtons(); } }
public bool GetCLR0(AnimType focusType) { BRESEntryNode focusFile = GetAnimation(focusType); if (focusFile == null) { _clr0 = null; return false; } if (TargetModel != null && (_clr0 = (CLR0Node)TargetModel.RootNode.FindChildByType(focusFile.Name, true, ResourceType.CLR0)) != null) return true; if (_externalAnimationsNode != null && (_clr0 = (CLR0Node)_externalAnimationsNode.FindChildByType(focusFile.Name, true, ResourceType.CLR0)) != null) return true; return false; }
public void QueueAnimation(AnimType animType) { var clip = GetClip(animType); var speed = GetSpeed(animType); if (!clip) { return; } SetClipToStart(animType); SetAnimationSpeed(clip, speed); anim.PlayQueued(clip.name); }
public static void PingCapsule(Vector3 worldPosition0, Vector3 worldPosition1, Color color, float sizeMultiplier, AnimType animType = AnimType.Expand) { Ping( worldPosition0, worldPosition1, color: color, sizeMultiplier: sizeMultiplier, shapeType: ShapeType.Capsule, animType: animType ); }
public static void Ping(Pose worldPose, Color color, float sizeMultiplier, AnimType animType = AnimType.Expand) { Ping( worldPose.position, default(Vector3), null, null, worldPose.rotation, color: color, sizeMultiplier: sizeMultiplier, animType: animType ); }
private void Awake() { base.Awake(); if (mng == null) { mng = this; } btnSureRt = btnSure.GetComponent <RectTransform>(); btnSureStartPosX = btnSureRt.anchoredPosition.x; animType = base.DefaultAnimType; ease = base.DefaultEase; animSpeed = base.DefaultAnimSpeed; }
public override void Reset(AnimType animType) { base.Reset(animType); switch (animType) { case AnimType.HIDE: m_RectTrans.localScale = Vector3.one; break; case AnimType.SHOW: m_RectTrans.localScale = Vector3.zero; break; default: break; } }
public AnimatedSprite(Texture2D texture, AnimType at, int rows, int columns, float frametime, Vector2 pos, float s) { Texture = texture; Rows = rows; frameTime = frametime; Columns = columns; currentFrame = 0; totalFrames = Rows * Columns; this.pos = pos; this.animType = at; isFinished = false; playerDamaged = false; damagedEnemies = new List<Enemy>(); this.scale = s; this.spriteRec = new Rectangle((int)pos.X, (int)pos.Y, (texture.Width / columns) * (int)scale, (texture.Height / rows) * (int)scale); }
public void GetFiles(AnimType focusType) { _updating = true; if (focusType == AnimType.None) { focusType = TargetAnimType; for (int i = 0; i < 6; i++) if ((int)focusType != i) SetSelectedBRRESFile((AnimType)i, null); } else { for (int i = 0; i < 6; i++) if ((int)focusType != i) RetrieveAnimation(focusType, (AnimType)i); } _updating = false; }
/// <summary> /// Reset() called after activating a game object and before playing an animation. /// </summary> /// <param name="animType">Animation type.</param> public override void Reset(AnimType animType) { base.Reset(animType); switch (animType) { case AnimType.HIDE: PlayOnlyZeroFrame(m_HideClip); break; case AnimType.HIDE_BACK: PlayOnlyZeroFrame(m_HideBackClip); break; case AnimType.SHOW: PlayOnlyZeroFrame(m_ShowClip); break; case AnimType.SHOW_BACK: PlayOnlyZeroFrame(m_ShowBackClip); break; default: break; } }
public void GetFiles(AnimType focusType) { if (focusType == AnimType.None) { focusType = TargetAnimType; if (focusType != AnimType.CHR) _chr0 = null; if (focusType != AnimType.SRT) _srt0 = null; if (focusType != AnimType.SHP) _shp0 = null; if (focusType != AnimType.PAT) _pat0 = null; if (focusType != AnimType.VIS) _vis0 = null; if (focusType != AnimType.SCN) _scn0 = null; if (focusType != AnimType.CLR) _clr0 = null; } else { if (focusType != AnimType.CHR) GetCHR0(focusType); if (focusType != AnimType.SRT) GetSRT0(focusType); if (focusType != AnimType.SHP) GetSHP0(focusType); if (focusType != AnimType.PAT) GetPAT0(focusType); if (focusType != AnimType.VIS) GetVIS0(focusType); if (focusType != AnimType.SCN) GetSCN0(focusType); if (focusType != AnimType.CLR) GetCLR0(focusType); } }
public AnimationNode GetAnimation(AnimType type) { switch (type) { case AnimType.CHR: return SelectedCHR0; case AnimType.SRT: return SelectedSRT0; case AnimType.SHP: return SelectedSHP0; case AnimType.PAT: return SelectedPAT0; case AnimType.VIS: return SelectedVIS0; case AnimType.CLR: return SelectedCLR0; default: return null; } }
private void navigate(AnimType type, UserControl control, bool Edit = false) { if (control != null) page = control; switch (type) { case AnimType.OpacityDown: Storyboard sbod = this.TryFindResource("app_close") as Storyboard; sbod.Completed += opacitydown_Completed; sbod.Begin(); break; case AnimType.Opacity: App_Pages_Content.Children.Add(page); Storyboard sbo = this.TryFindResource("opacityup") as Storyboard; sbo.Begin(); curentpage = page.Name; page = null; break; case AnimType.SlideLeft: if (page.Name != curentpage) { App_Pages_Slide.Children.Add(page); Storyboard sbsl = this.TryFindResource("slideleft") as Storyboard; sbsl.Completed += anim_Completed; sbsl.Begin(); } break; case AnimType.SlideRight: if (page.Name != curentpage) { App_Pages_Slide.Children.Add(page); Storyboard sbsr = this.TryFindResource("slideright") as Storyboard; sbsr.Completed += anim_Completed; sbsr.Begin(); } break; case AnimType.PopUp: App_Pages_PopUpGrid.Children.Clear(); App_Pages_PopUpGrid.Children.Add(popUp); Storyboard sbpu = this.TryFindResource("popUp") as Storyboard; sbpu.Completed += sbpu_Completed; sbpu.Begin(); break; case AnimType.PopUpDown: if (curentpage == "cards1") ev(this, new MainEventArgs() { ev = Event.loadCard, Edit = Edit }); App_Pages_PopUpGrid.Children.Clear(); Storyboard sbpud = this.TryFindResource("popUpDown") as Storyboard; sbpud.Begin(); break; } }
public void DefineAnimation(AnimType type, Animation animation) { this.animations[(int) type] = animation; }
/// <summary> /// Sets the primary set, which in this case is just the sprite's title. /// </summary> /// <param name="setName">The name of the set.</param> /// <param name="animType">The AnimType to use.</param> void InternalSetSet(string setName, AnimType animType = AnimType.Loop) { _currentSet = setName; var grhData = GetSetGrhData(_bodyName, setName); if (grhData == null) return; if (_bodyGrh.GrhData == grhData) return; _bodyGrh.SetGrh(grhData, animType, _currentTime); }
public Animation GetAnimation(AnimType type) { return this.animations[(int) type]; }
/// <summary> /// Change the type of animation this animset has /// </summary> /// <param name="newType">The new animation type</param> public void ChangeAnimType(AnimType newType) { myType = newType; }
public AnimationNode RetrieveAnimation(string name, AnimType type) { if (listPanel._animations.ContainsKey(name) && listPanel._animations[name].ContainsKey(type)) return listPanel._animations[name][type]; return null; }
private HelpPageComponent CreatePageComponent(int yPosition, string title, string paragraph, ObjectType graphic, AnimType animation, Point textureCell) { GameObject o = ObjectFactory.CreateObjectOfType(graphic); o.Solid = false; o.IgnoreBehavior = true; o.CurrentAnimation = animation; o.StopsAtBoundries = false; o.StopsAtSides = false; HelpPageComponent component = this.CreatePageComponent(yPosition, title, paragraph, o); if ((textureCell.X > 0) || (textureCell.Y > 0)) { o.DefineAnimation(AnimType.Stopped, new Animation(textureCell, new Size(0x10, 0x10))); o.GetAnimation(AnimType.Stopped).HitboxSize = new SizeF(16f, 16f); } return component; }
/// <summary> /// Reset() called after activating a game object and before playing an animation. /// </summary> public virtual void Reset(AnimType animType) { }
/// <summary> /// Sets the Grh to a new index. /// </summary> /// <param name="grhIndex">New Grh index to use.</param> /// <param name="anim">Type of animation.</param> /// <param name="currentTime">Current time.</param> public void SetGrh(GrhIndex grhIndex, AnimType anim, TickCount currentTime) { var grhData = GrhInfo.GetData(grhIndex); if (grhData == null && grhIndex != 0) { const string errmsg = "Failed to set Grh - GrhIndex `{0}` does not exist."; if (log.IsErrorEnabled) log.ErrorFormat(errmsg, grhIndex); return; } SetGrh(grhData, anim, currentTime); }
/// <summary> /// Sets the Grh to a new index. /// </summary> /// <param name="grhData">New GrhData to use for the Grh.</param> /// <param name="anim">Type of animation.</param> /// <param name="currentTime">Current time.</param> public void SetGrh(GrhData grhData, AnimType anim, TickCount currentTime) { _grhData = grhData; _frame = 0; _anim = anim; _lastUpdated = currentTime; }
protected IEnumerator IEPlayAnimation(string sn, AnimType animType, NoParamCallback callback = null) { SSMotion an = m_DictAllScene[sn].GetComponentInChildren<SSMotion>(); if (an != null && animType != AnimType.NO_ANIM) { an.Reset(animType); yield return null; NoParamCallback play = null; float time = 0; switch (animType) { case AnimType.SHOW: play = an.PlayShow; time = an.TimeShow (); break; case AnimType.SHOW_BACK: play = an.PlayShowBack; time = an.TimeShowBack (); break; case AnimType.HIDE: play = an.PlayHide; time = an.TimeHide (); break; case AnimType.HIDE_BACK: play = an.PlayHideBack; time = an.TimeHideBack (); break; } if (play != null) { play (); } yield return StartCoroutine (Pause (time)); yield return new WaitForEndOfFrame(); OnAnimationFinish(sn); if (callback != null) callback (); } else { if (animType == AnimType.NO_ANIM && an != null) { MoveAnimTransformPosition(an, 0); } if (callback != null) callback (); } }
protected void FixedUpdate() { var speed = _rigid.velocity; speed += Vector2.ClampMagnitude(_desiredSpeed - speed, (_isDashing ? DashAcceleration : Acceleration)*Time.fixedDeltaTime); _rigid.velocity = speed; if(_currentAnim == AnimType.Idle || _currentAnim == AnimType.Move) if (speed.sqrMagnitude > 0.2f != (_currentAnim == AnimType.Move)) { _frameNumber = 0; _frameTicker = 0; _currentAnim = speed.sqrMagnitude > 0.2f ? AnimType.Move : AnimType.Idle; } if (speed.sqrMagnitude > 0.1f) { _heading = speed.normalized; var localScale = Renderer.transform.localScale; localScale.x = Mathf.Abs(localScale.x) * (_heading.x < 0 ? -1 : 1); Renderer.transform.localScale = localScale; /*if (_heading.x < 0) { _heading.x = -_heading.x; }*/ } var maxDot = float.MinValue; Animation a = null; var normHeading = _heading; if (normHeading.x < 0) normHeading.x = -_heading.x; foreach (var anim in Anims) { if(anim.AnimType != _currentAnim) continue; var f = Vector3.Dot(anim.Heading.normalized, normHeading); if (f > maxDot) { maxDot = f; a = anim; } } if (a != null) { _frameTicker += Time.deltaTime; if (_frameTicker > 63f/60/a.FrameRate) { _frameNumber++; _frameTicker -= 1 / a.FrameRate; } if (_frameNumber >= a.Frames.Length) { _frameNumber = a.LoopFromFrame; } //_frameNumber %= a.Frames.Length; Renderer.sprite = a.Frames[_frameNumber]; } _isDashing = false; }
float UpdateAnimation(float initialValue, float targetValue, float time, float duration, AnimType animationType) { switch (animationType) { case AnimType.Linear: return Anim.Linear(initialValue, targetValue, time, duration); case AnimType.Overshoot: return Anim.Overshoot(initialValue, targetValue, time, duration); case AnimType.Bounce: return Anim.Bounce(initialValue, targetValue, time, duration); case AnimType.EaseOutCubed: return Anim.Cube.Out(initialValue, targetValue, time, duration); case AnimType.EaseOutQuint: return Anim.Quint.Out(initialValue, targetValue, time, duration); case AnimType.EaseOutSept: return Anim.Sept.Out(initialValue, targetValue, time, duration); case AnimType.EaseInCubed: return Anim.Cube.In(initialValue, targetValue, time, duration); case AnimType.EaseInQuint: return Anim.Quint.In(initialValue, targetValue, time, duration); case AnimType.EaseInSept: return Anim.Sept.In(initialValue, targetValue, time, duration); case AnimType.EaseInOutCubed: return Anim.Cube.InOut(initialValue, targetValue, time, duration); case AnimType.EaseInOutQuint: return Anim.Quint.InOut(initialValue, targetValue, time, duration); case AnimType.EaseInOutSept: return Anim.Sept.InOut(initialValue, targetValue, time, duration); case AnimType.SoftEaseOutCubed: return Anim.Cube.SoftOut(initialValue, targetValue, time, duration); case AnimType.SoftEaseOutQuint: return Anim.Quint.SoftOut(initialValue, targetValue, time, duration); case AnimType.SoftEaseOutSept: return Anim.Sept.SoftOut(initialValue, targetValue, time, duration); } return 0f; }
/// <summary> /// Updates the current frame. /// </summary> /// <param name="currentTime">The current time.</param> void UpdateFrameIndex(TickCount currentTime) { var elapsedTime = currentTime - _lastUpdated; Debug.Assert(elapsedTime >= 0, "How is the elapsed time negative? Did the computer fall into a wormhole?"); if (elapsedTime <= 0) return; // Store the temporary new frame var tmpFrame = _frame + (elapsedTime * GrhData.Speed); // Check if the frame limit has been exceeded if (tmpFrame >= GrhData.FramesCount) { if (_anim == AnimType.LoopOnce) { // The animation was only looping once, so end it and set at the first frame _anim = AnimType.None; _frame = 0; return; } else { // Animation is looping so get the frame back into range tmpFrame = tmpFrame % GrhData.FramesCount; } } // Set the new frame _frame = tmpFrame; }
public bool RetrieveAnimation(AnimType focusType, AnimType type) { AnimationNode f = GetAnimation(focusType); if (f == null) { SetSelectedBRRESFile(type, null); return false; } SetSelectedBRRESFile(type, RetrieveAnimation(f.Name, type)); return GetAnimation(type) != null; }
/// <summary> /// Initializes a new instance of the <see cref="Grh"/> class. /// </summary> /// <param name="grhIndex">Index of the Grh.</param> /// <param name="anim">Animation type.</param> /// <param name="currentTime">Current time.</param> public Grh(GrhIndex grhIndex, AnimType anim, TickCount currentTime) { SetGrh(grhIndex, anim, currentTime); }
/// <summary> /// Creates a Grh. /// </summary> /// <param name="grhData">GrhData to create from.</param> /// <param name="anim">Animation type.</param> /// <param name="currentTime">Current time.</param> public Grh(GrhData grhData, AnimType anim, TickCount currentTime) { SetGrh(grhData, anim, currentTime); }
public void SetSelectedBRRESFile(AnimType type, AnimationNode value) { switch (type) { case AnimType.CHR: SelectedCHR0 = value as CHR0Node; break; case AnimType.SRT: SelectedSRT0 = value as SRT0Node; break; case AnimType.SHP: SelectedSHP0 = value as SHP0Node; break; case AnimType.PAT: SelectedPAT0 = value as PAT0Node; break; case AnimType.VIS: SelectedVIS0 = value as VIS0Node; break; case AnimType.CLR: SelectedCLR0 = value as CLR0Node; break; } }
public void AnimChanged(AnimType type) { //Update animation editors if (type != AnimType.SRT) modelListsPanel1.UpdateSRT0Selection(null); if (type != AnimType.PAT) modelListsPanel1.UpdatePAT0Selection(null); switch (type) { case AnimType.CHR: break; case AnimType.SRT: modelListsPanel1.UpdateSRT0Selection(SelectedSRT0); break; case AnimType.SHP: shp0Editor.UpdateSHP0Indices(); break; case AnimType.PAT: pat0Editor.UpdateBoxes(); modelListsPanel1.UpdatePAT0Selection(SelectedPAT0); break; case AnimType.VIS: vis0Editor.UpdateAnimation(); break; case AnimType.CLR: clr0Editor.UpdateAnimation(); break; } if (GetAnimation(type) == null) { pnlPlayback.numFrameIndex.Maximum = MaxFrame = 0; pnlPlayback.numTotalFrames.Minimum = 0; _updating = true; pnlPlayback.numTotalFrames.Value = 0; _updating = false; pnlPlayback.btnPlay.Enabled = pnlPlayback.numTotalFrames.Enabled = pnlPlayback.numFrameIndex.Enabled = false; pnlPlayback.btnLast.Enabled = false; pnlPlayback.btnFirst.Enabled = false; pnlPlayback.Enabled = false; RunTime.SetFrame(-1); } else { int oldMax = MaxFrame; MaxFrame = GetAnimation(type).FrameCount; _updating = true; pnlPlayback.btnPlay.Enabled = pnlPlayback.numFrameIndex.Enabled = pnlPlayback.numTotalFrames.Enabled = true; pnlPlayback.Enabled = true; pnlPlayback.numTotalFrames.Value = MaxFrame; if (syncLoopToAnimationToolStripMenuItem.Checked) pnlPlayback.chkLoop.Checked = GetAnimation(type).Loop; _updating = false; if (MaxFrame < oldMax) { RunTime.SetFrame(0); pnlPlayback.numFrameIndex.Maximum = MaxFrame; } else { pnlPlayback.numFrameIndex.Maximum = MaxFrame; RunTime.SetFrame(0); } } }