예제 #1
1
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(animator.gameObject.GetComponent<Enemy>().indexPos == 0){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(1)").transform.position, GameObject.Find("skillSpawn(1)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy1Attack";
            }
        }

        if(animator.gameObject.GetComponent<Enemy>().indexPos == 1){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(2)").transform.position, GameObject.Find("skillSpawn(2)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy2Attack";
            }
        }

        if(animator.gameObject.GetComponent<Enemy>().indexPos == 2){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(3)").transform.position, GameObject.Find("skillSpawn(3)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy3Attack";

            }
        }
    }
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateinfo, int layerindex)
 {
     if (Player.Instance.OnGround) {
         animator.SetBool("land", false);
         animator.ResetTrigger("jump");
     }
 }
예제 #3
0
		// Update is called once per frame
		void  Update ()
		{
			// ↑キー/スペースが押されたら、ステートを次に送る処理
			if (Input.GetKeyDown ("up") || Input.GetButton ("Jump")) {
				// ブーリアンNextをtrueにする
				anim.SetBool ("Next", true);
			}
		
			// ↓キーが押されたら、ステートを前に戻す処理
			if (Input.GetKeyDown ("down")) {
				// ブーリアンBackをtrueにする
				anim.SetBool ("Back", true);
			}
		
			// "Next"フラグがtrueの時の処理
			if (anim.GetBool ("Next")) {
				// 現在のステートをチェックし、ステート名が違っていたらブーリアンをfalseに戻す
				currentState = anim.GetCurrentAnimatorStateInfo (0);
				if (previousState.fullPathHash != currentState.fullPathHash) {
					anim.SetBool ("Next", false);
					previousState = currentState;				
				}
			}
		
			// "Back"フラグがtrueの時の処理
			if (anim.GetBool ("Back")) {
				// 現在のステートをチェックし、ステート名が違っていたらブーリアンをfalseに戻す
				currentState = anim.GetCurrentAnimatorStateInfo (0);
				if (previousState.fullPathHash != currentState.fullPathHash) {
					anim.SetBool ("Back", false);
					previousState = currentState;
				}
			}
		}
예제 #4
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     Debug.Log("Stop");
     var rigidbody = animator.GetComponentInParent<Rigidbody>();
     store = rigidbody.constraints;
     rigidbody.constraints = RigidbodyConstraints.FreezeAll;
 }
예제 #5
0
    void Update()
    {
        _startN = 0.0f;
        _endN = 0.0f;
        _animationState = mAnimator.GetCurrentAnimatorStateInfo (0);

        SwoonNode snode = System.Array.Find (_animations, xx => _animationState.IsName (xx.clipname));
        if (snode != null)
        {
            _time = _animationState.normalizedTime - Mathf.Floor(_animationState.normalizedTime);
            float frames = (int)(_animationState.length*30);
            _startN = snode.start / frames;
            _endN = snode.end / frames;
            if (_time >= _startN && _time < _endN)
            {
                _trails.ForEach(x=>x.Emit = true);
            }
            else
            {
                _trails.ForEach(x=>x.Emit = false);
            }
        }
        else
        {
            _time = 0f;
            //_prevTime = _time;
            //_prevAnimTime = 0f;
        }
    }
예제 #6
0
	 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
	//override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
	//}

	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
	//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
	//}

	// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
	override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) 
	{
		if(stateInfo.IsName("LongGunPullOut"))
		{
			animator.GetComponent<CharacterReference>().ParentCharacter.MyAnimEventHandler.TriggerOnLongGunPullOutFinish();
		}
		else if(stateInfo.IsName("SmallWeaponPullOut"))
		{
			animator.GetComponent<CharacterReference>().ParentCharacter.MyAnimEventHandler.TriggerOnPistolPullOutFinish();
		}
		else if(stateInfo.IsName("LongGunPutAway"))
		{
			animator.GetComponent<CharacterReference>().ParentCharacter.MyAnimEventHandler.TriggerOnLongGunPutAwayFinish();
		}
		else if(stateInfo.IsName("SmallWeaponPutAway"))
		{
			animator.GetComponent<CharacterReference>().ParentCharacter.MyAnimEventHandler.TriggerOnPistolPutAwayFinish();
		}
		else if(stateInfo.IsName("GrenadePullOut"))
		{
			animator.GetComponent<CharacterReference>().ParentCharacter.MyAnimEventHandler.TriggerOnGrenadePullOutFinish();
		}
		else if(stateInfo.IsName("MeleeDraw"))
		{
			animator.GetComponent<CharacterReference>().ParentCharacter.MyAnimEventHandler.TriggerOnMeleePullOutFinish();
		}
	}
    // OnStateExit is called before OnStateExit is called on any state inside this state machine
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(!this.following) {

            this.nextAnimation();

        } else { // only important for bear

            EventManager.triggerEvent("stopMoving");

            if(animationCount < 4) {

                this.animationCount = 4;
                this.animator.SetInteger("animationCount", 4);

            } else if(this.animationCount == 6){

                // assign value to animator
                this.animator.SetInteger("animationCount", 6);

            } else {

                // assign value to animator
                this.animator.SetInteger("animationCount", 5);

                Debug.Log("RUN!!!!");
                EventManager.triggerEvent("startFollowMoving");
            }
        }
    }
예제 #8
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     //spearCollider.enabled = false;
     animator.SetInteger ("status", 0);
     animator.gameObject.GetComponent<Boss> ().attacking = false;
     animator.gameObject.GetComponent<Boss> ().estado = 1;
 }
예제 #9
0
 public override void OnStateEnter(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo animatorStateInfo, int layerIndex)
 {
     base.OnStateEnter(animator, animatorStateInfo, layerIndex);
     gm.UIHighlightClickedEvent.AddListener(UseAbility);
     gm.RenderAbility(gm.UnitClicked.MyLoadout.Abilities[gm.SelectedAbilityIndex]);
     gm.MouseoverChangedEvent.AddListener(UpdateAbilityOverlay);
 }
예제 #10
0
    //**********************************************************************************//
    // ANIMATOR			      															//
    // update animations at the animator controller (Mecanim)							//
    //**********************************************************************************//
    public void UpdateAnimator()
    {
        if (ragdolled)
            DisableActions();
        else
        {
            stateInfo = animator.GetCurrentAnimatorStateInfo(0);
            actions = jumpOver || stepUp || climbUp || rolling;

            RandomIdle();
            RollForwardAnimation();
            QuickTurn180Animation();
            QuickStopAnimation();
            LandHighAnimation();
            JumpOverAnimation();
            ClimbUpAnimation();
            StepUpAnimation();

            ControlLocomotion();

            animator.SetBool("Aiming", aiming);
            animator.SetBool("Crouch", crouch);
            animator.SetBool("OnGround", onGround);
            animator.SetFloat("GroundDistance", groundDistance);
            animator.SetFloat("VerticalVelocity", verticalVelocity);
        }
    }
예제 #11
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (_player == null)
         _player = animator.GetComponent<Player>();
     animator.SetBool("Died", true);
     InputHandler.instance.enabled = false;
 }
    // Update is called once per frame
    void Update()
    {
        if(PlayerAnimator == null)
            PlayerAnimator = GetComponent<Animator>();

        ///Obtenemos el estado actual de la animacion
        myASI = PlayerAnimator.GetCurrentAnimatorStateInfo(0);

        ///Como la tecla no tiene sensibilidad me manda 1 directamente por lo que
        /// no se nota la animación de Walk y parece que pasa directo a Run
        /// Con un Joystic se soluciona
        ///Caminamos si presionamos hacia arriba
        PlayerAnimator.SetFloat("WalkForwardSpeed", Input.GetAxis("Vertical"));
        ///Caminamos a la Izq o Der
        PlayerAnimator.SetFloat("WalkDirection", Input.GetAxis("Horizontal"));

        ///Preguntamos si estamos dentro de la maquina de Locomotion
        /// Asi evitamos que haga otro comportamiento en cualquier otra animacion
        /// en este caso evitamos que salte si no esta corriendo
        if(myASI.IsName("Locomotion"))
            if (Input.GetKeyDown(KeyCode.Space))
                PlayerAnimator.SetTrigger("Jump");

        ///Saludo aplicado con mascaras
        /// las máscaras sirven para desasociar partes del modelo y hacer que ciertas
        /// partes haagan otras animaciones.
        /// Como correr dos máquinas de estado al mismo tiempo.
        /// Si por ejemplo la animacion de disparo se realiza con el avatar completamente estático
        /// y quiero disparar caminando, en vez de hacer una animacion nueva de Diaparo/camino
        /// lo que hago es hacer máscaras, de esa forma la parte superior del torso realiza la animacion de
        /// disparo y l aparte inferior realiza la animacion de caminado.
        /// De esa forma no tengo que hacer animaciones especificas para cada estado.
        if (Input.GetKeyDown(KeyCode.Q))
            PlayerAnimator.SetTrigger("Wave");
    }
예제 #13
0
    public override void OnStateIK(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        // Do a sine based on the State normalized time

        /*float normalizedTime = (1.0f + Mathf.Sin(Mathf.Repeat(stateInfo.normalizedTime, 1.0f) * Mathf.PI * 4)) * 0.5f;
         * // lower the body
         * animator.bodyPosition = animator.bodyPosition + new Vector3(0, -0.3f, 0);
         * // make hands move left and right based on sine
         * Vector3 leftHandPosition = animator.bodyPosition + new Vector3(-0.1f + normalizedTime * -0.2f, 0, 0.2f);
         * Vector3 rightHandPosition = animator.bodyPosition + new Vector3(0.1f + normalizedTime * 0.2f, 0, 0.2f);
         * // put elbow up
         * Vector3 leftElbowPosition = animator.bodyPosition + new Vector3(-5, 2, 0);
         * Vector3 rightElbowPosition = animator.bodyPosition + new Vector3(5, 2, 0);
         * animator.SetIKPosition(AvatarIKGoal.LeftHand, leftHandPosition);
         * animator.SetIKPosition(AvatarIKGoal.RightHand, rightHandPosition);
         * // align knees to the hand
         * animator.SetIKHintPosition(AvatarIKHint.LeftKnee, leftHandPosition);
         * animator.SetIKHintPosition(AvatarIKHint.RightKnee, rightHandPosition);
         * animator.SetIKHintPosition(AvatarIKHint.LeftElbow, leftElbowPosition);
         * animator.SetIKHintPosition(AvatarIKHint.RightElbow, rightElbowPosition);
         * // activate everything. Could be done on start
         * animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 1.0f);
         * animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, 1.0f);
         * animator.SetIKPositionWeight(AvatarIKGoal.RightFoot, 1.0f);
         * animator.SetIKRotationWeight(AvatarIKGoal.RightFoot, 1.0f);
         * animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1.0f);
         * animator.SetIKPositionWeight(AvatarIKGoal.RightHand, 1.0f);
         * animator.SetIKHintPositionWeight(AvatarIKHint.LeftKnee, 1.0f);
         * animator.SetIKHintPositionWeight(AvatarIKHint.RightKnee, 1.0f);
         * animator.SetIKHintPositionWeight(AvatarIKHint.RightElbow, 1.0f);
         * animator.SetIKHintPositionWeight(AvatarIKHint.LeftElbow, 1.0f);*/
    }
예제 #14
0
    static void AnimatorStateInfo_loop(JSVCall vc)
    {
        UnityEngine.AnimatorStateInfo _this = (UnityEngine.AnimatorStateInfo)vc.csObj;
        var result = _this.loop;

        JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
    }
예제 #15
0
    static void AnimatorStateInfo_tagHash(JSVCall vc)
    {
        UnityEngine.AnimatorStateInfo _this = (UnityEngine.AnimatorStateInfo)vc.csObj;
        var result = _this.tagHash;

        JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result));
    }
예제 #16
0
    static void AnimatorStateInfo_length(JSVCall vc)
    {
        UnityEngine.AnimatorStateInfo _this = (UnityEngine.AnimatorStateInfo)vc.csObj;
        var result = _this.length;

        JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
    }
예제 #17
0
    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(parameters.usePath && parameters.path.points.Length <= 1) {
            commonParameters.walking = false;
        }
        //check drops
        AIMethods.CheckDrop(animator, commonParameters.sizeLimitDrop);
        //check if time to go iddle
        CheckGoToIddle(animator);

        // Saves the original position
        Vector3 move = Vector3.zero;
        //only move if not reached the point
        if (!_positionTargeted) {
            Vector3 originalPosition = commonParameters.enemy.transform.position;
            Vector3 finalPosition = AIMethods.MoveEnemy(originalPosition, _targetPosition, parameters.followType,
                                                        commonParameters.onFloor, parameters.speed);
            AIMethods.RotateEnemyTowards(commonParameters.enemy, parameters.fixedRotation, commonParameters.initialRotationEnemy,
                                parameters.rotationVelocity, originalPosition, finalPosition);

            Vector3 direction = (finalPosition - originalPosition).normalized;

            //move the entity
            move = direction * parameters.speed * Time.deltaTime;
        }

        //set gravity and move
        if (commonParameters.onFloor) {
            move += (commonParameters.enemy.transform.up * -1) * 25 * Time.deltaTime;
        }
        _controller.Move(move);

        CheckTargetPoint(animator);
    }
예제 #18
0
		public static int GetAnimatorNameHash(AnimatorStateInfo animatorStateInfo) {
			#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
			return animatorStateInfo.nameHash;
			#else
			return animatorStateInfo.fullPathHash;
			#endif
		}
예제 #19
0
 // Use this for initialization
 void Start()
 {
     // 各参照の初期化
     anim = GetComponent<Animator> ();
     currentState = anim.GetCurrentAnimatorStateInfo (0);
     previousState = currentState;
 }
예제 #20
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);
 }
예제 #21
0
 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     MobMotion motion = animator.GetComponent<MobMotion>();
     Vector2 movement = motion.PendingMovement;
     animator.SetFloat(MovX, movement.x);
     animator.SetFloat(MovY, movement.y);
 }
예제 #22
0
	// Update is called once per frame
	void Update () {
		//Debug.Log(anim.GetCurrentAnimatorStateInfo(0).tagHash.ToString());

		asi = anim.GetCurrentAnimatorStateInfo (0);
		if (asi.IsName ("Still Scenes")) {
			if(!a1HasPlayed){
				audSource.PlayOneShot (a1,2f);
				a1HasPlayed = true;
			}
		}else if (asi.IsName ("Still Scene 2")) {
			if(!a2HasPlayed){
				audSource.PlayOneShot (a2,1f);
				a2HasPlayed = true;
			}
		}else if (asi.IsName ("Still Scene 3")) {
			if(!a3HasPlayed){
				audSource.PlayOneShot (a3,1f);
				a3HasPlayed = true;
			}
		}else if (asi.IsName ("Cutscene Still 4")) {
			if(!a4HasPlayed){
				audSource.PlayOneShot (a4,1f);
				a4HasPlayed = true;
			}
		}

		if ( a4HasPlayed && !audSource.isPlaying )
			SceneManager.LoadScene ( "Instructions" );
	}
예제 #23
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     m_CharacterSword = animator.gameObject.GetComponentInChildren<CharacterSword> ();
     if (m_CharacterSword != null) {
         m_CharacterSword.m_IsAttacking = true;
     }
 }
예제 #24
0
	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
	override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
		Vector3 newPos = originalPos;
		
		newPos.y = newPos.y + yOffset;
		
		animator.transform.position = newPos;
	}
 // Update is called once per frame
 void Update()
 {
     time += Time.deltaTime;
     info = ani.GetCurrentAnimatorStateInfo(0);
     if (audio.isPlaying == false&&motionflag == false && time > 3.0f)
     {
         if (Life > 20)
         {
             audio.clip = okok;
             audio.Play();
             ani.SetTrigger("Win");
             motionflag = true;
         }
         else
         {
             audio.clip = nooo;
             audio.Play();
             ani.SetTrigger("Lose");
             motionflag = true;
         }
     }
     if (info.IsName("WIN00") || info.IsName("LOSE00"))
     {
         if (info.normalizedTime > 1.0f&&byeflag == false && time > 5.0f)
         {
             ani.SetTrigger("bye");
             audio.clip = bye;
             audio.Play();
             byeflag = true;
         }
     }
 }
	public RomanCharState.State characterState;	// Which state to switch into on enter
	 
	 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
	override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) 
	{
		GameManager.Instance.charState.SetState(characterState);
//		RSUtil.Instance.DelayedAction (() => {
//			GameManager.Instance.charState.SetState(characterState);
//		}, 0.2f);
	}
 static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.AnimatorStateInfo o;
         o = new UnityEngine.AnimatorStateInfo();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}
    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        myBoxCollider = animator.GetComponent<PlayerController>().mySwordBoxCollider;
        myBoxCollider.enabled = false;

        animator.SetBool("Whirlwinding", false);
    }
예제 #29
0
    void FixedUpdate()
    {
        currentBaseState = animator.GetCurrentAnimatorStateInfo(0); //Indica la capa de animacion
        int currentState = currentBaseState.nameHash;
        int state = (int)states.currentState;
        animator.SetFloat("Direction",Input.GetAxis("Horizontal"));
        animator.SetFloat("Speed",Input.GetAxis("Vertical"));
        animator.SetBool("Jump",false);

        if (Input.GetAxis("Vertical") > 0.1f){
            animator.SetBool("Walk",true);
        }else{
            animator.SetBool("Walk",false);
        }

        switch (currentState){
            case idleState:
                if (Input.GetButtonDown("Jump")){
                    animator.SetBool("Jump",true);
                }
                break;
            case walkState:
                if (Input.GetButtonDown("Jump")){
                    animator.SetBool("Jump",true);
                }
                break;
            case walkbackState:
                if (Input.GetButtonDown("Jump")){
                    animator.SetBool("Jump",true);
                }
                break;
            default:
                break;
        }
    }
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}
    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(charController == null)
            charController = animator.GetComponent<RomanCharController>();

        //charController.RunStateLogic(AnimState.Enter);
    }
예제 #31
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animator.runtimeAnimatorController.animationClips.Length < 2)
     {
         animator.SetBool("MirrorAppear", true);
     }
 }
예제 #32
0
	override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
	{
		FootPlacementData lF1 = animator.GetComponents<FootPlacementData>()[0];
		FootPlacementData lF2 = animator.GetComponents<FootPlacementData>()[1];

		//setting up first foot transition time and extra ray dist check
		if (lF1 != null)
		{
			if(stateInfo.normalizedTime  > 0.25f)
			{
				lF1.mExtraRayDistanceCheck = mIdleRayCast;
			}
			else
			{
				lF1.mExtraRayDistanceCheck = 0;
			}
		}

		//setting up second foot transition time and extra ray dist check
		if (lF2 != null)
		{
			if(stateInfo.normalizedTime  > 0.25f)
			{
				lF2.mExtraRayDistanceCheck = mIdleRayCast;
			}
			else
			{
				lF2.mExtraRayDistanceCheck = 0;
			}
		}
	}
 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     // In case it is not destroyed for some reason when it depends on the animation
     if (DependOnThisState && _spawnedGameObject != null) {
         Destroy(_spawnedGameObject);
     }
 }
예제 #34
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown ("up") || Input.GetButton ("Jump")) {

            anim.SetBool ("Next", true);
        }

        if (Input.GetKeyDown ("down")) {

            anim.SetBool ("Back", true);
        }

        if (anim.GetBool ("Next")) {

            currentState = anim.GetCurrentAnimatorStateInfo (0);
            if (previousState.nameHash != currentState.nameHash) {
                anim.SetBool ("Next", false);
                previousState = currentState;
            }
        }

        if (anim.GetBool ("Back")) {
            currentState = anim.GetCurrentAnimatorStateInfo (0);
            if (previousState.nameHash != currentState.nameHash) {
                anim.SetBool ("Back", false);
                previousState = currentState;
            }
        }
    }
예제 #35
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //アニメーション開始 / 動作開始
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
        hash = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<HashIDs>();
        animator.SetFloat(hash.speedFloat, 0f);

        if (stateInfo.fullPathHash!=hash.EmptyState)
        {

            if(stateInfo.fullPathHash==hash.NormalAttack1State||
                stateInfo.fullPathHash == hash.NormalAttack2State|| 
                stateInfo.fullPathHash == hash.NormalAttack3State)
            {
                PlayerAttack._instance.UseEnergy(SkillType.basic,PosType.basic);
            }
            else
            {
                if (stateInfo.fullPathHash == hash.Skill1State)
                {
                    PlayerAttack._instance.UseEnergy(SkillType.skill, PosType.one);
                }
                else if (stateInfo.fullPathHash == hash.Skill2State)
                {
                    PlayerAttack._instance.UseEnergy(SkillType.skill, PosType.two);
                }
                else if (stateInfo.fullPathHash == hash.Skill3State)
                {
                    PlayerAttack._instance.UseEnergy(SkillType.skill, PosType.three);
                }

            }
        }
    }
예제 #36
0
 public override void OnStateEnter(
     Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     this.animator = animator;
     GameManager.PlayerInteraction.PowerupOn += OnPlayerPowerupOn;
     GameManager.PlayerInteraction.PowerupOff += OnPlayerPowerupOff;
 }
예제 #37
0
 public override void OnStateExit(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
 {
     //_enity.SetProperty("actinStateExit", stateInfo);
     if (_isLock == true)
     {
         IsLock = false;
     }
 }
예제 #38
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();
 }
예제 #39
0
    public override void OnStateUpdate(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        timer += Time.deltaTime;

        //if (timer > controller.AttackCoolDown)
        //{
        //    animator.SetBool("Idle", true);
        //}
    }
    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);
    }
예제 #41
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;
     }
 }
예제 #42
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.AnimatorStateInfo o;
         o = new UnityEngine.AnimatorStateInfo();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #43
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;
     }
 }
예제 #44
0
 public override void OnStateUpdate(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
 {
     //DataEventSource.Instance.DispatcherEvent("onStateExit", stateInfo);
     if (stateInfo.normalizedTime >= 0.95f)
     {
         if (!_isEnd)
         {
             _isEnd = true;
             _enity.SetProperty("actinStateEnd", stateInfo);
             animator.Play("idle01");
         }
     }
 }
예제 #45
0
    static bool AnimatorStateInfo_IsTag__String(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 1)
        {
            System.String arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg);
            UnityEngine.AnimatorStateInfo argThis = (UnityEngine.AnimatorStateInfo)vc.csObj;                JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(argThis.IsTag(arg0)));
            JSMgr.changeJSObj(vc.jsObjID, argThis);
        }

        return(true);
    }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.AnimatorStateInfo o;
         o = new UnityEngine.AnimatorStateInfo();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
    static bool StateMachineBehaviour_OnStateExit__Animator__AnimatorStateInfo__Int32(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 3)
        {
            UnityEngine.Animator          arg0 = (UnityEngine.Animator)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            UnityEngine.AnimatorStateInfo arg1 = (UnityEngine.AnimatorStateInfo)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            System.Int32 arg2 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg);
            ((UnityEngine.StateMachineBehaviour)vc.csObj).OnStateExit(arg0, arg1, arg2);
        }

        return(true);
    }
예제 #48
0
        public override void OnStateUpdate(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo,
                                           int layerIndex)
        {
            _gameManager.HammerPower -= _gameManager.gameManagerData.decreasePowerPerSecond * Time.deltaTime;
            if (_gameManager.HammerPower < _gameManager.gameManagerData.thresholdReturnToIdle)
            {
                animator.SetTrigger(PrevState);
            }
            _timerEnd -= Time.deltaTime;

            if (_timerEnd < 0)
            {
                animator.SetTrigger(_gameManager.HammerPower < _gameManager.gameManagerData.kaboomThreshold ? Success : Fail);
            }
        }
예제 #49
0
 static public int IsTag(IntPtr l)
 {
     try{
         UnityEngine.AnimatorStateInfo self = (UnityEngine.AnimatorStateInfo)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Boolean ret = self.IsTag(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
    static bool StateMachineBehaviour_OnStateIK__Animator__AnimatorStateInfo__Int32__AnimatorControllerPlayable(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 4)
        {
            UnityEngine.Animator          arg0 = (UnityEngine.Animator)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            UnityEngine.AnimatorStateInfo arg1 = (UnityEngine.AnimatorStateInfo)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            System.Int32 arg2 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg);
            UnityEngine.Experimental.Director.AnimatorControllerPlayable arg3 = (UnityEngine.Experimental.Director.AnimatorControllerPlayable)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            ((UnityEngine.StateMachineBehaviour)vc.csObj).OnStateIK(arg0, arg1, arg2, arg3);
        }

        return(true);
    }
예제 #51
0
    static int get_loop(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.AnimatorStateInfo obj = (UnityEngine.AnimatorStateInfo)o;
            bool ret = obj.loop;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index loop on a nil value" : e.Message));
        }
    }
예제 #52
0
 static int IsTag(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.AnimatorStateInfo obj = (UnityEngine.AnimatorStateInfo)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimatorStateInfo));
         string arg0 = ToLua.CheckString(L, 2);
         bool   o    = obj.IsTag(arg0);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.SetBack(L, 1, obj);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #53
0
    static int get_fullPathHash(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.AnimatorStateInfo obj = (UnityEngine.AnimatorStateInfo)o;
            int ret = obj.fullPathHash;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index fullPathHash on a nil value" : e.Message));
        }
    }
예제 #54
0
    static int get_speedMultiplier(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.AnimatorStateInfo obj = (UnityEngine.AnimatorStateInfo)o;
            float ret = obj.speedMultiplier;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index speedMultiplier on a nil value" : e.Message));
        }
    }
    static int get_animatorStateInfo(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.AnimationEvent    obj = (UnityEngine.AnimationEvent)o;
            UnityEngine.AnimatorStateInfo ret = obj.animatorStateInfo;
            ToLua.PushValue(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index animatorStateInfo on a nil value" : e.Message));
        }
    }
예제 #56
0
    static int get_length(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.AnimatorStateInfo obj = (UnityEngine.AnimatorStateInfo)o;
            float ret = obj.length;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index length on a nil value"));
        }
    }
예제 #57
0
    public override void OnStateUpdate(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        foreach (KeyValuePair <string, float> t in _enityData.DictActionTime)
        {
            if (stateInfo.normalizedTime > t.Value)
            {
                if (_listNode.Contains(t.Key) == false)
                {
                    _listNode.Add(t.Key);
                    _enity.SetProperty("normalizedTime", t.Key);
                }
            }
        }

        if (stateInfo.normalizedTime >= 0.95f + transitionTime)
        {
            if (!_isEnd)
            {
                //GameInput.Log("state to the end " + stateInfo.normalizedTime);
                _isEnd = true;
                animator.SetBool("isAttack", false);
                animator.Play("idle01");
                _enity.SetProperty("actinStateEnd", stateInfo);
            }
        }


        /* if (stateInfo.normalizedTime > 0.3f)//播放特效时间节点
         * {
         *   if (!_listNode.Contains("effectNode"))
         *   {
         *       _enity.SetProperty("normalizedTime", "effectNode");
         *       _listNode.Add("effectNode");
         *   }
         * }
         * if (stateInfo.normalizedTime > 0.6f)//播放受击动作时间节点
         * {
         *   if (!_listNode.Contains("beAtkNode"))
         *   {
         *       _enity.SetProperty("normalizedTime", "beAtkNode");
         *       _listNode.Add("beAtkNode");
         *   }
         * }*/
    }
예제 #58
0
    // Update is called once per frame
    void Update()
    {
        if (GameObject.Find("SceneSand (1)") == null)
        {
            dialogAnimator.SetBool("SandInBag", true);
        }

        if (dialogAnimator.GetCurrentAnimatorStateInfo(0).IsName("portal"))
        {
            portal.SetActive(true);
        }
        if (Input.GetKeyDown("space"))
        {
            dialogAnimator.SetTrigger("Space");
            indicator = dialogAnimator.GetCurrentAnimatorStateInfo(0);
            if (indicator.IsName("HelloThereWait"))
            {
                dialogAnimator.SetBool("gap1", true);
            }
            else if (indicator.IsName("SelfIntroductionWait"))
            {
                dialogAnimator.SetBool("gap2", true);
            }
            else if (indicator.IsName("HelpMeWait"))
            {
                dialogAnimator.SetBool("gap3", true);
            }
            else if (indicator.IsName("TryThisWait"))
            {
                dialogAnimator.SetBool("gap4", true);
            }
            else if (indicator.IsName("Rain"))
            {
                dialogAnimator.SetBool("getRain", true);
                if (cloud != null)
                {
                    cloud.SetActive(true);
                }
            }
            else if (dialogAnimator.GetBool("granite") == true && indicator.IsName("GraniteGot"))
            {
                dialogAnimator.SetBool("gap5", true);
            }
            else if (indicator.IsName("rememberWait"))
            {
                dialogAnimator.SetBool("remember", true);
            }
            else if (dialogAnimator.GetBool("gotSand") == true && indicator.IsName("gotSand"))
            {
                dialogAnimator.SetBool("gap6", true);
            }
            else if (indicator.IsName("endWait"))
            {
                dialogAnimator.SetBool("gap7", true);
            }
        }
        else
        {
            dialogAnimator.ResetTrigger("Space");
        }
    }
예제 #59
0
 static int _CreateUnityEngine_AnimatorStateInfo(IntPtr L)
 {
     UnityEngine.AnimatorStateInfo obj = new UnityEngine.AnimatorStateInfo();
     ToLua.PushValue(L, obj);
     return(1);
 }
    public override void OnStateExit(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        //controller.OnTrigger2DStay -= OnPlayerTrigger2DEnter;

        animator.SetBool("Idle", false);
    }