static public int RemoveClip(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(string))) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.RemoveClip(a1); return(0); } else if (matchType(l, argc, 2, typeof(UnityEngine.AnimationClip))) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); UnityEngine.AnimationClip a1; checkType(l, 2, out a1); self.RemoveClip(a1); return(0); } return(error(l, "No matched override function to call")); } catch (Exception e) { return(error(l, e)); } }
static public int CrossFadeQueued(IntPtr l) { try{ int argc = LuaDLL.lua_gettop(l); if (argc == 5) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); UnityEngine.QueueMode a3; checkEnum(l, 4, out a3); UnityEngine.PlayMode a4; checkEnum(l, 5, out a4); UnityEngine.AnimationState ret = self.CrossFadeQueued(a1, a2, a3, a4); pushValue(l, ret); return(1); } else if (argc == 4) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); UnityEngine.QueueMode a3; checkEnum(l, 4, out a3); UnityEngine.AnimationState ret = self.CrossFadeQueued(a1, a2, a3); pushValue(l, ret); return(1); } else if (argc == 3) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); UnityEngine.AnimationState ret = self.CrossFadeQueued(a1, a2); pushValue(l, ret); return(1); } else if (argc == 2) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); UnityEngine.AnimationState ret = self.CrossFadeQueued(a1); pushValue(l, ret); return(1); } LuaDLL.luaL_error(l, "No matched override function to call"); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int constructor(IntPtr l) { UnityEngine.Animation o; o = new UnityEngine.Animation(); pushObject(l, o); return(1); }
static public void FastSetter(this UnityEngine.Animation o, string propertyName, object value) { switch (propertyName) { case "clip": o.clip = (UnityEngine.AnimationClip)value; return; case "playAutomatically": o.playAutomatically = (System.Boolean)value; return; case "wrapMode": o.wrapMode = (UnityEngine.WrapMode)value; return; case "animatePhysics": o.animatePhysics = (System.Boolean)value; return; case "cullingType": o.cullingType = (UnityEngine.AnimationCullingType)value; return; case "localBounds": o.localBounds = (UnityEngine.Bounds)value; return; case "tag": o.tag = (System.String)value; return; case "enabled": o.enabled = (bool)value; return; } LBoot.LogUtil.Error("UnityEngine.Animation no Setter Found : " + propertyName); }
static public int Stop(IntPtr l) { try{ int argc = LuaDLL.lua_gettop(l); if (argc == 1) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Stop(); return(0); } else if (argc == 2) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.Stop(a1); return(0); } LuaDLL.luaL_error(l, "No matched override function to call"); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int Rewind(IntPtr l) { try{ if (matchType(l, 2, typeof(string))) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.Rewind(a1); return(0); } else if (matchType(l, 2)) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Rewind(); return(0); } LuaDLL.luaL_error(l, "No matched override function to call"); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
protected override void Start() { completionTime = 6.9f; initialRotation = transform.parent.rotation.eulerAngles; aSource = GetComponent<AudioSource>(); discAnimations = transform.FindChild("mdl_chestLockDisc").gameObject.GetComponent<Animation>(); }
/////////////////////////////////////////////////////////////////////////////// // 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); }
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); }
// ============================================================================================================ 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; }
public AnimationWrapper(Animation anim, string statename, PlayDirection direction) : this(direction) { this.animation = anim; this.animationState = anim[statename]; this.stateName = statename; }
void Awake() { controller = GetComponent<CharacterController>(); smoothCamera = GetComponentInChildren<SmoothCameraWithBumper>(); audioSource = GetComponentInChildren<AudioSource>(); anim = GetComponent<Animation>(); }
public override void OnStart(PartModule.StartState state) { Actions["ActivateReceiverAction"].guiName = Events["ActivateReceiver"].guiName = String.Format("Activate Receiver"); Actions["DisableReceiverAction"].guiName = Events["DisableReceiver"].guiName = String.Format("Disable Receiver"); Actions["ToggleReceiverAction"].guiName = String.Format("Toggle Receiver"); base.OnStart (state); if (state == StartState.Editor) { return; } this.part.force_activate(); anim = part.FindModelAnimators (animName).FirstOrDefault (); if (anim != null) { anim [animName].layer = 1; if (connectedsatsf > 0 || connectedrelaysf > 0) { anim [animName].normalizedTime = 1f; anim [animName].speed = -1f; } else { anim [animName].normalizedTime = 0f; anim [animName].speed = 1f; } anim.Play (); } if (mycount == -1) { mycount = dishcount; dishcount++; } }
public void Awake() { #if !UNITY_EDITOR try { #endif animation = GetComponent <UnityEngine.Animation>(); index = animations.Count; animations.Add(this); foreach (UnityEngine.AnimationState state in animation) { OriginalAnimations.Add(state.name); } #if !UNITY_EDITOR } catch (Exception ex) { Logger.Error(ex.ToString()); } #endif }
static public int Rewind(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 1) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Rewind(); pushValue(l, true); return(1); } else if (argc == 2) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.Rewind(a1); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
/* 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 ()); }
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; } }
static void Animation_isPlaying(JSVCall vc) { UnityEngine.Animation _this = (UnityEngine.Animation)vc.csObj; var result = _this.isPlaying; JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result)); }
/// <summary> /// Plays a given animation. /// </summary> /// <param name="name">The name of the animation to play.</param> public void Play(string name) { // Validate that we have an animation if (!_animation) { _animation = animation; if (!_animation) { Debug.LogWarning("No valid animation attached to object.", this); return; } } // Get and validate the animation state var state = animation[name]; if (!state) { Debug.LogWarning(string.Format("No animation state named '{0}' found.", name), this); return; } _elapsedTime = 0f; _currentState = state; _currentState.normalizedTime = 0; _currentState.enabled = true; _currentState.weight = 1; _isPlaying = true; _callback0 = null; _callback1 = null; }
public override void OnStart(StartState state) { base.OnStart(state); anim = this.part.FindModelAnimators(animationName)[0]; prevTemplateName = CurrentTemplateName; }
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); } }
static void Animation_Item_String(JSVCall vc) { System.String arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg); UnityEngine.Animation _this = (UnityEngine.Animation)vc.csObj; var result = _this[arg0]; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); }
public override void OnStart() { var currentGameObject = GetDefaultGameObject(targetGameObject.Value); if (currentGameObject != prevGameObject) { animation = currentGameObject.GetComponent<Animation>(); prevGameObject = currentGameObject; } }
static public int set_wrapMode(IntPtr l) { UnityEngine.Animation o = (UnityEngine.Animation)checkSelf(l); UnityEngine.WrapMode v; checkEnum(l, 2, out v); o.wrapMode = v; return(0); }
private bool HasAnimation() { if (_animationComponent != null) return true; _animationComponent = GetComponent<Animation>(); return _animationComponent != null; }
/// <summary> /// Setup /// </summary> protected override void Awake() { base.Awake(); _button = GetComponent <Button>(); _button.onClick.AddListener(Unlock); _animation = GetComponent <UnityEngine.Animation>(); }
public AnimationControl(GameObject gameObject, string characterName) { m_AnimationClip = new AnimationClipCtrl(characterName); m_Animation = gameObject.AddComponent <UnityEngine.Animation>(); Init(); }
private UnityAnimation GetOrLookUpUnityAnimationComponent() { if (_animation == null) { _animation = gameObject.GetComponent <UnityAnimation>(); } return(_animation); }
static public int set_clip(IntPtr l) { UnityEngine.Animation o = (UnityEngine.Animation)checkSelf(l); UnityEngine.AnimationClip v; checkType(l, 2, out v); o.clip = v; return(0); }
static public int set_localBounds(IntPtr l) { UnityEngine.Animation o = (UnityEngine.Animation)checkSelf(l); UnityEngine.Bounds v; checkType(l, 2, out v); o.localBounds = v; return(0); }
static public int set_cullingType(IntPtr l) { UnityEngine.Animation o = (UnityEngine.Animation)checkSelf(l); UnityEngine.AnimationCullingType v; checkEnum(l, 2, out v); o.cullingType = v; return(0); }
public void PlayAnimation(Animation animation) { if (_animation == null) { _animation = GetComponentInChildren <UnityEngine.Animation>(); } _animation.Play(Enum.GetName(typeof(Animation), animation).ToLower()); }
public static int obj_hash(long nIntPtr) { UnityEngine.Animation obj = FCGetObj.GetObj <UnityEngine.Animation>(nIntPtr); if (obj != null) { return(obj.GetHashCode()); } return(0); }
static public void FastSetter(this UnityEngine.Animation o, string propertyName, UnityEngine.AnimationClip value) { switch (propertyName) { case "clip": o.clip = value; return; } LBoot.LogUtil.Error("UnityEngine.Animation no Setter Found : " + propertyName); }
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; } }
static public int set_animatePhysics(IntPtr l) { UnityEngine.Animation o = (UnityEngine.Animation)checkSelf(l); bool v; checkType(l, 2, out v); o.animatePhysics = v; return(0); }
static public int set_playAutomatically(IntPtr l) { UnityEngine.Animation o = (UnityEngine.Animation)checkSelf(l); bool v; checkType(l, 2, out v); o.playAutomatically = v; return(0); }
private void Initiate() { if (componentInitiated) return; animator = GetComponent<Animator>(); animation = GetComponent<Animation>(); InitiateSolver(); componentInitiated = true; }
/// <summary> /// Read the data into the specified value. /// </summary> /// <param name="value">Value.</param> /// <param name="reader">Reader.</param> public override void ReadInto(object value, ISaveGameReader reader) { UnityEngine.Animation animation = (UnityEngine.Animation)value; foreach (string property in reader.Properties) { switch (property) { case "clip": if (animation.clip == null) { animation.clip = reader.ReadProperty <UnityEngine.AnimationClip> (); } else { reader.ReadIntoProperty <UnityEngine.AnimationClip> (animation.clip); } break; case "playAutomatically": animation.playAutomatically = reader.ReadProperty <System.Boolean> (); break; case "wrapMode": animation.wrapMode = reader.ReadProperty <UnityEngine.WrapMode> (); break; case "animatePhysics": animation.animatePhysics = reader.ReadProperty <System.Boolean> (); break; case "cullingType": animation.cullingType = reader.ReadProperty <UnityEngine.AnimationCullingType> (); break; case "localBounds": animation.localBounds = reader.ReadProperty <UnityEngine.Bounds> (); break; case "enabled": animation.enabled = reader.ReadProperty <System.Boolean> (); break; case "tag": animation.tag = reader.ReadProperty <System.String> (); break; case "name": animation.name = reader.ReadProperty <System.String> (); break; case "hideFlags": animation.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> (); break; } } }
public static AnimationSequence LoadAnimationsFromRig(string name, UnityEngine.Animation animationComponent) { AnimationSequence result = new AnimationSequence(name); foreach (AnimationState animationState in animationComponent) { string[] splitName = animationState.clip.name.Split(':'); if (splitName.Length == 0) { throw new Exception("AnimationState on " + animationComponent.gameObject.name + " does not follow the naming convention. (ex. 'Walk:Default:Loop')"); } if (splitName[0] == name) { if (splitName[2] == "Start") { result.AddFirstListing ( new AnimationSequence.Listing ( animationState.clip, new AnimationLoopCount(1) ) ); } else if (splitName[2] == "End") { result.AddLastListing ( new AnimationSequence.Listing ( animationState.clip, new AnimationLoopCount(1) ) ); } else { result.AddListing ( new AnimationSequence.Listing ( animationState.clip, new AnimationLoopCount(1) ) ); } } } if (result == null) { throw new Exception("Unable to find animation (" + name + ") on rig"); } return(result); }
public AMPlugAnimation(Animation aAnim, string clipName, WrapMode aWrap, bool aFadeIn, float aFadeInTime) : base(null, false) { ignoreAccessor = true; anim = aAnim; animState = anim[clipName]; wrap = aWrap; fadeIn = aFadeIn; fadeInTime = aFadeInTime; }
public override void OnStart(StartState state) { scienceConverter = this.part.FindModuleImplementing<WBIScienceConverter>(); scienceConverter.SetGuiVisible(false); base.OnStart(state); if (string.IsNullOrEmpty(animationName)) return; anim = this.part.FindModelAnimators(animationName)[0]; }
void Awake() { _button = GetComponent <Button>(); _button.onClick.AddListener(Unlock); _animation = GetComponent <UnityEngine.Animation>(); _localisationBase = GetGameItemsManager().TypeName; _failedUnlockAttempts = GameManager.Instance.Player.GetSettingInt(_localisationBase + ".FailedUnlockAttempts", 0); }
public override void OnStart(PartModule.StartState state) { anim = part.FindModelAnimators(clipName)[0]; anim[clipName].wrapMode = WrapMode.ClampForever; //anim.stop() will cause the animation to not update when manually updating state.time //Stop anim without calling stop() anim[clipName].speed = 0; //We negate speed on keypress. Ensure playing forward on first keypress speed *= -1; }
/// <summary> /// Animationの中に含まれるAnimationの名前の一覧を取得する。 /// </summary> /// <param name="animation"></param> /// <returns></returns> public static List <string> GetAnimationNameList(this Original.Animation animation) { var list = new List <string>(); foreach (Original.AnimationState state in animation) { list.Add(state.name); } return(list); }
public void Idle() { if (!useMecanim) { if (thisAnimation == null) { thisAnimation = GetComponent<Animation>(); thisAnimation[idleAnimationName].wrapMode = WrapMode.Loop; } thisAnimation.Play(idleAnimationName); } }
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>(); }
public override void Awake() { base.Awake(); mCAMR = Camera.main; am = GetComponent<Animation>(); fovDefault = (uint)Camera.main.fieldOfView; //var tempClips = new List<string>(); //foreach (AnimationState elem in am) { // tempClips.Add(elem.name); // elem.speed = (rate/elem.length)*1.5f; //} animNames = tempClips.toArray(typeof(string)); }
protected override void Awake() { base.Awake(); // references myAnimation = animation; CurrentStage = 1; MyHealth.HealthUpdateEvent += OnHit; }
static public int AddClip(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 3) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); UnityEngine.AnimationClip a1; checkType(l, 2, out a1); System.String a2; checkType(l, 3, out a2); self.AddClip(a1, a2); pushValue(l, true); return(1); } else if (argc == 5) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); UnityEngine.AnimationClip a1; checkType(l, 2, out a1); System.String a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); self.AddClip(a1, a2, a3, a4); pushValue(l, true); return(1); } else if (argc == 6) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); UnityEngine.AnimationClip a1; checkType(l, 2, out a1); System.String a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); System.Boolean a5; checkType(l, 6, out a5); self.AddClip(a1, a2, a3, a4, a5); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
internal Transform tr; // likely not storing references to all the internal components #endregion Fields #region Methods internal void Awake() { tr = gameObject.GetComponent<Transform>(); cl = gameObject.GetComponent<Collider>(); rb = gameObject.GetComponent<Rigidbody>(); am = gameObject.GetComponent<Animation>(); au = gameObject.GetComponent<AudioSource>(); cm = gameObject.GetComponent<Camera>(); rn = gameObject.GetComponent<Renderer>(); pl = GameObject.FindGameObjectWithTag("Player"); }
static public int get_cullingType(IntPtr l) { try { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); pushEnum(l, (int)self.cullingType); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_localBounds(IntPtr l) { try { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); pushValue(l, self.localBounds); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int Sample(IntPtr l) { try { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Sample(); return(0); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.Animation o; o=new UnityEngine.Animation(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
public void Start() { _Animation = GetComponent<Animation>(); LoadStartupClips(); ResetClipTrackers(); #if !UNITY_EDITOR if (BakeMode != BakeOption.NONE) { Debug.LogError("[AnimationTransformBinder] Bake option not compatible with build"); } #endif }
// Finds the first Animator/Animation up the hierarchy private void FindAnimatorRecursive(Transform t, bool findInChildren) { if (isAnimated) return; animator = t.GetComponent<Animator>(); animation = t.GetComponent<Animation>(); if (isAnimated) return; if (animator == null && findInChildren) animator = t.GetComponentInChildren<Animator>(); if (animation == null && findInChildren) animation = t.GetComponentInChildren<Animation>(); if (!isAnimated && t.parent != null) FindAnimatorRecursive(t.parent, false); }
void OnGUI() { obj = (Animation)EditorGUILayout.ObjectField("Animation Object", obj, typeof(Animation), true); if (obj) { string s = ""; foreach (AnimationState state in obj) s += state.name + "\n"; scroll = EditorGUILayout.BeginScrollView(scroll); EditorGUILayout.TextArea(s); EditorGUILayout.EndScrollView(); } }
void Awake() { // Create a layer mask for the Shootable layer. shootableMask = LayerMask.GetMask ("Shootable"); // Set up the references. gunParticles = GetComponent<ParticleSystem> (); gunLine = GetComponent <LineRenderer> (); gunAudio = GetComponent<AudioSource> (); gunLight = GetComponent<Light> (); anim = GetComponent<Animation> (); //faceLight = GetComponentInChildren<Light> (); }
public string name; // 名字 public virtual void setGameObject(GameObject go) { gameObject = go; transform = gameObject.transform; #if UNITY_5 animation = gameObject.GetComponent<Animation>(); #elif UNITY_4_6 || UNITY_4_5 animation = gameObject.animation; #endif name = gameObject.name; Awake(); Start(); }