本文整理汇总了C#中AnimationType类的典型用法代码示例。如果您正苦于以下问题:C# AnimationType类的具体用法?C# AnimationType怎么用?C# AnimationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnimationType类属于命名空间,在下文中一共展示了AnimationType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attack
/// <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 + ".");
}
}
示例2: Animation
public Animation(EpicModel epicModel, AnimationType animationType)
{
_epicModel = epicModel;
AnimationType = animationType;
_keyframes = new List<Keyframe>(10);
_ignoredModelParts = new List<ModelPart>();
}
示例3: CreateAnimation
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;
}
示例4: CreateEmpyAnimation
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;
}
示例5: Create
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;
}
}
示例6: AnimatedGraphics
/// <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();
}
示例7: SpellObject
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;
}
示例8: PlayAnimation
//애니메이션을 재생합니다.
public void PlayAnimation(AnimationType anim) {
m_current = anim;
//초밥 종류에 따라서 애니메이션을 지정합니다.
string animName = m_sushiType.ToString() + "_" + m_current.ToString();
m_animation.Play(animName);
}
示例9: GetContinuumAnimation
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;
}
示例10: StartAnimation
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;
}
}
示例11: CreateGameObject
/// <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;
}
示例12: Create
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);
}
}
}
示例13: Animate
/// <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");
}
}
示例14: Settings
public Settings (bool automaticChange, bool onlyFavorites, bool randomOrder, double changeInterval, AnimationType animationType)
{
AutomaticChange = automaticChange;
OnlyFavorites = onlyFavorites;
RandomOrder = randomOrder;
ChangeInterval = changeInterval;
AnimationType = animationType;
}
示例15: Setup
public virtual void Setup(AnimationType animType)
{
_rectTransform = GetComponent<RectTransform>();
_canvas = GetComponent<Canvas>();
_animationType = animType;
gameObject.SetActive(false);
}