Inheritance: Behaviour, IEnumerable
コード例 #1
0
 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));
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
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);
    }
コード例 #5
0
 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);
     }
 }
コード例 #6
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);
     }
 }
コード例 #7
0
 protected override void Start()
 {
     completionTime = 6.9f;
     initialRotation = transform.parent.rotation.eulerAngles;
     aSource = GetComponent<AudioSource>();
     discAnimations = transform.FindChild("mdl_chestLockDisc").gameObject.GetComponent<Animation>();
 }
コード例 #8
0
ファイル: AnimState.cs プロジェクト: knoxHuang/ex2d-dev
 ///////////////////////////////////////////////////////////////////////////////
 // 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);
 }
コード例 #9
0
        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);
        }
コード例 #10
0
ファイル: Chara2_AnimCtrl.cs プロジェクト: fvivaudo/Rush01
		// ============================================================================================================

		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;
		}
コード例 #11
0
 public AnimationWrapper(Animation anim, string statename, PlayDirection direction)
     : this(direction)
 {
     this.animation = anim;
     this.animationState = anim[statename];
     this.stateName = statename;
 }
コード例 #12
0
 void Awake()
 {
     controller = GetComponent<CharacterController>();
     smoothCamera = GetComponentInChildren<SmoothCameraWithBumper>();
     audioSource = GetComponentInChildren<AudioSource>();
     anim = GetComponent<Animation>();
 }
コード例 #13
0
        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++;
            }
        }
コード例 #14
0
    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
    }
コード例 #15
0
 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));
     }
 }
コード例 #16
0
ファイル: SCANsat.cs プロジェクト: BobPalmer/SCANsat
		/* 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 ());
        }
コード例 #17
0
		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;
			}
		}
コード例 #18
0
    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));
    }
コード例 #19
0
        /// <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;
        }
コード例 #20
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            anim = this.part.FindModelAnimators(animationName)[0];

            prevTemplateName = CurrentTemplateName;
        }
コード例 #21
0
 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);
     }
 }
コード例 #22
0
    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);
    }
コード例 #23
0
ファイル: Blend.cs プロジェクト: wishes2018/UnityGame
 public override void OnStart()
 {
     var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
     if (currentGameObject != prevGameObject) {
         animation = currentGameObject.GetComponent<Animation>();
         prevGameObject = currentGameObject;
     }
 }
コード例 #24
0
 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);
 }
コード例 #25
0
ファイル: MushroomCave.cs プロジェクト: vosechu/KerbTown
        private bool HasAnimation()
        {
            if (_animationComponent != null)
                return true;

            _animationComponent = GetComponent<Animation>();
            return _animationComponent != null;
        }
コード例 #26
0
        /// <summary>
        /// Setup
        /// </summary>
        protected override void Awake()
        {
            base.Awake();
            _button = GetComponent <Button>();
            _button.onClick.AddListener(Unlock);

            _animation = GetComponent <UnityEngine.Animation>();
        }
コード例 #27
0
        public AnimationControl(GameObject gameObject, string characterName)
        {
            m_AnimationClip = new AnimationClipCtrl(characterName);

            m_Animation = gameObject.AddComponent <UnityEngine.Animation>();

            Init();
        }
コード例 #28
0
 private UnityAnimation GetOrLookUpUnityAnimationComponent()
 {
     if (_animation == null)
     {
         _animation = gameObject.GetComponent <UnityAnimation>();
     }
     return(_animation);
 }
コード例 #29
0
 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);
 }
コード例 #30
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);
 }
コード例 #31
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);
 }
コード例 #32
0
 public void PlayAnimation(Animation animation)
 {
     if (_animation == null)
     {
         _animation = GetComponentInChildren <UnityEngine.Animation>();
     }
     _animation.Play(Enum.GetName(typeof(Animation), animation).ToLower());
 }
コード例 #33
0
 public static int  obj_hash(long nIntPtr)
 {
     UnityEngine.Animation obj = FCGetObj.GetObj <UnityEngine.Animation>(nIntPtr);
     if (obj != null)
     {
         return(obj.GetHashCode());
     }
     return(0);
 }
コード例 #34
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);
 }
コード例 #35
0
		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;
			}
		}
コード例 #36
0
    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);
    }
コード例 #37
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);
    }
コード例 #38
0
ファイル: SolverManager.cs プロジェクト: fgeraci/CS195-Core
		private void Initiate() {
			if (componentInitiated) return;

			animator = GetComponent<Animator>();
			animation = GetComponent<Animation>();

			InitiateSolver();
			componentInitiated = true;
		}
コード例 #39
0
        /// <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;
                }
            }
        }
コード例 #40
0
        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);
        }
コード例 #41
0
ファイル: AMPlugValue.cs プロジェクト: igrir/MateAnimator
 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;
 }
コード例 #42
0
        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];
        }
コード例 #43
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);
        }
コード例 #44
0
ファイル: AnimationModule.cs プロジェクト: gamers2000/kspcss
 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;
 }
コード例 #45
0
        /// <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);
        }
コード例 #46
0
 public void Idle()
 {
     if (!useMecanim) {
         if (thisAnimation == null) {
             thisAnimation = GetComponent<Animation>();
             thisAnimation[idleAnimationName].wrapMode = WrapMode.Loop;
         }
         thisAnimation.Play(idleAnimationName);
     }
 }
コード例 #47
0
ファイル: Widget_Status.cs プロジェクト: jhessin/Widgets
 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>();
 }
コード例 #48
0
ファイル: Gun.cs プロジェクト: evan-erdos/PathwaysEngine
 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));
 }
コード例 #49
0
ファイル: Boss.cs プロジェクト: syeager/Space-CUBEs
        protected override void Awake()
        {
            base.Awake();

            // references
            myAnimation = animation;

            CurrentStage = 1;
            MyHealth.HealthUpdateEvent += OnHit;
        }
コード例 #50
0
 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));
     }
 }
コード例 #51
0
ファイル: Script.cs プロジェクト: evan-erdos/pathways
        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");
        }
コード例 #52
0
 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));
     }
 }
コード例 #53
0
 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));
     }
 }
コード例 #54
0
 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));
     }
 }
コード例 #55
0
	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);
		}
	}
コード例 #56
0
        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
        }
コード例 #57
0
ファイル: SolverManager.cs プロジェクト: ChemaLeon/RitualCops
		// 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);
		}
コード例 #58
0
	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();
		}
	}
コード例 #59
0
ファイル: PlayerShooting.cs プロジェクト: enro92/Unity
        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> ();
        }
コード例 #60
0
ファイル: SceneComponent.cs プロジェクト: zhutaorun/unitygame
        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();
        }