本文整理汇总了C#中UnityEngine.Animator.GetBool方法的典型用法代码示例。如果您正苦于以下问题:C# Animator.GetBool方法的具体用法?C# Animator.GetBool怎么用?C# Animator.GetBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Animator
的用法示例。
在下文中一共展示了Animator.GetBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPhotonSerializeView
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
// We own this player: send the others our data
stream.SendNext(transform.position);
stream.SendNext(transform.rotation);
anim = GetComponent< Animator >();
stream.SendNext(anim.GetFloat("Speed"));
stream.SendNext(anim.GetFloat("Direction"));
stream.SendNext(anim.GetBool("Punch_L"));
stream.SendNext(anim.GetBool("LowKick"));
stream.SendNext(anim.GetBool("HiKick"));
stream.SendNext(anim.GetBool("Shoryuken"));
myThirdPersonController myC = GetComponent<myThirdPersonController>();
stream.SendNext((int)myC._characterState);
}
else
{
// Network player, receive data
this.correctPlayerPos = (Vector3)stream.ReceiveNext();
this.correctPlayerRot = (Quaternion)stream.ReceiveNext();
anim = GetComponent< Animator >();
anim.SetFloat("Speed",(float)stream.ReceiveNext());
anim.SetFloat("Direction",(float)stream.ReceiveNext());
anim.SetBool("Punch_L",(bool)stream.ReceiveNext());
anim.SetBool("LowKick",(bool)stream.ReceiveNext());
anim.SetBool("HiKick", (bool)stream.ReceiveNext());
anim.SetBool("Shoryuken", (bool)stream.ReceiveNext());
myThirdPersonController myC = GetComponent<myThirdPersonController>();
myC._characterState = (CharacterState)stream.ReceiveNext();
}
}
示例2: 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)
{
var currentDirection = (Direction)animator.GetInteger("FaceDirection");
if (animator.GetBool("MeleeAttackBool"))
{
animator.SetBool("MeleeAttackBool", false);
switch (currentDirection)
{
case Direction.Up:
animator.CrossFade("P_Idle_Up", 0.5f);
break;
case Direction.Down:
animator.CrossFade("P_Idle_Down", 0.5f);
break;
case Direction.Left:
animator.CrossFade("P_Idle_Left", 0.5f);
break;
case Direction.Right:
animator.CrossFade("P_Idle_Right", 0.5f);
break;
}
}
ResetAnimationState(animator);
}
示例3: 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.GetBool("death"))
{
animator.SetBool("died", true);
animator.SetBool("death", false);
}
}
示例4: ConditionToChangeOn
protected override bool ConditionToChangeOn(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (animator.GetBool(GroundVariableName) && !animator.IsInTransition(layerIndex)) {
return ChangeOnGround;
} else {
return ChangeOnAir;
}
}
示例5: 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);
}
}
示例6: GetXAxisForce
private float GetXAxisForce(Animator animator)
{
float xForce =50f;
if(animator.GetBool(PLATFORM_PARAMETER))
{
xForce = 0f;
}
if (animator.GetBool(HOLE_PARAMATER))
{
xForce = 150f;
Vector2 newVelocity = mBody.velocity;
newVelocity.x = Mathf.Sign(animator.GetFloat("Speed")) * 7f;
mBody.velocity = newVelocity;
}
xForce *= Mathf.Sign(animator.GetFloat("Speed"));
return xForce;
}
示例7: OnStateExit
// 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 (castingTime >= 0)
{
//Does not finish casting, hero is hit
if (animator.GetBool(isDelayedHash))
{
castingTime += 0.5f;
animator.SetFloat(castingTimeHash, castingTime);
return;
}
if (animator.GetBool(isInterruptedHash))
{
castingTime = 0.0f - float.Epsilon;
animator.SetFloat(castingTimeHash, castingTime);
return;
}
}
}
示例8: ToggleVisible
public void ToggleVisible(Animator anim)
{
if (anim.GetBool("isDisplayed"))
{
anim.SetBool("isDisplayed", false);
}
else
{
anim.SetBool("isDisplayed", true);
}
}
示例9: 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)
{
bool OnGround = animator.GetBool("OnGround");
float jumpVal = animator.GetFloat("Jump");
if(OnGround && jumpVal > -2)
{
//if(soundBank != null)
// soundBank.PlaySound("Land");
}
}
示例10: 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
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
animator.gameObject.GetComponent<PressStart>().mode = animator.GetInteger("mode");
poof = animator.gameObject.GetComponentsInChildren<ParticleSystem>();
foreach (var puff in poof)
{
Debug.Log("Puff");
puff.Play();
}
animator.SetBool("flipped", !animator.GetBool("flipped"));
//UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject (GameObject.FindGameObjectWithTag ("UI Element"));
//anim.SetInteger("mode", menuNumber);
}
示例11: OnStateUpdate
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (_elapsedTime < stateInfo.length + _delayAfterFinish)
{
_elapsedTime += Time.deltaTime;
}
else if (!animator.GetBool(CharController.DeadBool))
{
animator.SetBool(CharController.DyingBool, false);
animator.SetBool(CharController.DeadBool, true);
}
}
示例12: OnStateExit
public new void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (!animator.GetBool("drawBowBool"))
{
if (!this.playerEvents)
{
this.playerEvents = animator.transform.GetComponent<animEventsManager>();
}
if (this.playerEvents)
{
this.playerEvents.enableSpine();
}
}
}
示例13: Start
// Use this for initialization
void Start()
{
characterController = GetComponent<CharacterController>();
game = GameObject.Find("GAME");
gameScript = game.GetComponent<GameScript>();
player = gameScript.Player.gameObject;
animator = transform.FindChild("zombi1animated").gameObject.GetComponent<Animator>();
target = player.transform.position;
target.y = transform.position.y;
animator.SetBool("walking1", Random.Range(0, 2) == 0 ? true : false);
Debug.Log("walking1: " + animator.GetBool("walking1"));
move = true;
}
示例14: GetParameterValue
object GetParameterValue(Animator anim, AnimatorControllerParameterType type, int nameHash)
{
switch (type) {
case AnimatorControllerParameterType.Bool:
case AnimatorControllerParameterType.Trigger:
return anim.GetBool(nameHash);
case AnimatorControllerParameterType.Float:
return anim.GetFloat(nameHash);
case AnimatorControllerParameterType.Int:
return anim.GetInteger(nameHash);
default:
return null;
}
}
示例15: DisablePanelDeleyed
IEnumerator DisablePanelDeleyed(Animator anim)
{
bool closedStateReached = false;
bool wantToClose = true;
while (!closedStateReached && wantToClose)
{
if (!anim.IsInTransition(0))
closedStateReached = anim.GetCurrentAnimatorStateInfo(0).IsName(k_ClosedStateName);
wantToClose = !anim.GetBool(m_OpenParameterId);
yield return new WaitForEndOfFrame();
}
if (wantToClose)
anim.gameObject.SetActive(false);
}