// 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>(); }
// 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); }
// Use this for initialization void Start(){ anim = GetComponent<Animator> (); dispParoDelJugador = GetComponentInParent<disparosDelJugador> (); anim.SetInteger ("cartuchos", municionActual); anim.SetInteger ("reservas", municionReservas); muestraMunicion (); }
private IEnumerator RandomizeValue() { var previousValue = statusAnimator.GetInteger("randomState"); var newValue = GenerateNewValue(previousValue); statusAnimator.SetInteger("randomState", newValue); yield return(new WaitForSeconds(Random.Range(timeFrom, timeTo))); StartRandomizeValue(); }
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]); } }
// 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; }
void Start() { rb2d = gameObject.GetComponent<Rigidbody2D>(); anim = gameObject.GetComponent<Animator>(); if (facingLeft) { anim.SetInteger("walkingAnimation", -1); } else { anim.SetInteger("walkingAnimation", 1); } }
//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()); }
// 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 }
void Start() { maxHealth = 6; animator = this.GetComponent<Animator> (); animator.SetInteger ("fenceType", 0); animator.SetBool ("damaged", false); }
void Awake() { animationState = 0; animator = (Animator)GetComponent<Animator> (); animator.SetInteger ("State", animationState); networkView = GetComponent<NetworkView> (); }
public override void OnEnter() { animator = ownerDefault.GetComponent <UnityEngine.Animator> (); animator.SetInteger(hash, Mathf.RoundToInt(owner.GetValue(value))); Finish(); }
void Awake() { doorAnimator = GetComponent<Animator> (); if (appear) { doorAnimator.SetInteger("AnimState",0); doorAnimator.speed = 0f; } else{ doorAnimator.SetInteger("AnimState",1); doorAnimator.speed = 1f; } if (name == "Door_End") { levelComplete = transform.parent.FindChild ("LevelComplete").GetComponent<SpriteRenderer> (); } allKnow = GameObject.Find ("theOmniscient").GetComponent<GatherAllKnowledge>(); }
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if(stateInfo.normalizedTime >= 1.0f) { animator.SetInteger("Hit", 0); } }
void Start() { anim = GetComponent<Animator> (); feels = State.Idle; needs = State.Punch; anim.SetInteger ("feelsState", 0); }
// 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; }
public override void OnEnter () { animator = ownerDefault.GetComponent<UnityEngine.Animator> (); animator.SetInteger (hash, Mathf.RoundToInt(owner.GetValue(value))); Finish (); }
void Start() { hp = 3; animator = GetComponent<Animator>(); animator.SetInteger("hp", hp); parallaxLayer = GetComponent<SpriteRenderer>().sortingOrder; }
// private AnotherScript anotherScript; //private GameObject otherScript; //OtherScript = GetComponent(OtherScript); //public GameObject objectToAccess; // 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) { cartucho = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/cartucho_006"); m =cartucho.GetComponent<SkinnedMeshRenderer>(); m.enabled = false; //Instantiate(flash,); casquillos = animator.GetInteger ("casquillos"); //GameObject Object1 = GameObject.Find ("armas"); //Component anotherScript = Object1.GetComponent<disparosDelJugador> (); disparo = GameObject.Find ("armas").GetComponent<disparosDelJugador> (); disparo.disparo (3); anim = GameObject.Find ("animacionColt44-40").GetComponent<Animator> (); anim.SetInteger ("cartuchos",anim.GetInteger("cartuchos")-1); //Transform bone = GetComponent<Animator>().avatar.GetBone(BoneType.LeftShoulder); objetin = GameObject.FindGameObjectsWithTag ("canionColt"); posicionHueso = objetin [0].transform; Debug.Log("Posicion del hgueso -----------------"+posicionHueso.position+"----------------------"); Instantiate (esfera, posicionHueso.position,posicionHueso.rotation); // Script1.disparo (); /*abtenemos posicion del posicion = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/marco").GetComponent<Transform>(); Debug.Log ("+++++++++++ la poscion del flash es: " + posicion.position + "+++++++++++++++++++");canion*/ /*obtenemos un hueso*/ }
// Use this for initialization void Start() { animator = GetComponent<Animator>(); direction = Random.Range(0, 2) == 0 ? 1 : -1; animator.SetInteger("dir", direction); }
/// <summary> /// Will set the Animation with the supplied parameter /// </summary> /// <param name="animation">The Animation to set</param> /// <param name="animator">The animator to get the Animations</param> /// <param name="parameter">The value for the Animation</param> public static void setAnimationTypeAndValue(Animation animation, Animator animator, object value) { if(value == null) { return; } //Grab what Type of parameter AnimatorControllerParameter param = getAnimatorControllerParameter(animation, animator); //If param doesn't exist, just get out if(param == null) { return; } switch(param.type) { case AnimatorControllerParameterType.Bool: animator.SetBool(animation.ToString(), (bool)value); break; case AnimatorControllerParameterType.Float: animator.SetFloat(animation.ToString(), (float)value); break; case AnimatorControllerParameterType.Int: animator.SetInteger(animation.ToString(), (int)value); break; case AnimatorControllerParameterType.Trigger: animator.SetTrigger(animation.ToString()); break; default: break; } }
// Use this for initialization void Start () { player = GameObject.Find("Squirrel").GetComponent<Player>(); rigidbody_2d = this.GetComponent<Rigidbody2D>(); animator = this.GetComponent<Animator>(); if (steps != 0) { animator.SetInteger("AnimationState", 2); } else { animator.SetInteger("AnimationState", 0); } }
// 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) { //spearCollider.enabled = false; animator.SetInteger ("status", 0); animator.gameObject.GetComponent<Boss> ().attacking = false; animator.gameObject.GetComponent<Boss> ().estado = 1; }
void Start() { Quaternion rot = Random.rotation; vR = rot.z; vX = rot.x/10; vY = rot.y/10; anim = GetComponent<Animator>(); anim.SetInteger ("aster", Random.Range (0, 3)); }
// Use this for initialization public void Awake() { // Random type from 0-2 // red = 0, blue = 1, green = 2; switch ((int)Random.Range (0, 3)) { case 0: type = TYPE_RED; break; case 1: type = TYPE_GREEN; break; default : type = TYPE_BLUE; break; } anim = GetComponent<Animator> (); anim.SetInteger ("Type", type); // randomly seperate random stat to each stat plus START_STATS = 10 hp = START_STATS + (int)Random.Range (0, bonusStat); bonusStat -= (hp - START_STATS); sword = START_STATS + (int)Random.Range (0, bonusStat); bonusStat -= (sword - START_STATS); shield = START_STATS + bonusStat; }
// Use this for initialization void Start() { agent = GetComponent<NavMeshAgent>(); anim = GetComponentInChildren<Animator>(); anim.SetInteger ("CharacterState", (int)CharacterState.Idle); //myTransform = transform; }
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { //called on the last frame of a transition to another state. //reset the options animator.SetInteger("optionselect", 0); }
// Use this for initialization void Start() { anim = GetComponent<Animator>(); parameterId = Animator.StringToHash(parameterName); int newAnimation = (int) Random.Range(0, numAnimations); anim.SetInteger(parameterId, newAnimation); }
// Use this for initialization void Start() { animator = this.GetComponent<Animator>(); animator.SetInteger("Direction", (int)DIRECTIONS.DOWN); StartCoroutine(waitInit()); }
// Use this for initialization void Start() { anim = GetComponent<Animator> (); playerWolfShadow = GameObject.Find("playerWolfShadow"); playerWolf = GameObject.Find("playerWolf"); anim.SetInteger ("AnimState", 0); rb2DplayerWolf = playerWolfShadow.GetComponent<Rigidbody2D>(); }
// Use this for initialization void Start () { //transform.position = new Vector3(playerX, playerY); rb2D = GetComponent<Rigidbody2D>(); anim = GetComponent<Animator>(); Direction = 0; anim.SetInteger ("Direction",Direction); anim.SetBool ("Move", false); }
// Use this for initialization void Start() { mySR = GetComponent<SpriteRenderer> (); childSR = transform.GetChild(0).GetComponent<SpriteRenderer> (); myAnim = GetComponent<Animator> (); childAnim = transform.GetChild(0).GetComponent<Animator> (); childAnim.SetInteger("level", 1); }
public static bool AnimeParamSet( UnityEngine.Animator animator, string name, object value, AnimatorControllerParameterType type) { switch (type - 1) { case 0: animator.SetFloat(name, (float)value); break; case 2: animator.SetInteger(name, (int)value); break; case 3: animator.SetBool(name, (bool)value); break; default: if (type != 9) { return(false); } switch (value) { case null: animator.ResetTrigger(name); break; case bool flag: if (flag) { animator.SetTrigger(name); break; } animator.ResetTrigger(name); break; case int num: if (num != 0) { animator.SetTrigger(name); break; } animator.ResetTrigger(name); break; default: animator.SetTrigger(name); break; } break; } return(true); }
void CombatAnimations() { bool attack = ginoController.attackInput; bool heavyAttack = ginoController.heavyInput; bool heavyAttack2 = ginoController.heavy2Input; //BASIC COMBOS if (attack) { if (animator.GetCurrentAnimatorStateInfo(0).IsName("Uppercut")) { attackCount = 1; } if (animator.GetCurrentAnimatorStateInfo(0).IsName("Slap")) { attackCount = 2; } } if (heavyAttack) { if (animator.GetCurrentAnimatorStateInfo(0).IsName("Slap") && attackCount != 2) { attackCount = 3; } } if (animator.GetCurrentAnimatorStateInfo(0).IsName("ComboEnd")) { attackCount = 0; } //HEAVY ATTACK if (heavyAttack) { startTimer = true; } if (startTimer && heavyAttack2) { attackTimer += Time.deltaTime; if (attackTimer > 0.5f) { animator.SetBool("heavyAttack", true); startTimer = false; } } else { attackTimer = 0; animator.SetBool("heavyAttack", false); } animator.SetInteger("attackCount", attackCount); animator.SetBool("attack", attack); animator.SetFloat("attackTimer", attackTimer); }
public void SetAnimatorParameter() { if (!animator.enabled || !animator.gameObject.activeInHierarchy) { if (LogDebug) { UnityEngine.Debug.Assert(animator.enabled && animator.gameObject.activeInHierarchy, "Setting the animator parameter while the animator is disabled may not register the change", this); } return; } if (isUnsafe) { return; } switch (ParameterType) { case AnimatorControllerParameterType.Float: animator.SetFloat(ParameterID, FloatValue.Value); break; case AnimatorControllerParameterType.Int: animator.SetInteger(ParameterID, IntValue.Value); break; case AnimatorControllerParameterType.Bool: animator.SetBool(ParameterID, BoolValue.Value); break; case AnimatorControllerParameterType.Trigger: animator.SetTrigger(ParameterID); break; default: throw new ArgumentOutOfRangeException(); } if (PreventFewTriggersPerFrame) { StartCoroutine(MakeUnsafeTillEndOfFrame()); } if (LogDebug) { UnityEngine.Debug.Log("Parameter Set", this); } }
public void SetAnimatorParameter(UnityEngine.Animator animator) { switch (ParameterType) { case AnimatorControllerParameterType.Float: animator.SetFloat(ParameterID, FloatValue.Value); break; case AnimatorControllerParameterType.Int: animator.SetInteger(ParameterID, IntValue.Value); break; case AnimatorControllerParameterType.Bool: animator.SetBool(ParameterID, BoolValue.Value); break; case AnimatorControllerParameterType.Trigger: animator.SetTrigger(ParameterID); break; } }
public static bool AnimeParamSet(UnityEngine.Animator animator, string name, object value) { switch (value) { case float num: animator.SetFloat(name, num); break; case int num: animator.SetInteger(name, num); break; case bool flag: animator.SetBool(name, flag); break; default: return(false); } return(true); }
public override void OnEnter() { animator.SetInteger(hash, value); Finish(); }