Inheritance: Behaviour
 void Awake()
 {
     m_myRigid = GetComponent<Rigidbody>();
     m_anim = GetComponent<Animator>();
     m_shipStates = GetComponent<StateManager>();
     m_passTray = GetComponentInChildren<PassengerTray>();
 }
Exemple #2
0
        // Use this for initialization
        void Start()
        {
            animator = GetComponent<Animator>();
            blur = GetComponent<Blur>();

            int min = 0;
            int max = 5;
            float time = 0.1f;

            pause.OnPauseEnterAsObservable()
                .Subscribe(_ => iTween.ValueTo(gameObject,
                     iTween.Hash(
                         "from", min,
                         "to", max,
                         "time", time,
                         "onupdate", "OnUpdateOnPauseTransition",
                         "onstart", "OnStartOnPauseEnter")));
            //  .Subscribe(_ => animator.SetBool("isPausing", true));

            pause.OnPauseExitAsObservable()
                .Subscribe(_ => iTween.ValueTo(gameObject,
                    iTween.Hash(
                        "from", max,
                        "to", min,
                        "time", time,
                        "onupdate", "OnUpdateOnPauseTransition",
                        "oncomplete", "OnCompleteOnPauseExit")));
            //  .Subscribe(_ => animator.SetBool("isPausing", false));
        }
Exemple #3
0
        public void Init()
        {
            _myEnity = new Enity();
            _myEnity.AddProperty("name", "hero");
            _myEnity.Go = LoadModel();
            _animator = _myEnity.Go.GetComponentInChildren<Animator>();
            _myEnity.AddComponent("display", new DisplayComponent());
            _myEnity.AddComponent("actionComponent", new ActionComponent());
            _myEnity.AddComponent("transformComponent", new TransformComponent());
            _myEnity.AddComponent("titleComponent", new TitleComponent());
            //_myEnity.AddComponent("mouseInteractiveComponent", new MouseInteractiveComponent());
            _myEnity.AddComponent("lifeBarComponent", new LifeBarComponent());

            /*PatrolComponent patrolComponent = new PatrolComponent();
            _myEnity.AddComponent("patrolComponent", patrolComponent);*/
            EnityData _enityData = new EnityData();
            _myEnity.AddProperty("enityData", _enityData);
            _myEnity.Transform.gameObject.AddComponent<EnityBind>().Owner = _myEnity;

            //GameInput.Instance.OnUpdate += patrolComponent.Update;

            //test
            LifeBarComponent life = _myEnity.AddComponent<LifeBarComponent>();
            life.key = "test add";
            GetCamera();
        }
Exemple #4
0
        private static GameObject CalculatePreviewGameObject(UnityEngine.Animator selectedAnimator, Motion motion, ModelImporterAnimationType animationType)
        {
            AnimationClip firstAnimationClipFromMotion = GetFirstAnimationClipFromMotion(motion);
            GameObject    preview = AvatarPreviewSelection.GetPreview(animationType);

            if (IsValidPreviewGameObject(preview, ModelImporterAnimationType.None))
            {
                return(preview);
            }
            if ((selectedAnimator != null) && IsValidPreviewGameObject(selectedAnimator.gameObject, animationType))
            {
                return(selectedAnimator.gameObject);
            }
            preview = FindBestFittingRenderableGameObjectFromModelAsset(firstAnimationClipFromMotion, animationType);
            if (preview != null)
            {
                return(preview);
            }
            if (animationType == ModelImporterAnimationType.Human)
            {
                return(GetHumanoidFallback());
            }
            if (animationType == ModelImporterAnimationType.Generic)
            {
                return(GetGenericAnimationFallback());
            }
            return(null);
        }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.Animator animator = (UnityEngine.Animator)value;
     writer.WriteProperty("rootPosition", animator.rootPosition);
     writer.WriteProperty("rootRotation", animator.rootRotation);
     writer.WriteProperty("applyRootMotion", animator.applyRootMotion);
     writer.WriteProperty("linearVelocityBlending", animator.linearVelocityBlending);
     writer.WriteProperty("updateMode", animator.updateMode);
     writer.WriteProperty("bodyPosition", animator.bodyPosition);
     writer.WriteProperty("bodyRotation", animator.bodyRotation);
     writer.WriteProperty("stabilizeFeet", animator.stabilizeFeet);
     writer.WriteProperty("feetPivotActive", animator.feetPivotActive);
     writer.WriteProperty("speed", animator.speed);
     writer.WriteProperty("cullingMode", animator.cullingMode);
     writer.WriteProperty("playbackTime", animator.playbackTime);
     writer.WriteProperty("recorderStartTime", animator.recorderStartTime);
     writer.WriteProperty("recorderStopTime", animator.recorderStopTime);
     writer.WriteProperty("runtimeAnimatorController", animator.runtimeAnimatorController);
     writer.WriteProperty("avatar", animator.avatar);
     writer.WriteProperty("layersAffectMassCenter", animator.layersAffectMassCenter);
     writer.WriteProperty("logWarnings", animator.logWarnings);
     writer.WriteProperty("fireEvents", animator.fireEvents);
     writer.WriteProperty("enabled", animator.enabled);
     writer.WriteProperty("tag", animator.tag);
     writer.WriteProperty("name", animator.name);
     writer.WriteProperty("hideFlags", animator.hideFlags);
 }
        public override void OnEnter()
        {
            animator = ownerDefault.GetComponent <UnityEngine.Animator> ();
            animator.SetInteger(hash, Mathf.RoundToInt(owner.GetValue(value)));

            Finish();
        }
		public override void OnEnter()
		{
			// get the animator component
			var go = Fsm.GetOwnerDefaultTarget(gameObject);
			
			if (go==null)
			{
				Finish();
				return;
			}
			
			_animator = go.GetComponent<Animator>();
			
			if (_animator==null)
			{
				Finish();
				return;
			}
			
			_animatorProxy = go.GetComponent<PlayMakerAnimatorMoveProxy>();
			if (_animatorProxy!=null)
			{
				_animatorProxy.OnAnimatorMoveEvent += OnAnimatorMoveEvent;
			}
			
			
			DoCheckPivot();
			
			if (!everyFrame)
			{
				Finish();
			}
		}
Exemple #8
0
        public override void OnEnter()
        {
            // get the animator component
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go==null)
            {
                Finish();
                return;
            }

            _animator = go.GetComponent<Animator>();

            if (_animator==null)
            {
                Finish();
                return;
            }

            GameObject _goal = goal.Value;
            if (_goal!=null)
            {
                _transform = _goal.transform;
            }

            DoGetIKGoal();

            if (!everyFrame)
            {
                Finish();
            }
        }
Exemple #9
0
        // Use this for initialization
        void Start()
        {
            var observableUpdate = GetComponent<ObservableUpdateTrigger>();
            var observableFixedUpdate = GetComponent<ObservableFixedUpdateTrigger>();

            if (observableUpdate == null)
            {
                observableUpdate = gameObject.AddComponent<ObservableUpdateTrigger>();
            }

            if (observableFixedUpdate == null)
            {
                observableFixedUpdate = gameObject.AddComponent<ObservableFixedUpdateTrigger>();
            }

            animator = GetComponentInChildren<Animator>();

            pause.OnPauseEnterAsObservable()
                .Subscribe(_ =>
                {
                    observableUpdate.enabled = false;
                    observableFixedUpdate.enabled = false;
                    animator.enabled = false;
                });

            pause.OnPauseExitAsObservable()
                .Subscribe(_ =>
                {
                    observableUpdate.enabled = true;
                    observableFixedUpdate.enabled = true;
                    animator.enabled = true;
                });
        }
        private Color EXIT = new Color(1f, 0.5f, 0f); // Couleur par défaut

        void Start()
        {
            if (transform.childCount > 0)
                myAnimator = transform.GetChild(0).GetComponent<Animator>();
            findMaterial(name);
            ChangeColor(EXIT);
        }
		public override void OnEnter()
		{
			// get the animator component
			var go = Fsm.GetOwnerDefaultTarget(gameObject);
			
			if (go==null)
			{
				Finish();
				return;
			}
			
			_animator = go.GetComponent<Animator>();
			
			if (_animator!=null)
			{
				int _layer = layer.IsNone?-1:layer.Value;
				
				float _normalizedTime = normalizedTime.IsNone?Mathf.NegativeInfinity:normalizedTime.Value;
				
				_animator.CrossFade(stateName.Value,transitionDuration.Value,_layer,_normalizedTime);
			}
			
			Finish();
			
		}
		public override void OnEnter()
		{
			// get the animator component
			var go = Fsm.GetOwnerDefaultTarget(gameObject);
			
			if (go==null)
			{
				Finish();
				return;
			}
			
			_animator = go.GetComponent<Animator>();
			
			if (_animator==null)
			{
				Finish();
				return;
			}
			
			DoLayerWeight();
			
			if (!everyFrame) 
			{
				Finish();
			}
		}
Exemple #13
0
 public override void OnStart()
 {
     GetComponent<Animator> ().Play ("hurt");
     animator = GetComponent<Animator> ();
     tree = GetComponent<BehaviorTree> ();
     hurted = (SharedBool)tree.GetVariable ("hurted");
 }
Exemple #14
0
 //===================================================
 // UNITY METHODS
 //===================================================
 /// <summary>
 /// Awake.
 /// </summary>
 void Awake()
 {
     health = GetComponent<Health>();
     hitFlash = GetComponent<HitFlash>();
     startingHealth = health.HealthValue;
     a = footman.GetComponent<Animator>();
 }
 public override void OnEnter()
 {
     GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(this.gameObject);
     if (ownerDefaultTarget == null)
     {
         base.Finish();
         return;
     }
     this._animator = ownerDefaultTarget.GetComponent<Animator>();
     if (this._animator == null)
     {
         base.Finish();
         return;
     }
     this._animatorProxy = ownerDefaultTarget.GetComponent<PlayMakerAnimatorIKProxy>();
     if (this._animatorProxy != null)
     {
         this._animatorProxy.OnAnimatorIKEvent += new Action<int>(this.OnAnimatorIKEvent);
     }
     else
     {
         Debug.LogWarning("This action requires a PlayMakerAnimatorIKProxy. It may not perform properly if not present.");
     }
     GameObject value = this.goal.Value;
     if (value != null)
     {
         this._transform = value.transform;
     }
     this.DoSetIKGoal();
     if (!this.everyFrame)
     {
         base.Finish();
     }
 }
		// Code that runs on entering the state.
		public override void OnEnter()
		{
			
			// get the animator component
			var go = Fsm.GetOwnerDefaultTarget(gameObject);
			
			if (go==null)
			{
				Finish();
				return;
			}
			_agent = go.GetComponent<NavMeshAgent>();
			
			
			_animator = go.GetComponent<Animator>();
			
			if (_animator==null)
			{
				Finish();
				return;
			}
			
			_trans = go.transform;
			
			_animatorProxy = go.GetComponent<PlayMakerAnimatorMoveProxy>();
			if (_animatorProxy!=null)
			{
				_animatorProxy.OnAnimatorMoveEvent += OnAnimatorMoveEvent;
			}
	
		}
        public override void OnEnter()
        {
            // get the animator component
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go==null)
            {
                Finish();
                return;
            }

            _animator = go.GetComponent<Animator>();

            if (_animator==null)
            {
                Finish();
                return;
            }

            // get hash from the param for efficiency:
            _paramID = Animator.StringToHash(parameter.Value);

            GetParameter();

            if (!everyFrame)
            {
                Finish();
            }
        }
		public override void OnEnter()
		{
			// get the animator component
			var go = Fsm.GetOwnerDefaultTarget(gameObject);
			
			if (go==null)
			{
				Finish();
				return;
			}
			
			_animator = go.GetComponent<Animator>();
			
			if (_animator==null)
			{
				Finish();
				return;
			}
			
			GameObject targetGo = transform.Value;
			
			if (targetGo==null)
			{
				Finish();
				return;
			}
				
			_transform = targetGo.transform;
			
			DoCheckIsControlled();
			
			Finish();
			
		}
Exemple #19
0
 // スクリューキックが終わると重力をデフォルトにもどす
 public override void OnStateExitFromScrewKick(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     Debug.Log("Exit Screw Kick");
     PlayerMotor motor = GetComponent<PlayerMotor>();
     motor.movement.EnableGravity = true;
     base.OnStateExitFromScrewKick(animator, stateInfo, layerIndex);
 }
 public HeroState(FSM fsm)
     : base(fsm)
 {
     Hero = (HeroMotion)fsm;
     animator = gameObject.GetComponent<Animator>();
     InputManager = gameObject.GetComponent<InputManager>();
 }
		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;
			}
		}
Exemple #22
0
        public void OnToggleValueChange(bool value)
        {
            if (!this.UseToggle || this.TargetToggle == null)
            {
                return;
            }

            this.active = this.TargetToggle.isOn;

            if (this.TransitionMode == UITransitionMode.Animation)
            {
                UnityEngine.Animator animator = this.GetAnimator();
                if (this.TargetGameObject == null ||
                    animator == null ||
                    !animator.isActiveAndEnabled ||
                    animator.runtimeAnimatorController == null ||
                    string.IsNullOrEmpty(this.ActiveBool))
                {
                    return;
                }

                animator.SetBool(this.ActiveBool, this.active);
            }

            this.DoStateTransition(this.active ? UITransitionVisualState.Active :
                                   this.selected ? UITransitionVisualState.Selected : this.highlighted ? UITransitionVisualState.Highlighted : UITransitionVisualState.Normal, false);
        }
Exemple #23
0
        public void Start()
        {
            animator = GetComponent<Animator>();

            highscore = ProgressManager.GetProgress().highscores.Find(x => x.levelId == id);
            if (highscore != null && highscore.starCount > 0)
            {
                starScore = highscore.starCount;
            }
            else
            {
                starScore = 0;
            }

            Main.onSceneChange.AddListener(SceneChanged);

            Highscore.onStarChange.AddListener(HighscoreStarChanged);

            UpdateUILevel();

            if (createdByLevelswitch)
                animator.SetTrigger("levelswitch");
            else
                animator.SetTrigger("fadein");
        }
Exemple #24
0
		protected override void Init()
		{
			animator = GetComponent<Animator>();
			AddUpdater(enabledName, UpdateEnabled);
			AddUpdater(animatorName, UpdateAnimator);
			AddUpdater(playStateName, UpdatePlayState);
		}
		private void Start() {
			_rigidbody = GetComponent<Rigidbody>();
			_animator = GetComponent<Animator>();

			// Automatically rotate player to initial direction
			if (_facingRight) {
				transform.rotation = _rightRotation;
				_rotationAmount = +1.0f;
			}
			else {
				transform.rotation = _leftRotation;
				_rotationAmount = -1.0f;
			}

			var virtualJoystickGameObject = GameObject.Find("Virtual Joystick");
			if (virtualJoystickGameObject != null) {
				virtualJoystick = virtualJoystickGameObject.GetComponent<HatGuyJoystick>();
				virtualButton = virtualJoystickGameObject.GetComponent<HatGuyTouchButton>();
			}

#if !(UNITY_IPHONE || UNITY_ANDROID)
			// Virtual joystick not needed for non-touch devices!
			if (virtualJoystick != null)
				Destroy(virtualJoystick.gameObject);
#endif
		}
 private void Awake()
 {
     // Setting up references.
        groundCheck = transform.Find("GroundCheck");
        ceilingCheck = transform.Find("CeilingCheck");
     anim = GetComponent<Animator>();
 }
Exemple #27
0
 void Awake()
 {
     _Animator = GetComponent<Animator>();
     _BoxCollider = GetComponent<BoxCollider2D>();
     _Rigidbody = GetComponent<Rigidbody2D>();
     _AudioSource = GetComponent<AudioSource>();
 }
Exemple #28
0
        void Start()
        {
            anim	= gameObject.GetComponent<Animator>();

            Animations	= anim.runtimeAnimatorController.animationClips;
            Animations	= Animations.Where((animation) => animation.name.Contains("@sd_")).OrderBy((animation) => animation.name).ToArray();
        }
		public override void OnEnter()
		{
			// get the animator component
			var go = Fsm.GetOwnerDefaultTarget(gameObject);
			
			if (go==null)
			{
				Finish();
				return;
			}
			
			_animator = go.GetComponent<Animator>();
			
			if (_animator==null)
			{
				Finish();
				return;
			}
			
			_locomotion = new Locomotion(_animator);
			
			SetLocomotion();
			
			if (!everyFrame) 
			{
				Finish();
			}
		}
Exemple #30
0
        public sealed override void OnStateExit(UnityEngine.Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
        {
            m_LastFrameHappened = false;

            OnSLStateExit(animator, stateInfo, layerIndex);
            OnSLStateExit(animator, stateInfo, layerIndex, controller);
        }
 public override void OnEnter()
 {
     GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(this.gameObject);
     if (ownerDefaultTarget == null)
     {
         base.Finish();
         return;
     }
     this._animator = ownerDefaultTarget.GetComponent<Animator>();
     if (this._animator == null)
     {
         base.Finish();
         return;
     }
     this._animatorProxy = ownerDefaultTarget.GetComponent<PlayMakerAnimatorMoveProxy>();
     if (this._animatorProxy != null)
     {
         this._animatorProxy.OnAnimatorMoveEvent += new Action(this.OnAnimatorMoveEvent);
     }
     this.GetLayerWeight();
     if (!this.everyFrame)
     {
         base.Finish();
     }
 }
        public void Start()
        {
            // Get the values of the parameters:
            layerIndex = GetParameterAsInt(0, 1);
            weight = GetParameterAsFloat(1, 1);
            subject = GetSubject(2);
            duration = GetParameterAsFloat(3, 0);
            if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AnimatorLayer({1}, {2}, {3}, {4})", new System.Object[] { DialogueDebug.Prefix, layerIndex, weight, subject, duration }));

            // Check the parameters:
            if (subject == null) {
                if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): subject '{1}' wasn't found.", new System.Object[] { DialogueDebug.Prefix, GetParameter(2) }));
                Stop();
            } else {
                animator = subject.GetComponentInChildren<Animator>();
                if (animator == null) {
                    if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): no Animator found on '{1}'.", new System.Object[] { DialogueDebug.Prefix, subject.name }));
                    Stop();
                } else if ((layerIndex < 1) || (layerIndex >= animator.layerCount)) {
                    if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): layer index {1} is invalid.", new System.Object[] { DialogueDebug.Prefix, layerIndex }));
                    Stop();
                } else if (duration < SmoothMoveCutoff) {
                    Stop();
                } else {

                    // Set up the lerp:
                    startTime = DialogueTime.time;
                    endTime = startTime + duration;
                    originalWeight = animator.GetLayerWeight(layerIndex);
                }
            }
        }
        private bool m_FacingRight = true;  // For determining which way the player is currently facing.

        private void Awake()
        {
            // Setting up references.
            m_GroundCheck = transform.Find("GroundCheck");
            m_Anim = GetComponent<Animator>();
            m_Rigidbody2D = GetComponent<Rigidbody2D>();
        }
 private void Awake()
 {
     _transform = transform;
     _animator = GetComponent<Animator>();
     _gameObject = gameObject;
     _chromeObjectTransform = _transform.FindChild("Not Enough Gems Chrome").transform;
 }
Exemple #35
0
        // Use this for initialization
        void Start()
        {
            animator = GetComponent<Animator>();

            GetNickname ();
            camera = FindObjectOfType<CameraControllerMainMenu>();
        }
Exemple #36
0
 // Use this for initialization
 void Start()
 {
     nav        = GetComponent <UnityEngine.AI.NavMeshAgent>();
     sound      = GetComponent <UnityEngine.AudioSource>();
     anim       = GetComponent <UnityEngine.Animator>();
     nav.speed  = 1.2f;
     anim.speed = 1.2f;
 }
Exemple #37
0
 public override void OnStateEnter(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo,
                                   int layerIndex)
 {
     _gameManager = GameManager.Instance;
     _gameManager.currentState.SetText("Minigame");
     _gameManager.GetPlayerInput().actions.FindAction("Use").performed += OnUse;
     _timerEnd = _gameManager.GetTimerMinigameEnd();
 }
Exemple #38
0
 public override void OnStateExit(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
 {
     //_enity.SetProperty("actinStateExit", stateInfo);
     if (_isLock == true)
     {
         IsLock = false;
     }
 }
Exemple #39
0
 public static bool AnimeParamFindSet(
     UnityEngine.Animator animator,
     string name,
     object value,
     AnimatorControllerParameter[] animParams)
 {
     return(((IEnumerable <AnimatorControllerParameter>)animParams).FirstOrDefault <AnimatorControllerParameter>((Func <AnimatorControllerParameter, bool>)(p => p.get_name() == name)).SafeProc <AnimatorControllerParameter>((Action <AnimatorControllerParameter>)(param => Utils.Animator.AnimeParamSet(animator, name, value, param.get_type()))));
 }
Exemple #40
0
 // Start is called before the first frame update
 void Start()
 {
     coinCount      = 0;
     spriteRenderer = GetComponent <SpriteRenderer>();
     animator       = GetComponent <UnityEngine.Animator>();
     rb             = GetComponent <Rigidbody>();
     jump           = new Vector3(0.0f, 2.0f, 0.0f);
 }
 static public void FastSetter(this UnityEngine.Animator o, string propertyName, UnityEngine.AnimatorCullingMode value)
 {
     switch (propertyName)
     {
     case "cullingMode":
         o.cullingMode = value; return;
     }
     LBoot.LogUtil.Error("UnityEngine.Animator no Setter Found : " + propertyName);
 }
Exemple #42
0
 public static IReadOnlyList <AnimatorState> GetStates(UnityEngine.Animator animator)
 {
     StatesDict.TryGetValue(animator, out List <AnimatorState> states);
     if (states == null)
     {
         states = EmptyList;
     }
     return(states);
 }
        public override void OnEnter()
        {
            base.OnEnter();
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            _animator = go.GetComponent <Animator>();
            _cc       = go.GetComponent <PlayerCtr>();
            startTime = Time.time;
        }
 static public void FastSetter(this UnityEngine.Animator o, string propertyName, UnityEngine.RuntimeAnimatorController value)
 {
     switch (propertyName)
     {
     case "runtimeAnimatorController":
         o.runtimeAnimatorController = value; return;
     }
     LBoot.LogUtil.Error("UnityEngine.Animator no Setter Found : " + propertyName);
 }
 static public void FastSetter(this UnityEngine.Animator o, string propertyName, UnityEngine.Avatar value)
 {
     switch (propertyName)
     {
     case "avatar":
         o.avatar = value; return;
     }
     LBoot.LogUtil.Error("UnityEngine.Animator no Setter Found : " + propertyName);
 }
Exemple #46
0
        public static void Initialise(UnityEngine.Animator animator, TMonoBehaviour monoBehaviour)
        {
            SceneLinkedSMB <TMonoBehaviour>[] sceneLinkedSMBs = animator.GetBehaviours <SceneLinkedSMB <TMonoBehaviour> >();

            for (int i = 0; i < sceneLinkedSMBs.Length; i++)
            {
                sceneLinkedSMBs[i].InternalInitialise(animator, monoBehaviour);
            }
        }
    public override void OnStateEnter(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        controller = animator.gameObject.GetComponent <PlayerController>();
        //controller.OnTrigger2DStay += OnPlayerTrigger2DEnter;

        ani = animator;

        animator.SetBool("Idle", true);
    }
        public void SetAnimator(UE.Animator animator)
        {
            Animators.Clear();

            if (animator)
            {
                Animators.Add(animator);
            }
        }
Exemple #49
0
            public static bool AnimeParamSet(
                UnityEngine.Animator animator,
                string name,
                object value,
                AnimatorControllerParameterType type)
            {
                switch (type - 1)
                {
                case 0:
                    animator.SetFloat(name, (float)value);
                    break;

                case 2:
                    animator.SetInteger(name, (int)value);
                    break;

                case 3:
                    animator.SetBool(name, (bool)value);
                    break;

                default:
                    if (type != 9)
                    {
                        return(false);
                    }
                    switch (value)
                    {
                    case null:
                        animator.ResetTrigger(name);
                        break;

                    case bool flag:
                        if (flag)
                        {
                            animator.SetTrigger(name);
                            break;
                        }
                        animator.ResetTrigger(name);
                        break;

                    case int num:
                        if (num != 0)
                        {
                            animator.SetTrigger(name);
                            break;
                        }
                        animator.ResetTrigger(name);
                        break;

                    default:
                        animator.SetTrigger(name);
                        break;
                    }
                    break;
                }
                return(true);
            }
 void Start()
 {
     sound           = GetComponent <GinoSoundControl>();
     animator        = GetComponent <Animator>();
     player          = GameObject.FindGameObjectWithTag("Player");
     ginoController  = player.GetComponent <CharacterControl>();
     playerRBody     = player.GetComponent <Rigidbody>();
     cameraTransform = GameObject.FindGameObjectWithTag("MainCamera").transform;
 }
Exemple #51
0
    public override void OnStateUpdate(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        timer += Time.deltaTime;

        //if (timer > controller.AttackCoolDown)
        //{
        //    animator.SetBool("Idle", true);
        //}
    }
Exemple #52
0
        public void Set(GameObject _gameObject)
        {
            var anim = _gameObject.GetComponent <UnityEngine.Animator> ();

            if (anim != null)
            {
                animator = anim;
            }
        }
 protected override void ClearUIComponents()
 {
     Meteors           = null;
     ConnectingContent = null;
     BtnCheckWiFi      = null;
     ConnectIngImage   = null;
     TextConnect       = null;
     BtnBack           = null;
     mData             = null;
 }
Exemple #54
0
 public override void OnStateExit(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
 {
     Debug.Log("on state exit");
     _enity.SetProperty("onStateExit", stateInfo);
     _listNode.Clear();
     if (_isLock == true)
     {
         IsLock = false;
     }
 }
        //-------------------------------------------------------------------------
        public static bool ReadUnity43SpriteAnimatorParams(GameObject gameObject, UnityEngine.Animator unity43Animator, ref Sprite[] spriteFramesArray, ref string[] spriteIDStrings, ref int numFrames)
        {
#if UNITY_5_AND_LATER
            UnityEditor.Animations.AnimatorController controller = (UnityEditor.Animations.AnimatorController)unity43Animator.runtimeAnimatorController;
#else
            UnityEditorInternal.AnimatorController controller = (UnityEditorInternal.AnimatorController)unity43Animator.runtimeAnimatorController;
#endif
            if (!controller)
            {
                numFrames = 1;
                return(false);
            }
            // Note: we have to maintain the order to keep the spriteRef and spriteID indices linked.
            // Thus we don't use a HashSet for duplicate prevention but a list.Contains() call.
            List <string>             spriteIDs    = new List <string>();
            List <UnityEngine.Sprite> spriteFrames = new List <Sprite>();

            AnimationClip[] clips = AnimationUtility.GetAnimationClips(gameObject);
            for (int index = 0; index < clips.Length; ++index)
            {
                AnimationClip clip = clips[index];

                EditorCurveBinding[] bindings = AnimationUtility.GetObjectReferenceCurveBindings(clip);
                if (bindings != null)
                {
                    for (int bindingIndex = 0; bindingIndex < bindings.Length; ++bindingIndex)
                    {
                        EditorCurveBinding binding = bindings[bindingIndex];
                        if (binding.isPPtrCurve)
                        {
                            ObjectReferenceKeyframe[] references = AnimationUtility.GetObjectReferenceCurve(clip, binding);
                            for (int refIndex = 0; refIndex < references.Length; ++refIndex)
                            {
                                ObjectReferenceKeyframe reference = references[refIndex];
                                UnityEngine.Sprite      spriteRef = (UnityEngine.Sprite)reference.value;
                                if (spriteRef != null)
                                {
                                    string spriteID = spriteRef.name;
                                    if (!spriteIDs.Contains(spriteID))
                                    {
                                        spriteFrames.Add(spriteRef);
                                        spriteIDs.Add(spriteID);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            spriteFramesArray = spriteFrames.ToArray();
            spriteIDStrings   = spriteIDs.ToArray();
            numFrames         = spriteIDStrings.Length;
            return(true);
        }
Exemple #56
0
    void OnEnable()
    {
        _animator = GetComponentInChildren <UE.Animator>();

        if (_animator)
        {
            _graph = PlayableGraph.Create();
            _graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
            _output = AnimationPlayableOutput.Create(_graph, "Animation", _animator);
        }
    }
Exemple #57
0
 public override void OnStateEnter(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
 {
     //DataEventSource.Instance.DispatcherEvent("onStateEnter", stateInfo);
     _enity     = animator.transform.GetComponentInParent <EnityBind>().Owner;
     _enityData = _enity.GetProperty("enityData") as EnityData;
     _isEnd     = false;
     _isLock    = AnimatorManager.Instance.IsLock(stateInfo.shortNameHash);
     if (_isLock)
     {
         IsLock = _isLock;
     }
 }
    static public void FastSetter(this UnityEngine.Animator o, string propertyName, UnityEngine.Quaternion value)
    {
        switch (propertyName)
        {
        case "rootRotation":
            o.rootRotation = value; return;

        case "bodyRotation":
            o.bodyRotation = value; return;
        }
        LBoot.LogUtil.Error("UnityEngine.Animator no Setter Found : " + propertyName);
    }
Exemple #59
0
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            _animator        = go.GetComponent <Animator>();
            eventIndex.Value = -1;
            for (int i = 0; i < events.Length; i++)
            {
                AttackMenu.Instance.flagCallback[i] -= OnButtonClick;
                AttackMenu.Instance.flagCallback[i] += OnButtonClick;
            }
            Debug.Log("Enter");
        }
 public void Initialize(UnityEngine.Animator animator, SkeletonDataAsset skeletonDataAsset)
 {
     this.animator = animator;
     this.previousAnimations.Clear();
     this.animationTable.Clear();
     foreach (Spine.Animation animation in skeletonDataAsset.GetSkeletonData(true).Animations)
     {
         this.animationTable.Add(animation.Name.GetHashCode(), animation);
     }
     this.clipNameHashCodeTable.Clear();
     this.clipInfoCache.Clear();
     this.nextClipInfoCache.Clear();
 }