本文整理汇总了C#中Animator.GetComponentInParent方法的典型用法代码示例。如果您正苦于以下问题:C# Animator.GetComponentInParent方法的具体用法?C# Animator.GetComponentInParent怎么用?C# Animator.GetComponentInParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animator
的用法示例。
在下文中一共展示了Animator.GetComponentInParent方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStateExit
// 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;
}
}
示例2: OnStateEnter
// 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;
}
示例3: OnStateEnter
// 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);
}
}
示例4: OnStateUpdate
// 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);
}
}
示例5: OnStateEnter
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;
}
}
示例6: OnStateEnter
// 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;
}
}
示例7: OnStateExit
// 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;
}
示例8: OnStateExit
//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;
}
示例9: OnStateEnter
// 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 ();
}
示例10: OnStateEnter
// 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 ();
}
示例11: OnStateEnter
// 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);
}