Example #1
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)
 {
     if (animator.GetComponentInParent<Character>().Status == Character.Statuses.ATTACKING)
     {
         animator.GetComponentInParent<Character>().Status = Character.Statuses.READY;
     }
 }
Example #2
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;
 }
 // OnStateEnter is called before OnStateEnter is called on any state inside this state machine
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (stateInfo.IsTag("DestroyState"))
     {
         animator.GetComponentInParent<BaseEnemy>().DestroyEnemy(stateInfo.length);
     }
 }
Example #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) {
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(animator.GetBool("Grounded"))
        {
            UnityEngine.Random rnd = new UnityEngine.Random();
            //animator.GetComponentInParent<Rigidbody>().AddForce(new Vector3(rnd.RandomRange(-1.0f, 1.0f), rnd.RandomRange(-20.0f, 20.0f), rnd.RandomRange(-1.0f, 1.0f));
            animator.GetComponentInParent<Rigidbody>().AddForce(new Vector3(0f, 20f, 0f));
            animator.SetBool("Grounded", false);
        }
    }
Example #5
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     //animator.transform.parent.GetComponent<Actor>();
     m_Actor = animator.GetComponentInParent<Actor>();
     if(m_Actor.AI.CURRENT_AI_STATE == eAIStateType.AI_STATE_ATTACK)
     {
         m_Actor.AI.IS_ATTACK = true;
         m_bIsAttack = false;
     }
 }
    // 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)
    {
        _playerCollider2D = animator.GetComponentsInParent<Collider2D>();
        for (int i = 0; i < _playerCollider2D.Length; i++) {
            _playerCollider2D[i].enabled = false;
        }

        if (DisableGravity) {
            _playerRigidBody2D = animator.GetComponentInParent<Rigidbody2D>();
            _gravitySaved = _playerRigidBody2D.gravityScale;
            _playerRigidBody2D.gravityScale = 0.0f;

            _velocitySaved = _playerRigidBody2D.velocity;
            _playerRigidBody2D.velocity = Vector2.zero;
        }
    }
Example #7
0
    // 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)
    {
        var rigidbody = animator.GetComponentInParent<Rigidbody>();
        rigidbody.constraints = store;

    }
    //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)
    //{
    //    BossAttack attackScript = animator.GetComponentInParent<BossAttack>();
    //    attackScript.ToggleMeleeCollider();
    //}
    // 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)
    {
        BossAIScript aiScript = animator.GetComponentInParent<BossAIScript>();

        aiScript.Attacking = false;
    }
	// 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) {
		WalkerController controller = animator.GetComponentInParent<WalkerController> ();
		controller.Died ();
	}
	 // 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) {
	//
		animator.GetComponentInParent<Transform> ().GetComponentInParent<AudioSource> ().Play ();
	}
Example #11
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) {
		animator.GetComponentInParent<Transform> ().GetComponentInParent<PartyGroup> ().Facing (true);
	}