/// <summary> /// Perform an animation of the given type and index. No animation will be played if the animation /// is not present. The index given is the index of the animation in the array specified on the /// prefab, not the index of the animation out of all the animations /// </summary> /// <param name="type">The type of animation to play</param> /// <param name="index">The index of the animation</param> public void Attack(AnimationType type, int index) { AnimationClip[] animations; switch (type) { case AnimationType.Spell: animations = _spellAnimations; break; case AnimationType.Misc: animations = _miscAnimations; break; default: animations = _meleeAnimations; break; } try { animation.Play(animations[index].name); } catch { Debug.LogWarning("There is no " + type + " animation " + "indexed at " + index + "."); } }
public Animation CreateAnimation(AnimationType animationName, IndexPair startLocation) { switch (animationName) { case AnimationType.PlayerAnimation: temp = new PlayerAnimation(); break; case AnimationType.MonsterAnimation: temp = new MonsterAnimation(); // new MonsterAnimation(); temp.AddCollider(); //((MonsterAnimation)temp).Collider = new Collider(((MonsterAnimation)temp)); break; // The animation point will be set when its requested from the pool case AnimationType.BulletAnimation: temp = new BulletAnimation(); temp.AddCollider(); //((BulletAnimation)temp).Collider = new Collider(((BulletAnimation)temp)); break; // The animation point will be set when its requested from the pool case AnimationType.ExplosionAnimation: temp = new ExplosionAnimation(); break; default: return null; } return temp; }
public static Animation CreateEmpyAnimation(AnimationType animationName) { IndexPair startLocation = new IndexPair(0, 0); switch (animationName) { case AnimationType.PlayerAnimation: temp = new PlayerAnimation(); temp.AddCollider(); break; case AnimationType.MonsterAnimation: temp = new MonsterAnimation(); // new MonsterAnimation(); temp.AddCollider(); //((MonsterAnimation)temp).Collider = new Collider(((MonsterAnimation)temp)); break; // The animation point will be set when its requested from the pool case AnimationType.BulletAnimation: temp = new BulletAnimation(); temp.AddCollider(); //((BulletAnimation)temp).Collider = new Collider(((BulletAnimation)temp)); break; // The animation point will be set when its requested from the pool case AnimationType.ExplosionAnimation: temp = new ExplosionAnimation(); temp.Collider = new Collider(temp, System.Drawing.Rectangle.Empty); break; default: return null; } return temp; }
public static AnimationTimeline Create(AnimationType type, object oldValue, object newValue, TimeSpan duration, TimeSpan beginTime, double acceleration, double deceleration) { switch (type) { case AnimationType.DoubleAnimation: if (oldValue != null) return new DoubleAnimation((double)oldValue, (double)newValue, duration) { BeginTime = beginTime, AccelerationRatio = acceleration, DecelerationRatio = deceleration }; else return new DoubleAnimation((double)newValue, duration) { BeginTime = beginTime, AccelerationRatio = acceleration, DecelerationRatio = deceleration }; case AnimationType.ColorAnimation: if (newValue is Color) { if (oldValue != null) return new ColorAnimation((Color)oldValue, (Color)newValue, duration) { BeginTime = beginTime, AccelerationRatio = acceleration, DecelerationRatio = deceleration }; else return new ColorAnimation((Color)newValue, duration) { BeginTime = beginTime, AccelerationRatio = acceleration, DecelerationRatio = deceleration }; } else { if (oldValue != null) return new ColorAnimation((Color)oldValue, (Color)ColorConverter.ConvertFromString(newValue as string), duration) { BeginTime = beginTime, AccelerationRatio = acceleration, DecelerationRatio = deceleration }; else return new ColorAnimation((Color)ColorConverter.ConvertFromString(newValue as string), duration) { BeginTime = beginTime, AccelerationRatio = acceleration, DecelerationRatio = deceleration }; } case AnimationType.ThicknessAnimation: if (oldValue != null) return new ThicknessAnimation((Thickness)oldValue, (Thickness)newValue, duration) { BeginTime = beginTime, AccelerationRatio = acceleration, DecelerationRatio = deceleration }; else return new ThicknessAnimation((Thickness)newValue, duration) { BeginTime = beginTime, AccelerationRatio = acceleration, DecelerationRatio = deceleration }; default: return null; } }
public void Create(string name, AnimationType animationType, int frames, int rows, int columns, Vector2 firstFrameStart, float tilingX, float tilingY) { _name = name; _animationType = animationType; _frames = frames; _rows = rows; _columns = columns; _firstFrameStart = firstFrameStart; _tilingX = tilingX; _tilingY = tilingY; _currentFrame = 2; int frameCounter = 0; _spriteInfo = new Hashtable(); for (int row = 0; row < rows; row++) { for (int column = 0; column < columns; column++) { frameCounter++; Vector2 frameCoords = new Vector2(); frameCoords.x = firstFrameStart.x + ( tilingX * (float)column ); frameCoords.y = firstFrameStart.y + ( tilingY * (float)row ); _spriteInfo.Add(frameCounter, frameCoords); } } }
public SpellObject( uint ID, uint Count, uint OverlayFileRID, uint NameRID, uint Flags, ushort LightFlags, byte LightIntensity, ushort LightColor, AnimationType FirstAnimationType, byte ColorTranslation, byte Effect, Animation Animation, BaseList<SubOverlay> SubOverlays, byte TargetsCount, SchoolType SchoolType) : base(ID, Count, OverlayFileRID, NameRID, Flags, LightFlags, LightIntensity, LightColor, FirstAnimationType, ColorTranslation, Effect, Animation, SubOverlays) { this.targetsCount = TargetsCount; this.schoolType = SchoolType; }
public void StartAnimation(AnimationType animType) { switch (animType) { case AnimationType.rotate: StartRotate (); break; case AnimationType.rotateY: StartRotateY (); break; case AnimationType.move: StartMoveAdd (); break; case AnimationType.punchscale: StartPunchScale (new Vector3 (1, 1, 1)); break; case AnimationType.linerotate: StartRotateLine (); break; case AnimationType.linerotateY: StartRotateLineY (); break; case AnimationType.movefrom: StartMoveFrom (); break; default: return; break; } }
//애니메이션을 재생합니다. public void PlayAnimation(AnimationType anim) { m_current = anim; //초밥 종류에 따라서 애니메이션을 지정합니다. string animName = m_sushiType.ToString() + "_" + m_current.ToString(); m_animation.Play(animName); }
public AnimatorHelperBase GetContinuumAnimation(FrameworkElement element, AnimationType animationType) { TextBlock nameText; if (element is TextBlock) nameText = element as TextBlock; else nameText = element.GetVisualDescendants().OfType<TextBlock>().FirstOrDefault(); if (nameText != null) { if (animationType == AnimationType.NavigateForwardIn) { return new ContinuumForwardInAnimator() { RootElement = nameText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateForwardOut) { return new ContinuumForwardOutAnimator() { RootElement = nameText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateBackwardIn) { return new ContinuumBackwardInAnimator() { RootElement = nameText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateBackwardOut) { return new ContinuumBackwardOutAnimator() { RootElement = nameText, LayoutRoot = AnimationContext }; } } return null; }
/// <summary> /// Loads an animated graphics. The descriptor file for the animation must be /// in the "animations" folder. /// </summary> /// <param name="animationName">The name of the animation.</param> /// <param name="game"></param> public AnimatedGraphics(string animationName, Game game) { PropertyReader props = game.loader.GetPropertyReader().Select("animations/" + animationName + ".xml"); foreach (PropertyReader group in props.SelectAll("group")) { Animation current = new Animation(); string[] animName = group.GetString("name").Split('.'); string type = animName[0]; Sprite.Dir dir = (Sprite.Dir)Enum.Parse(typeof(Sprite.Dir), animName[1], true); AnimationType animType = new AnimationType(type, dir); List<Frame> frames = new List<Frame>(); foreach (PropertyReader frameProp in group.SelectAll("frame")) { Frame frame = new Frame(); frame.id = frameProp.GetInt("sheetid"); frame.time = frameProp.GetInt("time"); frames.Add(frame); } current.frames = frames.ToArray(); animations.Add(animType, current); if (this.currentAnimation == null) { this.currentAnimation = current; this.currentType = animType; } } LoadSpriteSheet(props.GetString("sheet"), game); if (currentAnimation == null) { throw new Game.SettingsException(string.Format("Animation descriptor file \"{0}.xml\" does not contain animation!", animationName)); } this.frame = 0; CalculateRows(); }
public Animation(EpicModel epicModel, AnimationType animationType) { _epicModel = epicModel; AnimationType = animationType; _keyframes = new List<Keyframe>(10); _ignoredModelParts = new List<ModelPart>(); }
/// <summary> /// GameObjectを作成する /// </summary> /// <param name='format'>内部形式データ</param> /// <param name='use_rigidbody'>剛体を使用するか</param> /// <param name='animation_type'>アニメーションタイプ</param> /// <param name='use_ik'>IKを使用するか</param> /// <param name='scale'>スケール</param> public static GameObject CreateGameObject(PMXFormat format, bool use_rigidbody, AnimationType animation_type, bool use_ik, float scale) { GameObject result; using (PMXConverter converter = new PMXConverter()) { result = converter.CreateGameObject_(format, use_rigidbody, animation_type, use_ik, scale); } return result; }
/// <summary> /// Returns the appropriate function given the /// requested animation type /// </summary> /// <param name="time"></param> /// <param name="startingPoint"></param> /// <param name="change"></param> /// <param name="animationTime"></param> /// <param name="animType"></param> /// <returns></returns> public static double Animate(double time, double startingPoint, double change, double animationTime, AnimationType animType) { // If the animation is complete // Return the destination to avoid overshoot if (time > animationTime) { return startingPoint + change; } switch (animType) { case AnimationType.Linear: return Linear(time, startingPoint, change, animationTime); case AnimationType.QuadraticIn: return QuadraticIn(time, startingPoint, change, animationTime); case AnimationType.QuadraticOut: return QuadraticOut(time, startingPoint, change, animationTime); case AnimationType.QuadraticInOut: return QuadraticInOut(time, startingPoint, change, animationTime); case AnimationType.CubicIn: return CubicIn(time, startingPoint, change, animationTime); case AnimationType.CubicOut: return CubicOut(time, startingPoint, change, animationTime); case AnimationType.CubicInOut: return CubicInOut(time, startingPoint, change, animationTime); case AnimationType.QuarticIn: return QuarticIn(time, startingPoint, change, animationTime); case AnimationType.QuarticOut: return QuarticOut(time, startingPoint, change, animationTime); case AnimationType.QuarticInOut: return QuarticInOut(time, startingPoint, change, animationTime); case AnimationType.QuinticIn: return QuinticIn(time, startingPoint, change, animationTime); case AnimationType.QuinticOut: return QuinticOut(time, startingPoint, change, animationTime); case AnimationType.QuinticInOut: return QuinticInOut(time, startingPoint, change, animationTime); case AnimationType.SinIn: return SinIn(time, startingPoint, change, animationTime); case AnimationType.SinOut: return SinOut(time, startingPoint, change, animationTime); case AnimationType.SinInOut: return SinInOut(time, startingPoint, change, animationTime); case AnimationType.ExpIn: return ExpIn(time, startingPoint, change, animationTime); case AnimationType.ExpOut: return ExpOut(time, startingPoint, change, animationTime); case AnimationType.ExpInOut: return ExpInOut(time, startingPoint, change, animationTime); case AnimationType.CircIn: return CircIn(time, startingPoint, change, animationTime); case AnimationType.CircOut: return CircOut(time, startingPoint, change, animationTime); case AnimationType.CircInOut: return CircInOut(time, startingPoint, change, animationTime); default: throw new Exception("An Invalid Enum was given"); } }
public virtual void Setup(AnimationType animType) { _rectTransform = GetComponent<RectTransform>(); _canvas = GetComponent<Canvas>(); _animationType = animType; gameObject.SetActive(false); }
public Settings (bool automaticChange, bool onlyFavorites, bool randomOrder, double changeInterval, AnimationType animationType) { AutomaticChange = automaticChange; OnlyFavorites = onlyFavorites; RandomOrder = randomOrder; ChangeInterval = changeInterval; AnimationType = animationType; }
// Use this for initialization void Start() { m_animation = GetComponent<Animation>(); m_current = AnimationType.sleep; if (m_animation.isPlaying == false) { PlayAnimation(AnimationType.sleep); } }
public AnimationComponent(int entityId, AnimationCategory animationCategory, AnimationType animationType, int ticksPerFrame) { _entityId = entityId; _animationCategory = animationCategory; _animationType = animationType; _ticksPerFrame = ticksPerFrame; _ticksSinceFrameChange = _ticksPerFrame; _shape = new RectangleShape(); }
public Animation(GameEntity gameEntity, AnimationType animationType, int frameCount, float frameTime, bool loop) { _gameEntity = gameEntity; _texture = gameEntity.Texture; _animationType = animationType; _frameCount = frameCount; _frameTime = frameTime; _loop = loop; }
public Animation(Texture2D texture, int frameTime, int frameWidth, AnimationType animationType ) { this._animationType = animationType; this.Texture = texture; this._frameTime = frameTime; this._frameWidth = frameWidth; this._totalFrame = this.Texture.Width / this._frameWidth; this.Reset(); }
protected override void Parse( BigEndianReader reader ) { reader.ReadByte(); // ID _Serial = reader.ReadUInt32(); _AnimationType = (AnimationType) reader.ReadInt16(); _Action = reader.ReadInt16(); _Delay = reader.ReadByte(); }
public Marker(MarkerType markertype, Vector3 position, Color color, AnimationType type) { this.markertype = markertype; this.position = position; this.color = color; this.type = type; this.scale = Default_Scale; _time = 0; }
public bool IsAnimatedWith(AnimationType type) { foreach(Animation anim in Animations) { if(anim.Type == type) return true; } return false; }
public AnimatedTitle(AnimationType animationType, string title, params string[] names) { _animationType = animationType; Title = title; foreach (string name in names) { NamesCollection.Add(name); } }
public void Play(AnimationType animationType) { if(animationType != _currentAnimation) { _currentAnimation = animationType; _animator.SetInteger(_parameter, (int)_currentAnimation); SetSpeed(1); } }
/// <summary> /// Constructs a new animation. /// </summary> /// <param name="spriteSheet">The sprite sheet for the animation to use.</param> /// <param name="position">The screen position of the animation.</param> /// <param name="scale">The scale of the animation.</param> /// <param name="millisecondsBetweenFrame">The milliseconds between each frame in the animation.</param> /// <param name="frameWidth">The width of each animation frame.</param> /// <param name="frameHeight">The height of each animation frame.</param> /// <param name="animationType">The type of animation.</param> public Animation(Texture2D spriteSheet, Vector2 position, Vector2 scale, int millisecondsBetweenFrame, int frameWidth, int frameHeight, AnimationType animationType) : base(spriteSheet, position, scale) { _millisecondsBetweenFrame = millisecondsBetweenFrame; _frameWidth = frameWidth; _frameHeight = frameHeight; _sheetFrameWidth = _texture.Width / frameWidth; _sheetFrameHeight = _texture.Height / frameHeight; _animType = animationType; }
public static AnimationNode GetAnimationNodeTempl( AnimationType tp , float duration ) { string path = ViNoToolUtil.GetAssetDataPath() + "Templates/AnimationNode.prefab"; GameObject animObj = AssetDatabase.LoadAssetAtPath( path , typeof( GameObject) ) as GameObject; AnimationNode animNode = animObj.GetComponent<AnimationNode>(); animNode.animationType = tp; animNode.animTarget = Selection.activeGameObject; animNode.duration = duration; return animNode; }
/// <summary> /// Cunstructor for normal storyboard commands /// </summary> /// <param name="easing"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="startParams"></param> /// <param name="endParams"></param> public Animation(AnimationType animationType, int easing, int startTime, int endTime, double[] startParams, double[] endParams) : base(startTime) { this.animationType = animationType; this.easing = easing; this.endTime = endTime; this.startParams = startParams; this.endParams = endParams; }
public Animation(Texture2D texture, Rectangle drawRectangle, int switchFrame, int restart, AnimationType type) { this._type = type; SourceRectangle = new Rectangle(0, 0, drawRectangle.Width, drawRectangle.Height); this.Texture = texture; this.DrawRectangle = drawRectangle; this.SwitchFrame = switchFrame; this.Restart = restart; _frameCount = new Vector2(texture.Width / drawRectangle.Width, texture.Height / drawRectangle.Height); }
// Called by the consumer when they want to animate the LED public void Animate(double red, double green, double blue, double intensity, TimeSpan animationTime, AnimationType type = AnimationType.Linear) { // Bounds check if((red < 0 || red > 1.0) && red != AnimatedLed.INGORE_VALUE) { throw new ArgumentOutOfRangeException("Red must be between 0 and 1 except for -1!"); } if ((green < 0 || green > 1.0) && green != AnimatedLed.INGORE_VALUE) { throw new ArgumentOutOfRangeException("Green must be between 0 and 1 except for -1!"); } if ((blue < 0 || blue > 1.0) && blue != AnimatedLed.INGORE_VALUE) { throw new ArgumentOutOfRangeException("Blue must be between 0 and 1 except for -1!"); } if ((intensity < 0 || intensity > 1.0) && intensity != AnimatedLed.INGORE_VALUE) { throw new ArgumentOutOfRangeException("Intensity must be between 0 and 1 except for -1!"); } if(animationTime.TotalMilliseconds < 0) { throw new ArgumentOutOfRangeException("The animation time must be positive!"); } // Update the values that need updating if(red != AnimatedLed.INGORE_VALUE) { m_desiredRed = red; m_startRed = m_led.Red; m_animationLengthRed = (uint)animationTime.TotalMilliseconds; m_animationRemainRed = (int)animationTime.TotalMilliseconds; } if(green != AnimatedLed.INGORE_VALUE) { m_desiredGreen = green; m_startGreen = m_led.Green; m_animationLengthGreen = (uint)animationTime.TotalMilliseconds; m_animationRemainGreen = (int)animationTime.TotalMilliseconds; } if (blue != AnimatedLed.INGORE_VALUE) { m_desiredBlue = blue; m_startBlue = m_led.Blue; m_animationLengthBlue = (uint)animationTime.TotalMilliseconds; m_animationRemainBlue = (int)animationTime.TotalMilliseconds; } if (intensity != AnimatedLed.INGORE_VALUE) { m_desiredIntensity = intensity; m_startIntensity = m_led.Intensity; m_animationLengthIntensity = (uint)animationTime.TotalMilliseconds; m_animationRemainIntensity = (int)animationTime.TotalMilliseconds; } }
protected AbstractActionAbility(String name, int actionCost, AbilityType abilityType, TargetTypes targetTypes, DefaultTargetType defaultTarget, AnimationType animType , AbstractDamageBehaviour damageBehaviour) : base(name, actionCost, abilityType) { this.TargetType = targetTypes; this.DefaultTarget = defaultTarget; abilityType |= AbilityType.Action; //this.AnimationBehaviour = animBehaviour; this.DamageBehaviour = damageBehaviour; this.AnimationType = animType; }
/// <summary> Initializes a new instance of the <see cref="Move" /> class </summary> /// <param name="animationType"> The animation type that determines the behavior of this animation </param> public Move(AnimationType animationType) { Reset(animationType); }
public AnimatedSprite(float x, float y, string sprite, AnimationType animationType, int totalFrames, int columns, float frameDuration) : this(x, y, sprite, animationType, totalFrames, columns, frameDuration, true) { }
public static void AnimationFlip(this UIView view, AnimationType type, FlipType flip, double duration = 0.3, Action <bool> onCompletion = null) { var m34 = (nfloat)(-1 * 0.001); view.Alpha = 1.0f; var minTransform = CATransform3D.Identity; minTransform.m34 = m34; var maxTransform = CATransform3D.Identity; maxTransform.m34 = m34; nfloat x = flip == FlipType.Horizontal ? 1.0f : 0f; nfloat y = flip == FlipType.Vertical ? 1.0f : 0f; switch (type) { case AnimationType.In: minTransform = minTransform.Rotate((float)(1 * Math.PI * 0.5), x, y, 0.0f); view.Alpha = MinAlpha; view.Layer.Transform = minTransform; break; case AnimationType.Out: minTransform = minTransform.Rotate((float)(-1 * Math.PI * 0.5), x, y, 0.0f); view.Alpha = MaxAlpha; view.Layer.Transform = maxTransform; break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } AnimateNotifyInternal(duration, () => { view.Layer.AnchorPoint = new CGPoint(0.5f, 0.5f); switch (type) { case AnimationType.In: view.Alpha = MaxAlpha; view.Layer.Transform = maxTransform; break; case AnimationType.Out: view.Alpha = MinAlpha; view.Layer.Transform = minTransform; break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }, onCompletion); }
public ColorAnimation(Color colorFrom, Color colorTo, Time animationPeriod, AnimationType type, InterpolationMethod method) : base(0, 1, animationPeriod, type, method) { this.colorFrom = colorFrom; this.colorTo = colorTo; }
protected override void AnimationsComplete(AnimationType animationType) { CreditList.SelectedIndex = -1; base.AnimationsComplete(animationType); }
public virtual void Draw(TimeSpan dt) { if (_deathTimerSet) { if (Extensions.GetMS() - _deathCallTime > _deathTime) { Enabled = false; } } if (IsAnimated && Timing.DrawTiming.Elapsed - _lastUpdate > TimeSpan.FromMilliseconds(Animation.FrameRate)) { Texture = Animation.Frames[Animation.CurrentFrame]; _lastUpdate = Timing.DrawTiming.Elapsed; Animation.CurrentFrame += 1; Animation.CurrentFrame %= Animation.Frames.Count; if (AnimationType == AnimationType.CutIn && Animation.CurrentFrame == 0 && _stashedAnimation != null) { Animation = _stashedAnimation; _stashedAnimation = null; AnimationFinished = true; } if (AnimationType == AnimationType.Single && Animation.CurrentFrame == 0) { Texture = _stashedFrame; IsAnimated = false; AnimationType = AnimationType.None; AnimationFinished = true; } } if (Texture != null) { int cax = 0; int cay = 0; if (FollowCamera) { cax = Program.Game.Camera.X; cay = Program.Game.Camera.Y; } if (UseBlur && Program.Blur) { double dix = Position.X - Program.BlurOrigin.X; double diy = Position.Y - Program.BlurOrigin.Y; double hyp = Math.Sqrt(dix * dix + diy * diy); double dy = diy / hyp * Program.BlurStrength; double dx = dix / hyp * Program.BlurStrength; int prevOpacity = Opacity; Opacity = Program.BlurOpacity; double cx = 0; double cy = 0; while (Opacity > 0) { if (FlipHorizontally) { Program.Game.SpriteBatch?.Draw(Texture, new Rectangle((int)(Position.X + cx + cax), (int)(Position.Y + cy + cay), (int)(Width * Scale), (int)(Height * Scale)), null, Tint * (Opacity / 255.0f), Orientation, new Vector2(Texture.Width / 2.0f, Texture.Height / 2.0f), SpriteEffects.FlipHorizontally, Layer); } else { Program.Game.SpriteBatch?.Draw(Texture, new Rectangle((int)(Position.X + cx + cax), (int)(Position.Y + cy + cay), (int)(Width * Scale), (int)(Height * Scale)), null, Tint * (Opacity / 255.0f), Orientation, new Vector2(Texture.Width / 2.0f, Texture.Height / 2.0f), SpriteEffects.None, Layer); } Opacity -= 25; cx += dx; cy += dy; } Opacity = prevOpacity; } else { if (FlipHorizontally) { Program.Game.SpriteBatch?.Draw(Texture, new Rectangle(Position.X + cax, Position.Y + cay, (int)(Width * Scale), (int)(Height * Scale)), null, Tint * (Opacity / 255.0f), Orientation, new Vector2(Texture.Width / 2.0f, Texture.Height / 2.0f), SpriteEffects.FlipHorizontally, Layer); } else { Program.Game.SpriteBatch?.Draw(Texture, new Rectangle(Position.X + cax, Position.Y + cay, (int)(Width * Scale), (int)(Height * Scale)), null, Tint * (Opacity / 255.0f), Orientation, new Vector2(Texture.Width / 2.0f, Texture.Height / 2.0f), SpriteEffects.None, Layer); } } //Program.Game.SpriteBatch?.Draw(Texture, new Rectangle(position.X, position.Y, Texture.Width, Texture.Height), null, Color.White, Orientation, new Vector2(Texture.Width / 2.0f, Texture.Height / 2.0f), SpriteEffects.None, Layer); //Program.Game.SpriteBatch?.Draw(Texture, position.ToVector2()); WrapInCollider(); } else { Console.WriteLine("Detected null texture, skipping set."); } }
public static bool IsPlayingAny(AnimationType type = AnimationType.All) { return(Animations.Any(animation => type.HasFlag(animation.type) && animation.isPlaying)); }
private MotionTextElement SelectMotionType(AnimationType animationType, GameObject go) { MotionTextElement motion; switch (animationType) { case AnimationType.BasicFadeInOut: motion = go.AddComponent <BasicFadeInOut>(); break; case AnimationType.BasicGameTextBoxAnimation: motion = go.AddComponent <BasicGameTextBoxAnimation>(); break; case AnimationType.Slash: motion = go.AddComponent <BackgroundSlashs>(); break; case AnimationType.CutSlash: motion = go.AddComponent <CutSlash>(); break; case AnimationType.LaidWords: motion = go.AddComponent <LaidWords>(); break; case AnimationType.LaidWords_FromTheLeft: motion = go.AddComponent <LaidWords_FromTheLeft>(); break; case AnimationType.LineCircle: motion = go.AddComponent <LineCircleMotion>(); break; case AnimationType.VerticalFlow: motion = go.AddComponent <VerticalFlow>(); break; case AnimationType.LineRect: motion = go.AddComponent <LineRectMotion>(); break; case AnimationType.RectReactionText: motion = go.AddComponent <RectReactionText>(); break; case AnimationType.SineWave: motion = go.AddComponent <SineWave>(); break; case AnimationType.HorizontalFlow: motion = go.AddComponent <HorizontalFlow>(); break; case AnimationType.HorizontalLines: motion = go.AddComponent <HorizontalLines>(); break; case AnimationType.FlowUp: motion = go.AddComponent <FlowUp>(); break; case AnimationType.VerticalLines: motion = go.AddComponent <VerticalLines>(); break; case AnimationType.PopUpWords: motion = go.AddComponent <PopUpWords>(); break; case AnimationType.SlideIn_LeftToRight: motion = go.AddComponent <SlideIn_LeftToRight>(); break; case AnimationType.SlideIn_RightToLeft: motion = go.AddComponent <SlideIn_RightToLeft>(); break; default: motion = go.AddComponent <BasicFadeInOut>(); break; } motion.AnimationCurveAsset = AnimationCurves; motion.Graphics = graphics; // motion.TmProCapture = tmProCapture; return(motion); }
public static AnimationType ConvertAnimType(int i) { return(AnimationType.GetAnimationType(i)); }
/// <summary> Initializes a new instance of the UIAnimations.Database class, of the given type (AnimationType) </summary> /// <param name="animationType"> The animation type that determines what type of UIAnimationDatabase databases this database contains </param> public UIAnimationsDatabase(AnimationType animationType) { DatabaseType = animationType; Databases = new List <UIAnimationDatabase>(); DatabaseNames = new List <string>(); }
public AnimationClip(ObjectReader reader) : base(reader) { if (version[0] >= 5)//5.0 and up { m_Legacy = reader.ReadBoolean(); } else if (version[0] >= 4)//4.0 and up { m_AnimationType = (AnimationType)reader.ReadInt32(); if (m_AnimationType == AnimationType.kLegacy) { m_Legacy = true; } } else { m_Legacy = true; } m_Compressed = reader.ReadBoolean(); if (version[0] > 4 || (version[0] == 4 && version[1] >= 3))//4.3 and up { m_UseHighQualityCurve = reader.ReadBoolean(); } reader.AlignStream(); int numRCurves = reader.ReadInt32(); m_RotationCurves = new QuaternionCurve[numRCurves]; for (int i = 0; i < numRCurves; i++) { m_RotationCurves[i] = new QuaternionCurve(reader); } int numCRCurves = reader.ReadInt32(); m_CompressedRotationCurves = new CompressedAnimationCurve[numCRCurves]; for (int i = 0; i < numCRCurves; i++) { m_CompressedRotationCurves[i] = new CompressedAnimationCurve(reader); } if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up { int numEulerCurves = reader.ReadInt32(); m_EulerCurves = new Vector3Curve[numEulerCurves]; for (int i = 0; i < numEulerCurves; i++) { m_EulerCurves[i] = new Vector3Curve(reader); } } int numPCurves = reader.ReadInt32(); m_PositionCurves = new Vector3Curve[numPCurves]; for (int i = 0; i < numPCurves; i++) { m_PositionCurves[i] = new Vector3Curve(reader); } int numSCurves = reader.ReadInt32(); m_ScaleCurves = new Vector3Curve[numSCurves]; for (int i = 0; i < numSCurves; i++) { m_ScaleCurves[i] = new Vector3Curve(reader); } int numFCurves = reader.ReadInt32(); m_FloatCurves = new FloatCurve[numFCurves]; for (int i = 0; i < numFCurves; i++) { m_FloatCurves[i] = new FloatCurve(reader); } if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up { int numPtrCurves = reader.ReadInt32(); m_PPtrCurves = new PPtrCurve[numPtrCurves]; for (int i = 0; i < numPtrCurves; i++) { m_PPtrCurves[i] = new PPtrCurve(reader); } } m_SampleRate = reader.ReadSingle(); m_WrapMode = reader.ReadInt32(); if (version[0] > 3 || (version[0] == 3 && version[1] >= 4)) //3.4 and up { m_Bounds = new AABB(reader); } if (version[0] >= 4)//4.0 and up { m_MuscleClipSize = reader.ReadUInt32(); m_MuscleClip = new ClipMuscleConstant(reader); } if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up { m_ClipBindingConstant = new AnimationClipBindingConstant(reader); } if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 3)) //2018.3 and up { var m_HasGenericRootTransform = reader.ReadBoolean(); var m_HasMotionFloatCurves = reader.ReadBoolean(); reader.AlignStream(); } int numEvents = reader.ReadInt32(); m_Events = new AnimationEvent[numEvents]; for (int i = 0; i < numEvents; i++) { m_Events[i] = new AnimationEvent(reader); } if (version[0] >= 2017) //2017 and up { reader.AlignStream(); } }
/// <summary> Initializes a new instance of the <see cref="Fade" /> class </summary> /// <param name="animationType"> The animation type that determines the behavior of this animation </param> public Fade(AnimationType animationType) { Reset(animationType); }
/// <summary> Initializes a new instance of the <see cref="Scale" /> class </summary> /// <param name="animationType"> The animation type that determines the behavior of this animation </param> public Scale(AnimationType animationType) { Reset(animationType); }
/// <summary> Initializes a new instance of the <see cref="Rotate" /> class </summary> /// <param name="animationType"> The animation type that determines the behavior of this animation </param> public Rotate(AnimationType animationType) { Reset(animationType); }
public void LoopAnimation(Animation animation) { IsAnimated = true; AnimationType = AnimationType.Loop; Animation = animation; }
public override void Update(AnimationType newAnimation, Color ledColor) { this.animationType = newAnimation; this.ledColor = ledColor; this.shouldUpdate = true; }
public void LoopAnimation(Animation animation, int loops) { AnimationType = AnimationType.LimitedLoop; }
/// <summary>Generates a new AnimatedSpriteCollection object from the data held in an asset sheet.</summary> /// <param name="assetSheet">An asset sheet that holds the data for textures.</param> /// <param name="type">The type of asset to get from the sheet. Hair, eyes, shoes, etc.</param> public AnimatedSpriteCollection getSpriteCollectionFromSheet(AssetSheet assetSheet, AnimationType type) { var left = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.left, type), assetSheet); var right = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.right, type), assetSheet); var up = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.up, type), assetSheet); var down = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.down, type), assetSheet); return(new AnimatedSpriteCollection(left, right, up, down, Direction.down)); }
public static float GetTotalTimeRemaining(AnimationType type = AnimationType.All) { return((from animation in Animations where type.HasFlag(animation.type) select animation.totalTimeRemaining) .Max()); }
/// <summary>Generate a Standard Character Animation from some asset sheets. (collection of textures to animations)</summary> /// <param name="body">The textures for the NPC's body.</param> /// <param name="eyes">The textures for the NPC's eyes.</param> /// <param name="hair">The textures for the NPC's hair.</param> /// <param name="shirt">The textures for the NPC's shirt.</param> /// <param name="pants">The textures for the NPC's pants.</param> /// <param name="shoes">The textures for the NPC's shoes.</param> /// <param name="accessories">The textures for the NPC's accessories.</param> /// <param name="animationType">The animation type to generate.</param> /// <param name="drawColors">The colors for the NPC's different assets.</param> public virtual StandardCharacterAnimation generateCharacterAnimation(AssetSheet body, AssetSheet eyes, AssetSheet hair, AssetSheet shirt, AssetSheet pants, AssetSheet shoes, List <AssetSheet> accessories, AnimationType animationType, StandardColorCollection drawColors = null) { AnimatedSpriteCollection bodySprite = this.getSpriteCollectionFromSheet(body, animationType); AnimatedSpriteCollection eyesSprite = this.getSpriteCollectionFromSheet(eyes, animationType); AnimatedSpriteCollection hairSprite = this.getSpriteCollectionFromSheet(hair, animationType); AnimatedSpriteCollection shirtSprite = this.getSpriteCollectionFromSheet(shirt, animationType); AnimatedSpriteCollection pantsSprite = this.getSpriteCollectionFromSheet(pants, animationType); AnimatedSpriteCollection shoesSprite = this.getSpriteCollectionFromSheet(shoes, animationType); List <AnimatedSpriteCollection> accessoryCollection = new List <AnimatedSpriteCollection>(); foreach (var v in accessories) { AnimatedSpriteCollection acc = this.getSpriteCollectionFromSheet(v, AnimationType.standing); accessoryCollection.Add(acc); } if (drawColors == null) { drawColors = new StandardColorCollection(); } return(new StandardCharacterAnimation(bodySprite, eyesSprite, hairSprite, shirtSprite, pantsSprite, shoesSprite, accessoryCollection, drawColors)); }
public void SetAnimation(AnimationType type) { this.type = type; }
public RPGAnimation(AnimationType t) : this(t, new TimeSpan(0, 0, 0, 0, 250)) { }
void SetAnimation(AnimationType animType) { _animation.CrossFade(animType.ToString()); }
public RPGAnimation(AnimationType t, TimeSpan duration) { this.AnimType = t; this.Duration = duration; Start = DateTime.Now; }
public override void ChangePosition(Vector2 destination, AnimationType animType = null) { this.animType = animType ?? AnimManager.FallDownItems; base.ChangePosition(destination, animType); }
public ZoomAnimation(float zoomFrom, float zoomTo, Time animationPeriod, AnimationType type, InterpolationMethod method) : base(zoomFrom, zoomTo, animationPeriod, type, method) { }
public static List <UnityEngine.AnimationClip> Import(string bundlePath, string savePath, string targetBundleName, AnimationType type, UnityEngine.SkinnedMeshRenderer[] skinnedMeshRenderers) { string animationNamePrefix = type == AnimationType.Eyes ? "ey_" : "mo_"; string materialAttributeName = type == AnimationType.Eyes ? "_MainTex_eye_ST" : "_MainTex_mouth_ST"; var attributeSet = type == AnimationType.Eyes ? _eyeAnimAttributes : _mouthAnimAttributes; var assetManager = new AssetsManager(); assetManager.LoadFiles(PhysicalFileSystem.Instance, bundlePath); var assetFile = assetManager.assetsFileList[0]; var animationClips = assetFile.Objects.OfType <AssetStudio.AnimationClip>() .Where(clip => clip.m_Name.StartsWith(animationNamePrefix)); var importedAssets = new List <UnityEngine.AnimationClip>(); foreach (var animationClip in animationClips) { var newClip = ProcessClip(animationClip, savePath, targetBundleName, materialAttributeName, attributeSet, skinnedMeshRenderers); importedAssets.Add(newClip); } return(importedAssets); }
IEnumerator LightAnimator() { int playingIndex = 0; nowPlaying = animationClips[playingIndex].type; LightStates = new bool[Light.Count]; while (isLoop) { //check what stat now it is animationClips[playingIndex].AnimationSetting.stateSelector(); switch (animationClips[playingIndex].m_animation.nowState) { case AnimationPrototype.animationState.start: animationClips[playingIndex].AnimationSetting.InitializeAnimation(ref LightStates); break; case AnimationPrototype.animationState.update: animationClips[playingIndex].m_animation.UpdateAnimation(ref LightStates); break; case AnimationPrototype.animationState.end: animationClips[playingIndex].m_animation.EndAnimation(ref LightStates); playingIndex += 1; if (playingIndex >= animationClips.Count) { playingIndex = 0; } nowPlaying = animationClips[playingIndex].type; break; } // for (int i = 0; i < Light.Count;i++) // { // if(LightStates[i] ^ isUseGlobalAntiLogic ) // { // Light[i].GetComponent<MeshRenderer>().enabled= LightStates[i] ^ isUseGlobalAntiLogic; // } // else{ // } // } Color[] listColor = new Color[Light.Count]; Color color1 = animationClips[playingIndex].color1; Color color2 = animationClips[playingIndex].color2; int max = animationClips[playingIndex].m_animation.max; int min = animationClips[playingIndex].m_animation.min; float center = animationClips[playingIndex].m_animation.center; for (int i = 0; i < Light.Count; i++) { //Debug.Log("min : " + min + " max : " + max + " i : " + i + " i-max : " + i_max + " i-min : " + i_min); if (LightStates[i] ^ isUseGlobalAntiLogic) { float index = i >= center ? i - center : center - i; float length = i >= center ? max - center: center - min; listColor[i] = Color.Lerp(color2, color1, index / length); } else { listColor[i] = color1; } Light[i].GetComponent <MeshRenderer>().material.SetColor("_Color", listColor[i]); } yield return(new WaitForSeconds(1 / frameRate)); } }
public void PlayAnim(AnimationType type, bool state, int index = 0, bool mustLive = true, bool force = false) { if (mustLive && !this.self.isLive) { return; } if (!this.self.isHero && !this.self.isVisibleInCamera) { return; } if (this.self.IsLockAnimState && !force) { return; } if (this.mecanim != null) { switch (type) { case AnimationType.Breath: this.curAnimState = AnimControllerState.Other; this.mecanim.Idle(state); break; case AnimationType.Move: if (!this.self.CanMoveAnim && state && this.self.isHero) { return; } this.curAnimState = AnimControllerState.Move; if (this.self.isMonster && this.self.teamType == 2 && this.firstTime && !state) { this.firstTime = false; } else { this.mecanim.Move(state); } break; case AnimationType.Damage: this.mecanim.HitUp(state); break; case AnimationType.Death: if (!this.self.isBuilding) { this.curAnimState = AnimControllerState.Death; this.ResetAnimState(); this.mecanim.Death(state); } break; case AnimationType.HitStun: this.mecanim.HitStun(state); break; case AnimationType.ComboAttack: this.curAnimState = AnimControllerState.Attack; if (state) { this.mecanim.ComboAttack(index); } else { this.mecanim.ComboAttack(0); } break; case AnimationType.Conjure: this.curAnimState = AnimControllerState.Skill; if (state) { this.mecanim.Conjure(index); } else { this.mecanim.Conjure(0); } break; case AnimationType.StandUp: this.curAnimState = AnimControllerState.Other; this.mecanim.StandUp(state); break; case AnimationType.Victory: this.curAnimState = AnimControllerState.Other; this.mecanim.Victory(state); break; case AnimationType.Failure: this.curAnimState = AnimControllerState.Other; this.mecanim.Failure(state); break; case AnimationType.BackHome: this.curAnimState = AnimControllerState.Other; this.mecanim.Home(state); break; case AnimationType.Sleep: this.curAnimState = AnimControllerState.Other; this.mecanim.Sleep(index); break; } } }
public UniAniAudioSource(List <UniAni> uniAniList_, AudioSource audioSource_, float volume_, float animeTime_, AnimationCurve curve_, AnimationType animationType_) : base(uniAniList_, animeTime_, curve_, animationType_) { audioSource = audioSource_; startVolume = audioSource.volume; endVolume = volume_; }