override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (firstSetting) { this.IKController = animator.GetComponent<IKControllerHumanoid>(); this.toKeepDistanceHash = Animator.StringToHash("ToKeepDistance"); this.rollingHash = Animator.StringToHash("Rolling"); this.controller = animator.GetComponent<ControllerAIHumanoid>(); this.firstSetting = false; } if (!controller.isServer) return; if (Random.Range(0, 4) == 0) { animator.SetBool(rollingHash, true); } IKController.SetDefaultWeaponTarget(); controller.RVOController.enableRotation = true; Vector3 thePointToFleeFrom = controller.CurrentEnemy.transform.position; int theGScoreToStopAt = 1000; FleePath path = FleePath.Construct(animator.transform.position, thePointToFleeFrom, theGScoreToStopAt); path.aimStrength = 10; controller.ManuallySetPath(path); }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks public override void OnStateUpdate( Animator animator, AnimatorStateInfo stateInfo, int layerIndex ) { var pos = Utils.Instance.GetPlayerByColor(animator.GetComponent<GameManager>().GetCurrentPlayer()).transform.position; animator.GetComponent<CameraManager>().GetPlayerCamera().transform.position = Vector3.Lerp( animator.GetComponent<CameraManager>().GetMainCamera().transform.position, new Vector3(pos.x + 4, pos.y + 5, pos.z - 15), stateInfo.normalizedTime % 1.0f); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (_enemy == null) { _enemy = animator.GetComponent<Enemy>(); _nma = animator.GetComponent<NavMeshAgent>(); } _nma.speed = _enemy.moveSpeed; }
// 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.GetComponent<GramophoneController>().MusicParticleSystem.Stop(); AudioSource audioSource = animator.GetComponent<AudioSource>(); if( audioSource != null ) { audioSource.Stop(); } }
// 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) { animator.GetComponent<Character>().Attack = false; if (stateInfo.IsTag("attack")) { animator.GetComponent<Character>().MeleeAttack(); } animator.ResetTrigger("attack"); animator.ResetTrigger("throw"); }
// 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) { //myBoxCollider = animator.transform.FindChild("Sword").GetComponent<BoxCollider>(); myBoxCollider = animator.GetComponent<PlayerController>().mySwordBoxCollider; myWeaponAttack = animator.GetComponent<PlayerController>().mySwordsAttack; myWeaponAttack.damage += 20; myBoxCollider.enabled = true; }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (firstSetting) { this.shootingHash = Animator.StringToHash("Shooting"); this.IKController = animator.GetComponent<IKControllerHumanoid>(); this.controller = animator.GetComponent<ControllerAIHumanoid>(); this.firstSetting = false; } }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { GameObject[] players = GameObject.FindGameObjectsWithTag ("Player"); Attack attack = animator.GetComponent<AttackQueue> ().Attack; Enemy enem = animator.GetComponent<Enemy> (); Vector3 fromTo = enem.Target.transform.position - animator.transform.position; if (fromTo.magnitude <= attack.collSize.magnitude) { animator.SetFloat (AnimatorConstants.PUNCH, Random.value); } else { animator.SetFloat (AnimatorConstants.PUNCH, 0f); } }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks public override void OnStateUpdate( Animator animator, AnimatorStateInfo stateInfo, int layerIndex ) { int currentIteration = Mathf.FloorToInt(stateInfo.normalizedTime); if (currentIteration != _iteration) { _iteration = currentIteration; if( currentIteration == animator.GetComponent<GameManager>().GetDiceNumber() ) { Debug.Log("iter = " + currentIteration); _currentPlayer.GetAnimator().Play("idle"); animator.GetComponent<CameraManager>().UnfocusOnPlayer(_currentPlayer.GetPlayerColor()); animator.GetComponent<GameManager>().NextPlayer(); animator.SetTrigger("PlayerFinishMoveTrigger"); ok = true; // NANDEEE return; } else { var nextID = Utils.Instance.GetCaseByID(_currentPlayer.GetCaseID()).GetNextCaseID(); _currentPlayer.SetCaseID(nextID); if (Utils.Instance.GetCaseByID(nextID).GetCaseType() == ECaseType.INTERSECTION) animator.GetComponent<GameManager>().SetDiceNumber(animator.GetComponent<GameManager>().GetDiceNumber() + 1); _startMarker = _currentPlayer.transform.position; _endMarker = Utils.Instance.GetCaseByID(nextID).GetCasePosition(_currentPlayer.GetPlayerColor(), false); float animLength = Vector3.Distance(_startMarker, _endMarker); switch (_currentPlayer.GetPlayerColor()) { case EPlayer.BLUE: PlayerPrefs.SetInt("PLAYER_BLUE_CASEID", nextID); break; case EPlayer.GREEN: PlayerPrefs.SetInt("PLAYER_GREEN_CASEID", nextID); break; case EPlayer.RED: PlayerPrefs.SetInt("PLAYER_RED_CASEID", nextID); break; case EPlayer.YELLOW: PlayerPrefs.SetInt("PLAYER_YELLOW_CASEID", nextID); break; } animator.SetFloat("MoveInverseDuration", _speed / animLength); } } if(!ok )//TODO : A voir !! { float fracJourney = stateInfo.normalizedTime % 1.0f; _currentPlayer.transform.position = Vector3.Lerp(_startMarker, _endMarker, fracJourney); _currentPlayer.transform.LookAt(_endMarker); } }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (_player == null) { _player = animator.GetComponent<Player>(); _nma = animator.GetComponent<NavMeshAgent>(); _animator = animator; } _nma.speed = _player.moveSpeed; _animator.SetBool("Run", true); InputHandler.instance.enabled = true; }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Enemy en = animator.GetComponent<Enemy> (); GameObject target = en.Target; Vector3 fromTo = target.transform.position - animator.transform.position; Vector3 added = fromTo.normalized * en.Speed * Time.deltaTime; animator.transform.position += added; if (fromTo.magnitude <= animator.GetComponent<AttackQueue> ().Attack.collSize.magnitude / 2) { animator.SetBool (AnimatorConstants.TOOCLOSE, true); } else { animator.SetBool (AnimatorConstants.TOOCLOSE, false); } }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (firstSetting) { this.shootingHash = Animator.StringToHash("Shooting"); this.IKController = animator.GetComponent<IKControllerHumanoid>(); this.controller = animator.GetComponent<ControllerAIHumanoid>(); this.firstSetting = false; } if (!controller.isServer) return; IKController.SetWeaponTarget(controller.CurrentEnemy.transform); }
// 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(charController == null) charController = animator.GetComponent<RomanCharController>(); //charController.RunStateLogic(AnimState.Enter); }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks public override void OnStateUpdate( Animator animator, AnimatorStateInfo stateInfo, int layerIndex ) { if( Utils.Instance.GetPlayerByColor(animator.GetComponent<GameManager>().GetCurrentPlayer()).GetAnimPointMiddle() ) { animator.SetTrigger("WheelFreezeTrigger"); } }
public void OpenPanel (Animator anim) { if (m_Open == anim) return; anim.gameObject.SetActive (true); //print (anim.name); //phần vá if (anim.name == "QuitWindow") { anim.GetComponent<Exitgame> ().SetActive (); } var newPreviouslySelected = EventSystem.current.currentSelectedGameObject; anim.transform.SetAsLastSibling (); CloseCurrent (); m_PreviouslySelected = newPreviouslySelected; m_Open = anim; m_Open.SetBool (m_OpenParameterId, true); GameObject go = FindFirstEnabledSelectable (anim.gameObject); SetSelected (go); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { player = animator.GetComponent<Player>(); stateStartT = Time.time; lastIdleTry = stateStartT + 1f; lastRand = 100; }
// 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) { //if (AnimationStateEvent == StateEvent.Enter) //{ animator.GetComponent<RomanCharState>().SetState(characterState); //Debug.Log("animator script, set: " + characterState); //} if (animator.GetComponent<RomanCharState>().GetState() == RomanCharState.State.Landing) { RSUtil.Instance.DelayedAction(() => { animator.SetTrigger("Idle"); Debug.Log("FIRED"); }, 1f); } }
//public bool turnedAround; // 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) { if (!charController) charController = animator.GetComponent<SimpleCharController> (); //charController.canTurnAround = false; }
// 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) { UnityGuiView view = animator.GetComponent<UnityGuiView>(); if (view != null) { //view.OnHidden(); } }
// OnStateEnter is called before OnStateEnter is called on any state inside this state machine public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if(gun == null) gun = animator.gameObject.transform.Find("arm_gun:Bip001 R UpperArm/arm_gun:Bip001 R Forearm/arm_gun:Bip001 R Hand/Bazooka1/Spawn"); // todo use full path for faster if(bullets == null) { bullets = new GameObject[maxPool]; for(int i = 0; i < maxPool; i++) { bullets[i] = (GameObject)Instantiate(bulletPrefab); bullets[i].SetActive(false); } } for(int i = 0; i < numShots; i++) { //GameObject bullet = Instantiate(bulletPrefab, gun.position, gun.rotation) as GameObject; bullets[currentBullet].transform.position = gun.position; bullets[currentBullet].transform.rotation = gun.rotation; bullets[currentBullet].transform.Rotate(Random.Range(-15f, 15f), Random.Range(-15f, 15f), 0f); bullets[currentBullet].GetComponent<Rigidbody>().velocity = gun.TransformDirection(new Vector3(0,0,shootForce)); bullets[currentBullet].SetActive(true); if(++currentBullet >= maxPool) currentBullet = 0; } //currently bug in Unity 5 RC1 //animator.GetComponent<AudioSource>().PlayOneShot(shootClip); animator.GetComponent<AudioSource>().Play(); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Vector2 movement = animator.GetComponent<MobMotion>().PendingMovement; movement.Normalize(); animator.SetFloat(MovX, movement.x); animator.SetFloat(MovY, movement.y); }
// 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) { myBoxCollider = animator.GetComponent<PlayerController>().mySwordBoxCollider; myBoxCollider.enabled = false; animator.SetBool("Whirlwinding", false); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (_player == null) _player = animator.GetComponent<Player>(); animator.SetBool("Died", true); InputHandler.instance.enabled = false; }
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { MobMotion motion = animator.GetComponent<MobMotion>(); Vector2 movement = motion.PendingMovement; animator.SetFloat(MovX, movement.x); animator.SetFloat(MovY, movement.y); }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Enemy en = animator.GetComponent<Enemy> (); GameObject target = en.Target; Vector3 fromTo = target.transform.position - animator.transform.position; Vector3 added = fromTo.normalized * en.Speed * Time.deltaTime; added = _rotation * added; animator.transform.position += added; }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (owner == null) owner = animator.GetComponent<AIController>(); target = GameManager.Instance.Wizard.transform; owner.agent.SetDestination(target.position); }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { deathTimer += Time.deltaTime; if (deathTimer >= respawnTime) { animator.GetComponent<Character>().Death(); } }
// 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 ) { ok = false; _iteration = -1; _currentPlayer = Utils.Instance.GetPlayerByColor(animator.GetComponent<GameManager>().GetCurrentPlayer()); _currentPlayer.ResetAnim(); _currentPlayer.GetAnimator().Play("running_inPlace"); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (_enemy == null) _enemy = animator.GetComponent<Enemy>(); animator.SetBool("Died", true); _enemy.DropItems(); _enemy.Invoke("SetActiveFalse", _enemy.hideTime); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); mn = animator.GetComponent<Minion>(); mn.MyRgd.constraints = RigidbodyConstraints.None; elapsed = 0.0f; }
// 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) { m_foir = animator.GetComponent <FindObjectsInRadius>(); }
// 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) { boss = animator.GetComponent <bossController>(); atkNum = animator.GetInteger("attackNum"); boss.isAttacking = true; }
//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) { Character car = animator.GetComponent <Character>(); car.SwapToMain(); }
//bool anim_finished = false; // Start is called before the first frame update void Start() { anim.GetComponent <Animator>(); }
// 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) { pc = animator.GetComponent <PlayerController>(); pc.moveSpeed = moveSpeed; }
// 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) { player = animator.GetComponent <PlayerBase>(); player.PMovement.SetMovementEnabled(false); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { _brain = animator.GetComponent <EnemyBrainController>(); _combat = animator.GetComponent <EnemyCombatController>(); _agent = animator.GetComponent <NavMeshAgent>(); }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { _AI = animator.GetComponent <AI>(); }
// 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.GetComponent <Player>().ResetAbilities(); }
// 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) { if (GlobalControl.isPaused) { return; } animator.SetInteger("RedEnemyCurrentState", animator.GetComponent <RedEnemyAI>().STATE_WALK); if (animator.GetComponent <RedEnemyAI>().transform.localScale.x > 0) { float forceX = 0f; if (animator.GetComponent <RedEnemyAI>().redEnemyBody.velocity.x < animator.GetComponent <RedEnemyAI>().maxVelocity) { if (animator.GetComponent <RedEnemyAI>().grounded) { forceX = animator.GetComponent <RedEnemyAI>().moveForce; } else { forceX = animator.GetComponent <RedEnemyAI>().moveForce * 0.5f; } } animator.GetComponent <RedEnemyAI>().redEnemyBody.AddForce(new Vector2(forceX, 0)); } else { float forceX = 0f; if (animator.GetComponent <RedEnemyAI>().redEnemyBody.velocity.x > -animator.GetComponent <RedEnemyAI>().maxVelocity) { if (animator.GetComponent <RedEnemyAI>().grounded) { forceX = -animator.GetComponent <RedEnemyAI>().moveForce; } else { forceX = -animator.GetComponent <RedEnemyAI>().moveForce * 0.5f; } } animator.GetComponent <RedEnemyAI>().redEnemyBody.AddForce(new Vector2(forceX, 0)); } }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { BaseMonoAvatar component = animator.GetComponent <BaseMonoAvatar>(); animator.SetFloat("IdleCD", component.config.StateMachinePattern.IdleCD); }
// 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.GetComponent <Player>().Jump = true; }
// Use this for initialization void Start() { vbBtnObj = GameObject.Find("selectSphere"); vbBtnObj.GetComponent <VirtualButtonBehaviour>().RegisterEventHandler(this); cubeAni.GetComponent <Animator>(); }
public override void Update() { float lAt = AttackTimer; AttackTimer -= Time.deltaTime; RunTimer -= Time.deltaTime; if (RunTimer < 0) { RunTimer = 0; } float maxA = 3; if (Awareness > maxA) { Awareness = maxA; } if (Player != null) { if (XZSqrMagnitude(Player.position, Bdy.position) < 15 + Awareness * 15) { Awareness += Time.deltaTime * 1.5f; HearPosAcum += Player.position + Player.velocity * 0.75f; HearMod++; } } Awareness -= Time.deltaTime; if (HearMod > 0) { HearPos = HearPosAcum / HearMod; HearPosAcum = Vector3.zero; HearMod = 0; } // State = Awareness > 0.5f ? BotState.Investigate : BotState.Wander; TargetTime -= Time.deltaTime; switch (State) { case BotState.Wander: if (Awareness > 0.5f) { State = BotState.Investigate; Target = null; } else if (Awareness < 0) { Awareness = 0; } speed = WanderSpeed * (1 - Awareness); if (Target == null) { //Target = FindObjectOfType<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>().transform; if (TargetTime < -1) { if (Player == null) { var fps = FindObjectOfType <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>(); if (fps) { Player = fps.GetComponent <Rigidbody>(); } } if (Random.value > 0.65f && Player != null) { Target = Player.transform; // Seek.StartPath(transform.position, Target.position); TargetTime = Random.Range(5, 9) * 2; } else { Target = Points.GetChild(Random.Range(0, Points.childCount)); // Seek.StartPath(transform.position, Target.position); TargetTime = Random.Range(6, 18) * 20; } } } if (Target != null) { TargetPos = Target.position; if (XZSqrMagnitude(TargetPos, Bdy.position) < endReachedDistance * endReachedDistance || (TargetTime) < 0) { Target = null; TargetTime = Random.Range(-0.8f, 0); } } break; case BotState.Investigate: speed = InvestigateSpeed; if (Player != null && XZSqrMagnitude(Player.position, Bdy.position) < 10 + Awareness * 15 && RunTimer < 10) { speed *= 1.8f; RunTimer += Time.deltaTime * 3; } TargetPos = HearPos; if (Player == null) { var fps = FindObjectOfType <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>(); if (fps) { Player = GetComponent <Rigidbody>(); } } else { if (XZSqrMagnitude(Player.position, Bdy.position) < 11) { ///die if (AttackTimer < 0) { Anim.SetTrigger("Attack"); var audio = Anim.GetComponent <AudioSource>(); audio.pitch *= Random.Range(0.8f, 1.2f); audio.Play(); AttackTimer = 3; DoDamage = true; } } } if (AttackTimer > 0) { if (AttackTimer > 1.5) { speed = InvestigateSpeed * 2.5f; } else if (AttackTimer > 0.7) { speed = InvestigateSpeed * 0.5f; } if (AttackTimer < 2.3f) { if (AttackTimer > 1) { if (DoDamage && Player != null && XZSqrMagnitude(Player.position, Bdy.position) < 15) { DoDamage = false; var wg = Player.GetComponentInChildren <WaveGen>(); if (wg) { wg.Hp -= 22; } } } else { DoDamage = false; } } } else if (Awareness < -2.5f || (Awareness < 0 && XZSqrMagnitude(TargetPos, Bdy.position) < endReachedDistance * endReachedDistance)) { State = BotState.Wander; Awareness = 0; TargetTime = Random.Range(-0.8f, -0.3f); } break; } var v = Bdy.velocity; v.y = 0; Anim.SetFloat("Speed", v.magnitude / InvestigateSpeed); }
// 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 ani, AnimatorStateInfo stateInfo, int layerIndex) { ani.GetComponent <EnemyAI>().SetLoookRotation(); ani.gameObject.GetComponent <EnemyAI>().Shoot(); }
// 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.GetComponent <BoxCollider2D>().enabled = true; }
void Start() { storkBoss = anim.GetComponent <StorkBossMainScript>(); }
void Start() { AnimatorClipInfo[] animatorInfo = popupFadeAnimator.GetCurrentAnimatorClipInfo(0); Destroy(gameObject, animatorInfo [0].clip.length - 0.05f); mPopupText = popupFadeAnimator.GetComponent <Text> (); }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { characterController = animator.GetComponent <CharacterController>(); }
// 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.GetComponent <NavMeshAgent>().speed = 0; animator.GetComponent <EnemyManager>().LookAtTarget(); }
// 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) { playerPos = animator.GetComponent <Enemy>().playerPos; projectile = animator.GetComponent <Enemy>().enemyTemplate.projectileOrSummon; pooler = ObjectPooler.instance; }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { wizz = animator.GetComponent <Wizard> (); animator.SetBool("Walking", false); wizz.Attacking = true; }
void OnEnable() { AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(0); Destroy(gameObject, clipInfo[0].clip.length); damageTex = animator.GetComponent <Text>(); }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (GlobalControl.isPaused) { return; } if (animator.GetComponent <YellowEnemyAI>().transform.localScale.x > 0) { float forceX = 0f; if (animator.GetComponent <YellowEnemyAI>().YellowEnemyBody.velocity.x < animator.GetComponent <YellowEnemyAI>().maxVelocity) { if (animator.GetComponent <YellowEnemyAI>().grounded) { forceX = animator.GetComponent <YellowEnemyAI>().moveForce; } else { forceX = animator.GetComponent <YellowEnemyAI>().moveForce * 0.5f; } } animator.GetComponent <YellowEnemyAI>().YellowEnemyBody.AddForce(new Vector2(forceX, 0)); } else { float forceX = 0f; if (animator.GetComponent <YellowEnemyAI>().YellowEnemyBody.velocity.x > -animator.GetComponent <YellowEnemyAI>().maxVelocity) { if (animator.GetComponent <YellowEnemyAI>().grounded) { forceX = -animator.GetComponent <YellowEnemyAI>().moveForce; } else { forceX = -animator.GetComponent <YellowEnemyAI>().moveForce * 0.5f; } } animator.GetComponent <YellowEnemyAI>().YellowEnemyBody.AddForce(new Vector2(forceX, 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.GetComponent <PlayerController>().canMove = false; }
// 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.GetComponent <Character>().TakingDamage = true; //animator.GetComponent<Rigidbody2D>().velocity = Vector2.zero; }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { animator.GetComponent <BaseMonoAvatar>().RunBSStart(); }
public void SetDirection(Vector2 dir) { if (aiming && animator) { if (owner.movementController.armsAnimationController) { float angle = SNMovementController.Angle(dir); direction = dir; /*if (animator != null) { * animator.SetFloat ("Horizontal", dir.x); * animator.SetFloat ("Vertical", dir.y); * }*/ //Debug.Log ("angle " + angle); //angle = -(angle - 90); Quaternion newRot = Quaternion.Euler(0, 0, -(angle - 90)); SpriteRenderer rendrer = animator.GetComponent <SpriteRenderer> (); SpriteRenderer rendrer2 = rendrer; //Debug.Log ("angle2 " + angle); rendrer2 = owner.movementController.armsAnimationController.GetComponent <SpriteRenderer> (); owner.movementController.armsAnimationController.transform.parent.localRotation = newRot; if (angle >= 45 && angle < 135) { //right horizontal = true; rendrer.flipY = false; rendrer2.flipY = false; gunTransform.localPosition = owner.movementController.gunPositionR; } else if (angle >= 135 && angle < 225) { //down horizontal = false; rendrer.flipY = false; rendrer2.flipY = false; gunTransform.localPosition = owner.movementController.gunPositionD; } else if (angle >= 225 && angle < 315) { //left horizontal = true; rendrer.flipY = true; rendrer2.flipY = true; gunTransform.localPosition = owner.movementController.gunPositionL; } else if (angle >= 315) { //up horizontal = false; rendrer.flipY = false; rendrer2.flipY = false; gunTransform.localPosition = owner.movementController.gunPositionU; } else //&& angle < 45) //up { horizontal = false; rendrer.flipY = false; rendrer2.flipY = false; gunTransform.localPosition = owner.movementController.gunPositionU; } //transform.localRotation = newRot; owner.movementController.armsAnimationController.Play("Aim" + GetAnimationMode()); //SNWeapon.SetAnimationDirection (owner.movementController.animationController, dir); //animator.Play ("Hold" + GetAnimationMode ()); if (!shotProceed) { PlayAnimation("Hold" + GetAnimationMode()); } } } }
public IEnumerator ShowPopup_IEnumerator() { SoundManager.instance.SFX_GameOver(); bg.gameObject.SetActive(false); btnReplay.gameObject.SetActive(false); btnSkip.gameObject.SetActive(false); btnFreeCoin.gameObject.SetActive(false); btnChest.gameObject.SetActive(false); btnDailyReward.gameObject.SetActive(false); btnFreeHeart.gameObject.SetActive(false); btnShopCoin.gameObject.SetActive(false); btnShopSkin.gameObject.SetActive(false); ballAnimator.gameObject.SetActive(false); txtLevel.gameObject.SetActive(false); txtFailed.gameObject.SetActive(false); btnNextBallPreview.gameObject.SetActive(false); btnBackBallPreview.gameObject.SetActive(false); btnTryBallPreview.gameObject.SetActive(false); btnActiveBallPreview.gameObject.SetActive(false); btnShop.gameObject.SetActive(false); btnShopHeart.gameObject.SetActive(false); yield return(new WaitForSeconds(0.1f)); bg.gameObject.SetActive(true); bg.ShowView(); yield return(new WaitForSeconds(0.2f)); txtLevel.gameObject.SetActive(true); txtLevel.gameObject.GetComponent <BBUIView>().ShowView(); txtFailed.gameObject.SetActive(true); txtFailed.gameObject.GetComponent <BBUIView>().ShowView(); yield return(new WaitForSeconds(0.5f)); btnFreeCoin.gameObject.SetActive(true); btnFreeCoin.GetComponent <BBUIView>().ShowView(); if (Config.CheckShowStartPack()) { btnChest.gameObject.SetActive(true); btnChest.GetComponent <BBUIView>().ShowView(); } btnFreeHeart.gameObject.SetActive(true); btnFreeHeart.GetComponent <BBUIView>().ShowView(); btnShopSkin.gameObject.SetActive(true); btnShopSkin.GetComponent <BBUIView>().ShowView(); btnShopCoin.gameObject.SetActive(true); btnShopCoin.GetComponent <BBUIView>().ShowView(); btnShopHeart.gameObject.SetActive(true); btnShopHeart.GetComponent <BBUIView>().ShowView(); yield return(new WaitForSeconds(0.2f)); btnShop.gameObject.SetActive(true); btnShop.GetComponent <BBUIView>().ShowView(); yield return(new WaitForSeconds(0.2f)); ballAnimator.gameObject.SetActive(true); ballAnimator.GetComponent <BBUIView>().ShowView(); btnDailyReward.gameObject.SetActive(true); btnDailyReward.GetComponent <BBUIView>().ShowView(); btnNextBallPreview.gameObject.SetActive(true); btnNextBallPreview.GetComponent <BBUIView>().ShowView(); btnBackBallPreview.gameObject.SetActive(true); btnBackBallPreview.GetComponent <BBUIView>().ShowView(); yield return(new WaitForSeconds(0.5f)); btnSkip.gameObject.SetActive(true); btnSkip.GetComponent <BBUIView>().ShowView(); yield return(new WaitForSeconds(1f)); lockPopup.SetActive(false); yield return(new WaitForSeconds(3f)); btnReplay.gameObject.SetActive(true); btnReplay.GetComponent <BBUIView>().ShowView(); if (Config.currIDBallRescue != -1) { rescuePopup.OpenRescuePopup(); } else if (Config.CheckDailyReward()) { // dailyRewardPopup.OpenPopup(); } }
// 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.GetComponent <Character>().TakingDamage = false; }