本文整理汇总了C#中UnityEngine.Animation.CrossFade方法的典型用法代码示例。如果您正苦于以下问题:C# Animation.CrossFade方法的具体用法?C# Animation.CrossFade怎么用?C# Animation.CrossFade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Animation
的用法示例。
在下文中一共展示了Animation.CrossFade方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RollTrack
private void RollTrack(Animation track, int defaultRollTime)
{
if (track != null)
{
track.CrossFade("10107_Trap01");
SetNextRoll(track, defaultRollTime);
}
}
示例2: LoopAnimation
private void LoopAnimation(string thisAnimation, Animation anim)
{
anim.wrapMode = WrapMode.Loop;
anim.CrossFade(thisAnimation);
anim[thisAnimation].time = Random.Range(0f, 3f);
}
示例3: Start
// Use this for initialization
void Start()
{
EnemyHealth = 10;
nextAction = Time.time;
an = GetComponent<Animation>();
an.CrossFade ("run");
}
示例4: Start
void Start()
{
smooth = 5.0f;
scaler = 25.0f;
walkingSpeed = 5.0f;
velocity = Vector3.zero;
anim = GetComponent<Animation> ();
anim.CrossFade ("soldierIdleRelaxed");
previousValidPos = transform.position;
}
示例5: MirrorCharacterAnimations
void MirrorCharacterAnimations()
{
if (mirrorCharacterAnim) {
animation = transform.Find("Model").GetComponent<Animation>();
if (animation != null) {
if (originalController == null) {
originalController = original.GetComponent<Character>().controller;
}
animation[originalController.animationPlaying].speed = originalController.animationSpeed;
animation.CrossFade(originalController.animationPlaying);
}
}
}
示例6: Start
public void Start()
{
string audioClipName = GetParameter(0);
string animationClipName = GetParameter(1);
finalClipName = GetParameter(2);
subject = GetSubject(3);
anim = (subject == null) ? null : subject.GetComponent<Animation>();
AudioClip audioClip = (!string.IsNullOrEmpty(audioClipName)) ? (DialogueManager.LoadAsset(audioClipName) as AudioClip) : null;
if ((subject == null) || (anim == null)) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: Voice({1}, {2}, {3}, {4}) command: No Animation component found on {3}.", new System.Object[] { DialogueDebug.Prefix, audioClipName, animationClipName, finalClipName, (subject != null) ? subject.name : GetParameter(2) }));
} else if (audioClip == null) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: Voice({1}, {2}, {3}, {4}) command: Clip is null.", new System.Object[] { DialogueDebug.Prefix, audioClipName, animationClipName, finalClipName, subject.name }));
} else if (string.IsNullOrEmpty(animationClipName)) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: Voice({1}, {2}, {3}, {4}) command: Animation name is blank.", new System.Object[] { DialogueDebug.Prefix, audioClipName, animationClipName, finalClipName, subject.name }));
} else {
if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: Voice({1}, {2}, {3}, {4})", new System.Object[] { DialogueDebug.Prefix, audioClipName, animationClipName, finalClipName, Tools.GetObjectName(subject) }));
audioSource = SequencerTools.GetAudioSource(subject);
if (audioSource == null) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: Voice() command: can't find or add AudioSource to {1}.", new System.Object[] { DialogueDebug.Prefix, subject.name }));
} else {
if (IsAudioMuted()) {
if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: Voice({1}, {2}, {3}, {4}): Audio is muted; not playing it.", new System.Object[] { DialogueDebug.Prefix, audioClipName, animationClipName, finalClipName, Tools.GetObjectName(subject) }));
} else {
//--- Was, prior to implementing pause: audioSource.PlayOneShot(audioClip);
audioSource.clip = audioClip;
audioSource.Play();
}
anim.CrossFade(animationClipName);
try {
stopTime = DialogueTime.time + Mathf.Max(0.1f, anim[animationClipName].length - 0.3f);
if (audioClip.length > anim[animationClipName].length) stopTime = DialogueTime.time + audioClip.length;
} catch (System.Exception) {
stopTime = 0;
}
}
}
}
示例7: Starta
// Use this for initialization
public void Starta(GameObject plane, GameObject swamps, float nodeSize)
{
fixedDeadCollider = false;
poi = Vector3.zero;
health = 100.0f;
seesPlayer = false;
seesDeadPeople = false;
hearsSomething = false;
disturbed = false;
reachGoal = GetComponent<ReachGoal> ();
wander = GetComponent<Wander> ();
standstill = GetComponent<StandStill> ();
patrol = GetComponent<Patrol> ();
gc = player.GetComponent<GoalControl> ();
reachGoal.plane = plane;
reachGoal.swamps = swamps;
reachGoal.nodeSize = nodeSize;
reachGoal.goalPos = poi;
reachGoal.Starta ();
wander.Starta ();
patrol.Starta ();
standstill.Starta ();
anim = GetComponent<Animation> ();
anim.CrossFade (idle);
walkingSpeed = 10.0f;
gunShot = this.GetComponents<AudioSource> ()[0];
lr = this.GetComponentInParent<LineRenderer> ();
seenTime = 0f;
// Debug.Log (transform.name);
}
示例8: SwitchSkin
public void SwitchSkin(GameObject skin)
{
Vector3 current_pos = player.transform.position;
Vector3 current_rot = player.transform.eulerAngles;
Vector3 current_scale = player.transform.localScale;
player = skin;
player.transform.position = current_pos;
player.transform.eulerAngles = current_rot;
player.transform.localScale = current_scale;
animations = player.GetComponent<Animation>();
animations.CrossFade(stateAnimation[animationState]);
ShouldSwitch = false;
}
示例9: QueueIdle
private IEnumerator QueueIdle(Animation source)
{
while (source.IsPlaying(_ClipName))
yield return new WaitForFixedUpdate();
source.CrossFade(AnimationResources.Idle);
}
示例10: Start
// Use this for initialization
public virtual void Start()
{
velocity = new Vector3 ();
acceleration = new Vector3 ();
accMagDefault = 50.0f;
speedMaxDefault = 20.0f;
walkingSpeed = 15.0f;
epsilon = 2.0f;
searchRadius = 100.0f;
rayDistDefault = 20.0f;
rayDist = rayDistDefault;
closeRayDistDefault = 7.0f;
closeRayDist = closeRayDistDefault;
charWidth = 5.0f;
smooth = 5.0f;
obstacleWeight = 3.0f;
charWeight = 1.0f;
accMag = accMagDefault;
speedMax = speedMaxDefault;
anim = GetComponent<Animation> ();
anim.CrossFade ("idle");
}
示例11: Start
void Start()
{
radius = 2.0f;
smooth = 5.0f;
scaler = 20.0f;
walkingSpeed = 5.0f;
velocity = Vector3.zero;
anim = GetComponent<Animation> ();
anim.CrossFade (idle);
previousValidPos = transform.position;
soldierLayer = 1 << (LayerMask.NameToLayer("Soldier"));
obstacleLayer = 1 << (LayerMask.NameToLayer("Obstacles"));
health = 20;
healthTex = new Texture2D(1, 1);
healthTex.SetPixel(0,0,Color.green);
healthTex.Apply();
}
示例12: Start
//methods
// Use this for initialization
public virtual void Start()
{
anim = GetComponent<Animation>();
velocity = new Vector3 ();
nextPosition = new Vector3 (); //position where char wants to move to next
acceleration = new Vector3 ();
targetAccel = new Vector3 ();
accMag = 50.0f;
maxRadsDelta = Mathf.Deg2Rad * 20.0f;
maxMagDelta = 100.0f;
maxSpeed = 20.0f;
behaviorWeight = 1.0f;
smooth = 5.0f;
walkingSpeed = 20.0f;
randomRad = 0.0f;
charWidth = 5.0f;
rayDist = 30.0f;
rayDistMax = rayDist;
originalMaxSpeed = maxSpeed;
rayDistClose = 5.0f;
anim.CrossFade ("idle");
count = 0;
}
示例13: metcrossfadetransitionanimation
public static int metcrossfadetransitionanimation(Transform varpcharacter, string varpdestinationanimname, float varptransitiontime, Transform varpcontroller = null, string varpstateanimationname = "", bool varpgokinematic = true, string varpnewanimname = "transition", Animation varpanimationsystem = null, SkinnedMeshRenderer varprenderer = null, clsurganimationstatesmanager varpstatesmanager = null)
{
if (varpcharacter == null)
{
return -1;
}
if (varptransitiontime == 0f)
{
return -2;
}
if (varpanimationsystem == null)
{
varpanimationsystem = varpcharacter.root.GetComponentInChildren<Animation>();
if (varpanimationsystem == null)
{
return -3;
}
varpanimationsystem.Stop();
}
if (varprenderer == null)
{
varprenderer = varpcharacter.root.GetComponentInChildren<SkinnedMeshRenderer>();
if (varprenderer == null)
{
return -4;
}
}
if (varpgokinematic)
{
clsurgutils.metgodriven(varpcharacter, true);
}
Vector3 localPosition = default(Vector3);
if (varpcontroller != null)
{
Vector3 position = varpcharacter.position;
varpcontroller.position = position;
varpcharacter.localPosition = localPosition;
}
AnimationClip animationClip = clsurgutils.metcreatetransitionanimation(varpcharacter, varpdestinationanimname, varptransitiontime, varpnewanimname, ref localPosition, varpstatesmanager, false);
if (animationClip != null)
{
varpanimationsystem.Stop();
AnimationState animationState = varpanimationsystem[varpdestinationanimname];
if (animationState != null && animationState.name != varpdestinationanimname)
{
varpanimationsystem.RemoveClip(varpnewanimname);
}
varpanimationsystem.AddClip(animationClip, varpnewanimname);
if (varpstateanimationname != string.Empty)
{
varpanimationsystem[varpnewanimname].wrapMode = WrapMode.Once;
varpanimationsystem.CrossFade(varpnewanimname);
varpanimationsystem.CrossFadeQueued(varpstateanimationname);
}
else
{
varpanimationsystem.CrossFade(varpnewanimname);
}
return 1;
}
Debug.LogError("Could not create transition");
return -5;
}
示例14: SpecialAttack
public void SpecialAttack(Animation _anim, GameObject _target, float _dmg)
{
_anim.CrossFade("Special");
_target.GetComponent<PlayerObject>().ApplyDamage(_dmg * 2);
useSpecial = false;
this.hasAttacked = true;
}
示例15: Attack
public void Attack(Animation _anim , GameObject _target , float _dmg)
{
_anim.CrossFade("Attack");
_target.GetComponent<PlayerObject>().ApplyDamage(_dmg);
this.hasAttacked = true;
}