本文整理汇总了C#中UnityEngine.Animation类的典型用法代码示例。如果您正苦于以下问题:C# Animation类的具体用法?C# Animation怎么用?C# Animation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Animation类属于UnityEngine命名空间,在下文中一共展示了Animation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
protected override void Start()
{
completionTime = 6.9f;
initialRotation = transform.parent.rotation.eulerAngles;
aSource = GetComponent<AudioSource>();
discAnimations = transform.FindChild("mdl_chestLockDisc").gameObject.GetComponent<Animation>();
}
示例2: OnStart
/* SAT: KSP entry points */
public override void OnStart ( StartState state )
{
if (state == StartState.Editor)
{
print ("[SCANsat] start: in editor");
Events["editorExtend"].active = !string.IsNullOrEmpty(animationName);
} else
{
print ("[SCANsat] start: live");
}
if (animationName != null)
{
Animation[] a = part.FindModelAnimators (animationName);
if (a.Length == 0)
{
print ("[SCANsat] animation '" + animationName + "' not found");
} else
{
print ("[SCANsat] using animation #1 out of " + a.Length.ToString () + " animations named '" + animationName + "'");
anim = a [0];
// maybe use this later for advanced animation...
Transform modeltransform = part.transform.FindChild ("model");
foreach (Transform t in modeltransform.GetComponentsInChildren<Transform>())
{
//print("[SCANsat] transform " + t.name + ": " + t);
}
}
}
print ("[SCANsat] sensorType: " + sensorType.ToString () + " fov: " + fov.ToString () + " min_alt: " + min_alt.ToString () + " max_alt: " + max_alt.ToString () + " best_alt: " + best_alt.ToString () + " power: " + power.ToString ());
}
示例3: Awake
void Awake(){
if(type==_AniType.None) return;
unitCreep=gameObject.GetComponent<UnitCreep>();
if(type==_AniType.Legacy){
aniInstance=aniRootObj.GetComponent<Animation>();
if(aniInstance!=null){
InitAnimation();
unitCreep.SetAnimationComponent(this);
}
}
if(type==_AniType.Mecanim){
if(anim==null) anim=aniRootObj.GetComponent<Animator>();
if(anim!=null) unitCreep.SetAnimationComponent(this);
AnimatorOverrideController overrideController = new AnimatorOverrideController();
overrideController.runtimeAnimatorController = anim.runtimeAnimatorController;
//overrideController["Assigned Animation Clip Name In The Controller"] = New Clip To Be Assigned;
//overrideController["DummySpawn"] = clipSpawn!=null ? clipSpawn : null;
overrideController["DummyMove"] = clipMove!=null ? clipMove : null;
overrideController["DummyDestination"] = clipDestination!=null ? clipDestination : null;
overrideController["DummyDestroyed"] = clipDead!=null ? clipDead : null;
//if no spawn animation has been assigned, use move animation instead otherwise there will be an delay, bug maybe?
AnimationClip spawn = clipSpawn!=null ? clipSpawn : clipMove;
overrideController["DummySpawn"] = spawn!=null ? spawn : null;
anim.runtimeAnimatorController = overrideController;
}
}
示例4: AnimState
///////////////////////////////////////////////////////////////////////////////
// Functions
///////////////////////////////////////////////////////////////////////////////
/// <param name="_name"> 状态名,用于调试,同时作为当前状态所播放的动作名(也就是AnimationClip.name) </param>
public AnimState(string _name, Animation _anim, State _parent = null)
: base(_name, _parent)
{
anim = _anim;
exDebug.Assert(anim != null);
InitWrapMode(_name);
}
示例5: OnStart
public override void OnStart(PartModule.StartState state)
{
DragManager = part.gameObject.GetComponent<DragManager>();
if (DragManager == null) {
DragManager = part.gameObject.AddComponent<DragManager>();
DragManager.SetPart(part);
}
anim = part.FindModelAnimators(AnimationName)[0];
animState = anim[AnimationName];
animState.wrapMode = WrapMode.Clamp;
if (FixAnimLayers) {
int i = 0;
foreach (AnimationState s in anim)
s.layer = i++;
}
animState.normalizedSpeed = 0;
if (engaged) {
animState.normalizedTime = Drag / 100;
spoilerState = ModuleLandingGear.GearStates.DEPLOYED;
}
else {
animState.normalizedTime = 0;
spoilerState = ModuleLandingGear.GearStates.RETRACTED;
}
anim.Play(AnimationName);
}
示例6: AnimationWrapper
public AnimationWrapper(Animation anim, string statename, PlayDirection direction)
: this(direction)
{
this.animation = anim;
this.animationState = anim[statename];
this.stateName = statename;
}
示例7: Start
// ============================================================================================================
public void Start()
{
ani = GetComponent<Animation>();
chara = GetComponent<Chara2_Base>();
// init idle ani
if (string.IsNullOrEmpty(idleClip)) idleClip = null; // set to null for faster if() checks
if (idleClip != null)
{
ani[idleClip].speed = idlePlaySpeed;
ani[idleClip].wrapMode = WrapMode.Loop;
ani.Play(idleClip);
}
// sorted so that lower speedDetect is checked first
movementAnimations.Sort((a, b) => { return a.maxSpeedDetect.CompareTo(b.maxSpeedDetect); });
// init movement anis
for (int i = 0; i < movementAnimations.Count; i++)
{
if (!string.IsNullOrEmpty(movementAnimations[i].clipName))
{
ani[movementAnimations[i].clipName].speed = movementAnimations[i].playSpeed;
ani[movementAnimations[i].clipName].wrapMode = WrapMode.Loop;
}
else movementAnimations[i] = null; // set to null for faster if() checks
}
// init antics
_anticsOn = (UniRPGGlobal.Instance.state != UniRPGGlobal.State.InMainMenu);
anticsTimer = anticsWaitTimeMin;
}
示例8: Awake
void Awake()
{
controller = GetComponent<CharacterController>();
smoothCamera = GetComponentInChildren<SmoothCameraWithBumper>();
audioSource = GetComponentInChildren<AudioSource>();
anim = GetComponent<Animation>();
}
示例9: PrintAnimationStates
public static void PrintAnimationStates(Animation animation)
{
foreach (AnimationState state in animation)
{
Debug.Log (state.name + ": Layer: " + state.layer + ", WrapMode: " + state.wrapMode.ToString () + ", BlendMode: " + state.blendMode.ToString () + ", Enabled: " + state.enabled + ", Speed: " + state.speed + ", Length: " + state.length);
}
}
示例10: OnStart
public override void OnStart()
{
var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
if (currentGameObject != prevGameObject) {
animation = currentGameObject.GetComponent<Animation>();
prevGameObject = currentGameObject;
}
}
示例11: HasAnimation
private bool HasAnimation()
{
if (_animationComponent != null)
return true;
_animationComponent = GetComponent<Animation>();
return _animationComponent != null;
}
示例12: Initiate
private void Initiate() {
if (componentInitiated) return;
animator = GetComponent<Animator>();
animation = GetComponent<Animation>();
InitiateSolver();
componentInitiated = true;
}
示例13: Awake
void Awake() {
myTransform = transform;
anim = GetComponent<Animation>();
navMeshAgent = GetComponent<NavMeshAgent>();
if (navMeshAgent == null) {
Debug.LogWarning(string.Format("{0}: No NavMeshAgent found on {1}. Disabling {2}.", DialogueDebug.Prefix, name, this.GetType().Name));
enabled = false;
}
}
示例14: Awake
public void Awake()
{
playerController = GetComponent<Widget_Controller>();
controller = GetComponent<CharacterController>();
aSource = GetComponent<AudioSource>();
animationState = GetComponent<Widget_Animation>();
anim = GetComponent<Animation>();
bodyMesh = GameObject.Find("Body").GetComponent<SkinnedMeshRenderer>();
wheelMesh = GameObject.Find("Wheels").GetComponent<SkinnedMeshRenderer>();
}
示例15: Idle
public void Idle()
{
if (!useMecanim) {
if (thisAnimation == null) {
thisAnimation = GetComponent<Animation>();
thisAnimation[idleAnimationName].wrapMode = WrapMode.Loop;
}
thisAnimation.Play(idleAnimationName);
}
}