当前位置: 首页>>代码示例>>C#>>正文


C# Animator.GetBool方法代码示例

本文整理汇总了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();
        }
    }
开发者ID:aka0x0,项目名称:boomboomwrestling,代码行数:35,代码来源:NetworkCharacter.cs

示例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);
    }
开发者ID:musicm122,项目名称:The-Depths-of-H-E-double-hockey-stick,代码行数:33,代码来源:TurnOffAttack.cs

示例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);
     }
 }
开发者ID:WizzardMaker,项目名称:Ludum-Dare,代码行数:17,代码来源:deathAnimation.cs

示例4: ConditionToChangeOn

 protected override bool ConditionToChangeOn(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animator.GetBool(GroundVariableName) && !animator.IsInTransition(layerIndex)) {
         return ChangeOnGround;
     } else {
         return ChangeOnAir;
     }
 }
开发者ID:SpoonmanGames,项目名称:Descend-Into-Heaven,代码行数:8,代码来源:ChangeOnAirGroundBehaviour.cs

示例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);
        }
    }
开发者ID:Midimistro,项目名称:Deadmen,代码行数:16,代码来源:ItemRebounce.cs

示例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;
    }
开发者ID:ysucae,项目名称:Balloune,代码行数:20,代码来源:JumpingState.cs

示例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;
            }
        }
    }
开发者ID:DmaInNewZealand,项目名称:AutoCombat,代码行数:21,代码来源:BattleUnitCastBehaviour.cs

示例8: ToggleVisible

 public void ToggleVisible(Animator anim)
 {
     if (anim.GetBool("isDisplayed"))
     {
         anim.SetBool("isDisplayed", false);
     }
     else
     {
         anim.SetBool("isDisplayed", true);
     }
 }
开发者ID:alleinc,项目名称:Unity,代码行数:11,代码来源:MenuManager.cs

示例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");
        }
    }
开发者ID:mdb5108,项目名称:JurassicParkour,代码行数:12,代码来源:StateSoundBehaviour.cs

示例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);
    }
开发者ID:MMEstrada,项目名称:GoGoGrandmas,代码行数:23,代码来源:MenuModeChanger.cs

示例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);
     }
 }
开发者ID:LuciusSixPercent,项目名称:Finsternis,代码行数:12,代码来源:DeathAnimationController.cs

示例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();
         }
     }
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:14,代码来源:bowAnimReset.cs

示例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;
    }
开发者ID:Jntz,项目名称:ZombieCampingAdventure,代码行数:16,代码来源:ZombieAIScript.cs

示例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;
        }
    }
开发者ID:Turnary-Games,项目名称:Battery-Golem,代码行数:17,代码来源:SaveAnimator.cs

示例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);
	}
开发者ID:wangfeilong321,项目名称:SpeedBikeRacer,代码行数:17,代码来源:PanelManager.cs


注:本文中的UnityEngine.Animator.GetBool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。