当前位置: 首页>>代码示例>>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;未经允许,请勿转载。