當前位置: 首頁>>代碼示例>>C#>>正文


C# Animator.SetInteger方法代碼示例

本文整理匯總了C#中UnityEngine.Animator.SetInteger方法的典型用法代碼示例。如果您正苦於以下問題:C# Animator.SetInteger方法的具體用法?C# Animator.SetInteger怎麽用?C# Animator.SetInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.Animator的用法示例。


在下文中一共展示了Animator.SetInteger方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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(safeAttack<animator.GetInteger("Attack"))
         animator.SetInteger("Attack",1);
     else
         animator.SetInteger("Attack",0);
 }
開發者ID:Baensi,項目名稱:Assets,代碼行數:8,代碼來源:AttackNextStage.cs

示例2: Start

	// Use this for initialization
	void Start () {

		//Get a component reference to the Character's animator component
		animator = GetComponent<Animator>();
		render = GetComponent<SpriteRenderer>();

		//Get the rigid body on the prefab
		bullBody = GetComponent<Rigidbody2D>();

		//Set our bullet strength and speed
		strength = 4;
		speed = 40;

		//Go after our player!
		player = GameObject.Find("Player").GetComponent<Player>();

		//Get our Player current Direction
		if (player.getDirection () > 0 ||
			(player.getDirection() == 0 && player.getLastDirection() > 0 )) {
			animator.SetInteger ("Direction", 1);
			playerRight = true;
		} else {
			playerRight = false;
			animator.SetInteger ("Direction", -1);
		}

		//Play our shooting sound
		shoot = GameObject.Find ("Shoot").GetComponent<AudioSource> ();

			shoot.Play ();

		//Get our camera script
		actionCamera = Camera.main.GetComponent<ActionCamera>();
	}
開發者ID:julianpoy,項目名稱:HackPoly2016,代碼行數:35,代碼來源:Bullets.cs

示例3: Start

	// Use this for initialization
	void Start(){
		anim = GetComponent<Animator> ();
		dispParoDelJugador = GetComponentInParent<disparosDelJugador> ();
		anim.SetInteger ("cartuchos", municionActual);
		anim.SetInteger ("reservas", municionReservas);

		muestraMunicion ();
	}
開發者ID:JonaSilva,項目名稱:cozcyt,代碼行數:9,代碼來源:controlDeArmasJugador.cs

示例4: OnStateMachineEnter

 public override void OnStateMachineEnter(Animator animator, int stateMachinePathHash)
 {
     if(states.Length == 0)
         animator.SetInteger(parametrName, 0);
     else
     {
         int index = Random.Range(0, states.Length);
         animator.SetInteger(parametrName, states[index]);
     }
 }
開發者ID:piotreczek5,項目名稱:SpaceShooter,代碼行數:10,代碼來源:RandomAnimBehaviour.cs

示例5: Start

    // Use this for initialization
    void Start()
    {
        // Get the animator component
        animator = GetComponent<Animator>();
        animator.SetInteger("status", status);
        animator.SetInteger("asteroidClass", asteroidClass);

        // Create a random initial velocity (also an apoapsis)
        initialVector.Normalize();
        transform.GetComponent<Rigidbody2D>().velocity = initialSpeed * initialVector;
    }
開發者ID:zachfejes,項目名稱:SpaceJammers,代碼行數:12,代碼來源:AsteroidLife.cs

示例6: Start

 void Start()
 {
     rb2d = gameObject.GetComponent<Rigidbody2D>();
     anim = gameObject.GetComponent<Animator>();
     if (facingLeft)
     {
         anim.SetInteger("walkingAnimation", -1);
     }
     else
     {
         anim.SetInteger("walkingAnimation", 1);
     }
 }
開發者ID:Alejandro-Frech,項目名稱:EndlessKungFu,代碼行數:13,代碼來源:Enemy1.cs

示例7: Start

 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animator>();
     parameterId = Animator.StringToHash(parameterName);
     int newAnimation = (int) Random.Range(0, numAnimations);
     anim.SetInteger(parameterId, newAnimation);
 }
開發者ID:marcogillies,項目名稱:BlipC,代碼行數:8,代碼來源:RandomTransition.cs

示例8: Start

    // Use this for initialization
    void Start()
    {
        animator = this.GetComponent<Animator>();
        animator.SetInteger("Direction", (int)DIRECTIONS.DOWN);

        StartCoroutine(waitInit());
    }
開發者ID:rowenar11,項目名稱:digiforge,代碼行數:8,代碼來源:Dude.cs

示例9: Start

 void Start()
 {
     hp = 3;
     animator = GetComponent<Animator>();
     animator.SetInteger("hp", hp);
     parallaxLayer = GetComponent<SpriteRenderer>().sortingOrder;
 }
開發者ID:UnBiHealth,項目名稱:fisiogame,代碼行數:7,代碼來源:Target.cs

示例10: Start

 void Start()
 {
     anim = GetComponent<Animator> ();
     feels = State.Idle;
     needs = State.Punch;
     anim.SetInteger ("feelsState", 0);
 }
開發者ID:dannielle,項目名稱:heart-shake,代碼行數:7,代碼來源:HeartScript.cs

示例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.SetInteger("idleNextAnimation", 0);
        rndTime = UnityEngine.Random.Range(0.0f, 10.0f);
        startTime = Time.time;
        twinkleTime = startTime + rndTime;
        this.animator = animator;
	}
開發者ID:yoktobit,項目名稱:minerminingminesunity,代碼行數:8,代碼來源:IdleBehaviour.cs

示例12: OnEnter

		public override void OnEnter ()
		{
			animator = ownerDefault.GetComponent<UnityEngine.Animator> ();
			animator.SetInteger (hash,  Mathf.RoundToInt(owner.GetValue(value)));

			Finish ();
		}
開發者ID:NusantaraBeta,項目名稱:BrawlerRumble,代碼行數:7,代碼來源:SetInteger.cs

示例13: Start

 // Use this for initialization
 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     anim = GetComponentInChildren<Animator>();
     anim.SetInteger ("CharacterState", (int)CharacterState.Idle);
     //myTransform = transform;
 }
開發者ID:rogerdv,項目名稱:keyw,代碼行數:8,代碼來源:PlayerControl.cs

示例14: Awake

 //AnimState key
 //1 goes from growth/shine to idle
 //2 goes from idle to shine
 //3 goes from idle/shine to disappear
 // Use this for initialization
 void Awake()
 {
     freezeAnimator = GetComponent<Animator> ();
     freezeAnimator.SetInteger ("AnimState", 0);
     lifeTimer = 6f;
     StartCoroutine(Disappear());
 }
開發者ID:briveramelo,項目名稱:Cube-Quest,代碼行數:12,代碼來源:FreezeGround.cs

示例15: Start

 // Use this for initialization
 void Start()
 {
     killCounter = 0;
     mainLoop = (GameController) GameObject.FindGameObjectWithTag ("scripts").GetComponent(typeof(GameController));
     animator = this.GetComponent<Animator> ();
     animator.SetInteger ("Behavior", 0);	// bounce
 }
開發者ID:jpecoraro342,項目名稱:Defend-The-Herd,代碼行數:8,代碼來源:Goat_AI.cs


注:本文中的UnityEngine.Animator.SetInteger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。