本文整理汇总了C#中AnimationState类的典型用法代码示例。如果您正苦于以下问题:C# AnimationState类的具体用法?C# AnimationState怎么用?C# AnimationState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnimationState类属于命名空间,在下文中一共展示了AnimationState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
m_RootRef = gameObject;
m_TransformRef = new TransformCache(m_RootRef.transform);
m_ScaleFactor = (-m_RootRef.transform.localScale.x) / m_RootRef.transform.localScale.x;
m_State = AnimationState.Idle;
}
示例2: OnEnable
void OnEnable()
{
MyAnimation = MyTransform.GetComponent<Animation>();
MyAnimation.wrapMode = MyWarpMode;
MyAnimationState = MyAnimation[MyAnimation.animation.clip.name];
MyAnimationStateTime = 0.0f;
}
示例3: Animator
/// <summary>
/// Constructor that specifies a starting state for the animation
/// </summary>
/// <param name="startingState">Only Showing or Hiding should be used</param>
public Animator(UserControl animateControl, AnimationState startingState)
{
InitializeTimer();
animatedControl = animateControl;
state = startingState;
tmrAnimate.Start();
}
示例4: ChangeAnimationState
public void ChangeAnimationState(AnimationState _NextState, float _DelayTime, bool _RestoreTransform = false)
{
if (m_NextState != _NextState) {
m_NextState = _NextState;
StartCoroutine(PerformChangeAnimationState(_NextState, _DelayTime, _RestoreTransform));
}
}
示例5: Start
// Use this for initialization
void Start()
{
animation.Stop();
// By default loop all animations
animation.wrapMode = WrapMode.Loop;
// Jump animation are in a higher layer:
// Thus when a jump animation is playing it will automatically override all other animations until it is faded out.
// This simplifies the animation script because we can just keep playing the walk / run / idle cycle without having to spcial case jumping animations.
int jumpingLayer = 1;
AnimationState jump = animation["jump"];
jump.layer = jumpingLayer;
jump.speed *= jumpAnimationSpeedModifier;
jump.wrapMode = WrapMode.Once;
AnimationState jumpFall = animation["jumpFall"];
jumpFall.layer = jumpingLayer;
jumpFall.wrapMode = WrapMode.ClampForever;
AnimationState jumpLand = animation["jumpLand"];
jumpLand.layer = jumpingLayer;
jumpLand.speed *= jumpLandAnimationSpeedModifier;
jumpLand.wrapMode = WrapMode.Once;
//AnimationState buttStomp = animation["buttStomp"];
run = animation["run"];
run.speed *= runAnimationSpeedModifier;
AnimationState walk = animation["walk"];
walk.speed *= walkAnimationSpeedModifier;
}
示例6: Update
public virtual void Update(GameTime gameTime)
{
//_Sprite.Update(gameTime);
if (_AnimationState == AnimationState.Waiting)
{
if (_AnimationDelayCount >= _AnimationDelayInterval)
PreAnimation();
}
else if (_AnimationState == AnimationState.Animate)
{
StartSiblingAnimations(FireTime.AtStart);
if (_AnimationDelayCount < _AnimationDelayInterval)
_AnimationDelayCount += gameTime.ElapsedGameTime.Milliseconds;
else
{
if (_AnimationCount < _AnimationInterval)
{
_AnimationCount = MathHelper.Clamp(_AnimationCount + gameTime.ElapsedGameTime.Milliseconds, 0, _AnimationInterval);
AnimationLogic();
}
else
{
PostAnimation();
_AnimationState = AnimationState.End;
StartSiblingAnimations(FireTime.AtEnd);
}
}
}
}
示例7: CrossfadeAnimation
//
public void CrossfadeAnimation(AnimationState state, float fadeTime)
{
// ** This function is exactly like the Unity Animation.Crossfade() method
//
if (currentState == state)
return;
animationFadeTime = fadeTime;
for (int i = 0; i < fadingStates.Count; i++) {
if (state.name == fadingStates[i].name) {
fadingStates.RemoveAt (i);
if (currentState != null)
fadingStates.Add (currentState);
currentState = state;
return;
}
}
//
if (currentState != null)
fadingStates.Add (currentState);
//
currentState = state;
currentState.weight = 0;
currentState.time = currentStateTime = 0;
currentState.enabled = true;
//
}
示例8: Update
void Update()
{
if (Input.GetButton("Fire3"))
{
animationState = AnimationState.Falling;
}
switch (animationState)
{
case AnimationState.NotAnimated:
break;
case AnimationState.Falling:
FallDown();
break;
case AnimationState.LayingDown:
float vertical = CrossPlatformInputManager.GetAxis("Vertical");
if (vertical != 0)
{
animationState = AnimationState.GettingUp;
}
break;
case AnimationState.GettingUp:
GetUp();
break;
default:
break;
}
}
示例9: OnStateAnimationChange
public void OnStateAnimationChange(AnimationState previousState, AnimationState actualState)
{
bool change = false;
switch (actualState) {
case AnimationState.WALK:
case AnimationState.CHASE:
case AnimationState.RUN_AWAY:
if (settedFX) break;
settedFX = true;
change = true;
break;
default:
if (!settedFX) break;
settedFX = false;
change = true;
break;
}
if (change) {
foreach (ParticleSystem system in walkingFX.GetComponentsInChildren<ParticleSystem>()) {
ParticleSystem.EmissionModule emission = system.emission;
emission.enabled = settedFX;
}
}
}
示例10: Start
// Use this for initialization
void Start()
{
mOctopusAnim = GetComponent<Animator>();
mOctopusAnim.SetFloat(mBlendTree, 1.0f);
mRandomRange = Random.Range(minAttackTime, maxAttackTime);
mAnimState = AnimationState.Idle;
}
示例11: Update
// Update is called once per frame
void Update()
{
if (Input.GetAxis("Horizontal")>0)
{
animationState=AnimationState.walkRight;
currentIdleTime=0.0f;
startIdleTime=true;
}
else if (Input.GetAxis("Horizontal")<0)
{
animationState=AnimationState.walkLeft;
currentIdleTime=0.0f;
startIdleTime=true;
}
else if (Input.GetAxis("Vertical")>0)
{
animationState=AnimationState.walkBack;
currentIdleTime=0.0f;
startIdleTime=true;
}
else if (Input.GetAxis("Vertical")<0)
{
animationState=AnimationState.walkFront;
currentIdleTime=0.0f;
startIdleTime=true;
}
if (startIdleTime)
{
UpdateToIdleAnimations();
}
UpdateAnimation();
}
示例12: Initialise
protected void Initialise()
{
// The Animation Controller feeds on AnimationStates. You've got to assign your animations to variables so that you can call them from the controller
//
GetComponent<Animation>()["Attack1"].speed = 2.0f;
GetComponent<Animation>()["Attack2"].speed = 2.0f;
//
//
animationAttack1Anticipation = GetComponent<Animation>()["Attack1Anticipation"];
animationAttack1 = GetComponent<Animation>()["Attack1"];
//
animationAttack2Anticipation = GetComponent<Animation>()["Attack2Anticipation"];
animationAttack2 = GetComponent<Animation>()["Attack2"];
animationAttack3 = GetComponent<Animation>()["WhirlwindAttack"];
//
animationWhirlwind = GetComponent<Animation>()["Whirlwind"];
animationIdle = GetComponent<Animation>()["Idle"];
animationIdle.speed = 0.4f;
animationRespawn = GetComponent<Animation>()["Resurection"];
animationRespawn.speed = 0.8f;
animationAttack3.speed = 0.8f;
//
leftSwipe.SetTime (0.0f, 0, 1);
rightSwipe.SetTime (0.0f, 0, 1);
//
}
示例13: Start
// Use this for initialization
void Start()
{
lastPosition = transform.position;
walk = animation["walk"];
walk.enabled = true;
walk.weight = 0;
}
示例14: Awake
// Run as the scene is initializing
void Awake()
{
player = GameObject.FindWithTag("Player");
playerStart = GameObject.Find ("PlayerStart");
door = GameObject.FindWithTag("BedroomDoor");
cinematic = player.animation["Beginning_Cinematic"];
}
示例15: Start
// Use this for initialization
void Start () {
lat = animation[lateralClip.name];
vert = animation[verticalClip.name];
lat.layer = 1;
vert.layer = 2;
lat.speed = 0;
vert.speed = 0;
lat.blendMode = AnimationBlendMode.Blend;
vert.blendMode = AnimationBlendMode.Additive;
lat.enabled = true;
vert.enabled = true;
animation.Play(lat.name);
animation.Play(vert.name);
// we have to sample the frames to determine the min and max extent in each direction
lat.time = 0;
vert.time = 0;
animation.Sample();
minOffset = endpoint.position;
lat.normalizedTime = 1;
vert.normalizedTime = 1;
animation.Sample();
maxOffset = endpoint.position;
vertMin = minOffset.y;
minOffset.y = startpoint.position.y;
float maxY = maxOffset.y;
maxOffset.y = startpoint.position.y;
latMin = Vector3.Distance(startpoint.position, minOffset);
// float maxRange = Vector3.Distance(startpoint.position, maxOffset);
latScale = 1.0f/(Vector3.Distance(minOffset, maxOffset)); // so time = scale * (range-min);
vertScale = 1.0f/(maxY - vertMin);
}