本文整理汇总了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);
}
示例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>();
}
示例3: Start
// Use this for initialization
void Start(){
anim = GetComponent<Animator> ();
dispParoDelJugador = GetComponentInParent<disparosDelJugador> ();
anim.SetInteger ("cartuchos", municionActual);
anim.SetInteger ("reservas", municionReservas);
muestraMunicion ();
}
示例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]);
}
}
示例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;
}
示例6: Start
void Start()
{
rb2d = gameObject.GetComponent<Rigidbody2D>();
anim = gameObject.GetComponent<Animator>();
if (facingLeft)
{
anim.SetInteger("walkingAnimation", -1);
}
else
{
anim.SetInteger("walkingAnimation", 1);
}
}
示例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);
}
示例8: Start
// Use this for initialization
void Start()
{
animator = this.GetComponent<Animator>();
animator.SetInteger("Direction", (int)DIRECTIONS.DOWN);
StartCoroutine(waitInit());
}
示例9: Start
void Start()
{
hp = 3;
animator = GetComponent<Animator>();
animator.SetInteger("hp", hp);
parallaxLayer = GetComponent<SpriteRenderer>().sortingOrder;
}
示例10: Start
void Start()
{
anim = GetComponent<Animator> ();
feels = State.Idle;
needs = State.Punch;
anim.SetInteger ("feelsState", 0);
}
示例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;
}
示例12: OnEnter
public override void OnEnter ()
{
animator = ownerDefault.GetComponent<UnityEngine.Animator> ();
animator.SetInteger (hash, Mathf.RoundToInt(owner.GetValue(value)));
Finish ();
}
示例13: Start
// Use this for initialization
void Start()
{
agent = GetComponent<NavMeshAgent>();
anim = GetComponentInChildren<Animator>();
anim.SetInteger ("CharacterState", (int)CharacterState.Idle);
//myTransform = transform;
}
示例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());
}
示例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
}