private void SetFinal() { // Update current boss state state = BossStates.FINAL; // Reset time counter timeCounter = 0f; // Enable final damage game object finalDamage.SetActive(true); // Add final materials to current damage target materials list for (int i = 0; i < mats.Count; i++) { if (!damages.Contains(mats[i])) { damages.Add(mats[i]); } } // Apply animator punch trigger animator.SetTrigger("Damage"); #if DEBUG_BUILD // Trace debug message Debug.Log("Boss: state set to FINAL"); #endif }
private void SetDamage() { // Update current boss state state = BossStates.DAMAGE; // Reset time counter timeCounter = 0f; // Reset feedback time counter feedbackCounter = 0f; // Add spikes material to current damage target materials list damages.Add(spikeMat); // Remove all tank bosses references TankCombat tank = (TankCombat)playerChar.Combats[1] as TankCombat; for (int i = 0; i < tank.Bosses.Count; i++) { tank.Bosses.RemoveAt(i); } // Enable punch collider spikeHandColl.enabled = true; // Apply animator punch trigger animator.SetTrigger("Damage"); #if DEBUG_BUILD // Trace debug message Debug.Log("Boss: state set to DAMAGE"); #endif }
public void KillSwitch() { ResetAnim(); BossRenderer.material.SetColor("_Color", new Color(0.84f, 0, 0)); numberOfTimesHit = 5; BeetleLogic = BossStates.ATTACK; }
void HealerCool() { if (stateTimer > 3) { curState = BossStates.RapidFireAttack; } }
void MoveToPlayer(Vector3 A, Vector3 B, float _speed, bool isDashing = false) { Vector3 direction = (B - A).normalized; //gets direction direction.y = 0; //makes the AI not fly up by setting U direction to 0 Quaternion endRot = Quaternion.LookRotation(direction); //makes a quaternion for that look dir if (!isDashing) //if the beetle is NOT dashing and is just walking { if (DistanceBetween(A, B) < attackRange) //do something when the player is within attacking range { BeetleLogic = BossStates.ATTACK; //change states to attack gameTime = 0; } transform.rotation = endRot; //rotate the beetle to face the dir Vector3 offSet = transform.rotation.eulerAngles; offSet.y -= 90; transform.eulerAngles = offSet; transform.position += transform.right * Time.deltaTime * _speed; //moves the beetleforward } if (isDashing) //if however, the beetle IS dashing { transform.rotation = endRot; //set the rotation to face the position Vector3 offSet = transform.rotation.eulerAngles; offSet.y -= 90; transform.eulerAngles = offSet; transform.position += transform.right * Time.deltaTime * _speed; //move it forward if (DistanceBetween(A, B) < 2) //if the beetle reaches near it's destination (where player last was_ { DashLogic = DashStates.DASHEND; //change state to end the dash gameTime = 0; } } }
void UpdateState() { Move(); if (m_CurrentTime >= m_TimeBetweenActions) { BossStates action = (BossStates)UnityEngine.Random.Range(0, Enum.GetNames(typeof(BossStates)).Length); switch (action) { case BossStates.ATTACK_1: m_SpaceshipBehaviour.UsePrimaryInventorySlot(FireType.SINUSOIDAL); break; case BossStates.ATTACK_2: m_SpaceshipBehaviour.UsePrimaryInventorySlot(FireType.CIRCLE); break; case BossStates.ATTACK_3: m_InventoryBehaviour.SetSecondarySlot(ItemType.Missile); m_SpaceshipBehaviour.UseSecondaryInventorySlot(); break; case BossStates.INVULNERAVILITY: m_InventoryBehaviour.SetSecondarySlot(ItemType.Invulnerability); m_SpaceshipBehaviour.UseSecondaryInventorySlot(); break; } m_CurrentTime = 0; } if (!m_IsRageMode && m_SpaceshipBehaviour.m_Health <= m_MaxHealth / 2) { EnterRageMode(); } }
private void SetSpikes() { // Update current boss state state = BossStates.SPIKES; // Reset time counter timeCounter = 0f; // Remove punch material from current damage target materials list damages.Remove(punchMat); // Disable punch collider punchColl.enabled = false; // Remove all tank bosses references TankCombat tank = (TankCombat)playerChar.Combats[1] as TankCombat; for (int i = 0; i < tank.Bosses.Count; i++) { tank.Bosses.RemoveAt(i); } // Apply animator punch trigger animator.SetTrigger("Spikes"); #if DEBUG_BUILD // Trace debug message Debug.Log("Boss: state set to SPIKES"); #endif }
void Thrusting() { boost++; float currentboost = boost; JetSpeed = 2200f; rb.AddRelativeForce(Vector3.up * (JetSpeed * Time.deltaTime)); if (currentboost >= 10) { if (LeftRotationDone) { currentState = BossStates.RightRotation; LeftRotationDone = false; boost = 0; } else if (RightRotationDone) { currentState = BossStates.LeftRotation; RightRotationDone = false; boost = 0; } else { } } else { } }
void Start() { currentStates = BossStates.SHOOTING; // leftPoint.parent = rightPoint.parent = null; hitbox.SetActive(false); winPlatform.SetActive(false); }
private void TransitionToJump(string jumpingAnimation, BossStates attackState) { GetTargetLocation(); timerToTransition = minTime; enemyAnim.Play(jumpingAnimation); _bossStates = attackState; }
public void TakeHit() { currentStates = BossStates.HURT; hurtCounter = hurtTime; AudioMixerManager._instance.CallSFX(SFXType.Boss_Hit); anim.SetTrigger("Hit"); if (currentCoroutine == null) { currentCoroutine = StartCoroutine(BlinkEffect(.25f)); } BossTankMine[] mines = FindObjectsOfType <BossTankMine>(); if (mines.Length > 0) { foreach (BossTankMine foundMine in mines) { foundMine.DestroyMine(); } } BossHealth(); }
void Hurt() { animator.SetBool("EyeWide", false); if (lives == 0) { SceneManager.LoadScene("Credits", LoadSceneMode.Single); GameObject.Destroy(gameObject); } if (stateTimer < 3) { laser.enabled = false; lr.enabled = false; } else if (stateTimer < 8) { rb.isKinematic = true; rb.useGravity = false; transform.position = Vector3.Lerp(transform.position, startLoc, (stateTimer - 3) / 5.0f); transform.forward = Vector3.Lerp(transform.forward, (car.transform.position - transform.position).normalized, (stateTimer - 3) / 5.0f); } else if (lives == 2) { curState = BossStates.RapidFireAttack; } else { curState = BossStates.CreateHealers; } }
public void OnDamaged() { StopCoroutine(GreatArrowShot()); StopCoroutine(ThrowSlime()); _bossStates = BossStates.stunned; enemyAnim.SetBool("IsHurt", true); }
public void OnDamaged() { StopCoroutine(ChargeAttack()); StopCoroutine(PunchAttack()); _bossStates = BossStates.stunned; enemyAnim.SetBool("IsHurt", true); }
void Start() { rb.constraints = RigidbodyConstraints.FreezeRotation; rb.constraints = RigidbodyConstraints.FreezePositionY; currentState = new Targeting(this); SpawnEnemies(initialSpawn); }
private void UpdateStates() { if (bossState == BossStates.ENTERING) { // If hero passed the base if ((heroDirectionX > 0) && (boss.transform.position.x < basePositionX) || ((heroDirectionX < 0) && (boss.transform.position.x > basePositionX))) { // Stop moving bossRigidbody.velocity = Vector2.zero; // Fix position at base boss.transform.position = new Vector2(basePositionX, boss.transform.position.y); if (heroIsAlive) { // Set state as "firing" bossState = BossStates.FIRING; // Fire event: Boss is firing BossIsFiring?.Invoke(); //Debug.Log("boss started firing"); } } } }
private void Start() { _state = BossStates.Disabled; _props = GetComponent <BossProperties>().BossProps; _boss = Instantiate(_props.BossPrefab, transform.position, new Quaternion(), transform); AddAbilities(); }
void Update() { #if UNITY_EDITOR CurrentState = sm.currentState; #endif #region Tiempo de recuperación del estado de Derribo (Smashed) if (_remainingSmashTime > 0) { _remainingSmashTime -= Time.deltaTime; } else if (_Smashed && _remainingSmashTime <= 0) { _remainingSmashTime = 0; anims.SetBool("Smashed", false); } #endregion sight.Update(); if (LookTowardsPlayer) { transform.forward = Vector3.Lerp(transform.forward, sight.dirToTarget, _rotationLerpSpeed * Time.deltaTime); } sm.Update(); }
private void FixedUpdate() { switch (_bossStates) { case BossStates.intro: break; case BossStates.idle: break; case BossStates.moveToPlayer: Move(walkSpeed); break; case BossStates.punchAttack: enemyRB.velocity = Vector2.zero; break; case BossStates.chargeAttack: if (attackTimer <= 0) { _bossStates = BossStates.idle; } else { timerToTransition = minTime; attackTimer -= Time.fixedDeltaTime; if (!attackFired) { StartCoroutine(ChargeAttack()); } } break; case BossStates.formChangeAnim: break; case BossStates.frenzyIdle: break; case BossStates.frenzyJump: break; case BossStates.frenzySlam: break; case BossStates.frenzySlimeToss: break; case BossStates.frenzyFist: break; case BossStates.frenzyArcherAttack: break; default: break; } }
void ChangeState(float timeBeforeStateChange, BossStates nextState) { if (gameTime > timeBeforeStateChange) { BeetleLogic = nextState; gameTime = 0; } }
void SendThemToDie() { sendToPlayer = true; orbiterCounter = 0; cRestTimer = restTimer; canSeek = false; bossControl = BossStates.Rest; }
void EndMovement(bool _moveRight) { moveRight = _moveRight; currentStates = BossStates.SHOOTING; shootCounter = 0f; anim.SetTrigger("StopMoving"); FLip(); hitbox.SetActive(true); }
private void Awake() { _state = BossStates.Idle; _body = GetComponent <Rigidbody2D>(); _anim = GetComponent <Animator>(); _renderer = GetComponent <SpriteRenderer>(); _collider = GetComponent <Collider2D>(); _player = FindObjectOfType <Player>(); }
public void OnHalfHealth() { Debug.Log("Phase 2"); isFrenzy = true; enemyAnim.SetBool("Frenzy", isFrenzy); enemyAnim.Play(frenzyAnim); _bossStates = BossStates.frenzyIntro; timerToTransition = frenzyDuration; parabolaController.Speed = 20; }
void Hurt_State() { if (hurtCounter > 0) { hurtCounter -= Time.deltaTime; if (hurtCounter <= 0) { currentStates = BossStates.MOVING; mineCounter = 0; } } }
void DecideOnNextPhase1() { IdleSequence = 0; int RandomChecker = 0; RandomChecker = Random.Range(1, 100); if (RandomChecker < 50 || RandomChecker >= 50) { BossState = BossStates.DashAttack; } }
private void OnCollisionEnter(Collision collision) { if ((curState == BossStates.BeamAttack || curState == BossStates.BeamCool) && (collision.gameObject.layer == 9) && !forceField.activeSelf) { //Gets hurt rb.isKinematic = false; rb.useGravity = true; lives--; curState = BossStates.Hurt; } }
void DashAttackFunction() { DashAttackAnimTimer -= Time.deltaTime; switch (DashAttackSequence) { case 0: TargetLocationReference = PlayerObj.transform.position; DashAttackSequence = 1; if (TargetLocationReference.x < transform.position.x) { ModelParent.transform.rotation = Quaternion.Euler(0, RotationFacingLeft, 0); } else { ModelParent.transform.rotation = Quaternion.Euler(0, -RotationFacingRight, 0); } DashAttackAnimTimer = DashAttackDuration; myDoMoveSequence = DOTween.Sequence(); myDoMoveSequence.Append(transform.DOMove(TargetLocationReference, DashAttackDuration)); myDoMoveSequence.Play(); myAnim.SetInteger("Dash", 1); break; case 1: if (DashAttackAnimTimer <= 0) { DashAttackSequence = 2; } break; case 2: myAnim.SetInteger("Dash", 2); MeleeAnim.SetTrigger("Melee"); DashAttackAnimTimer = DashAttackClip.length; DashAttackSequence = 3; break; case 3: if (DashAttackAnimTimer <= 0) { MeleeAnim.SetTrigger("ResetMelee"); myAnim.SetInteger("Dash", 0); DashAttackSequence = 0; BossState = BossStates.Idle; } break; } }
private void Update() { //if (_state == BossStates.Disabled) return; // TODO re-enable once we're done testing foreach (var ability in _abilities) { if (ability.GetType().ToString() == "JumpPound" && _state == BossStates.Idle) { ability.Activate(); _state = BossStates.Jumping; } } }
private void EnemyAttackChange(float attackDuration, float transitionDelay, string attackAnim, string attackSound, BossStates attackState) { fired = false; attackTimer = attackDuration; cooldownTimer = attackDuration; timerToTransition = transitionDelay; attackFlashParticle.Play(); ChangeDirection(); enemyAnim.Play(attackAnim); audioManager.PlaySound(attackSound); _bossStates = attackState; }
public override void Attack() { switch (_currentBossState) { case BossStates.attacking: _animator.CrossFade("Attack", 0.01f); break; case BossStates.berserking: _animator.Play("Berserk"); break; case BossStates.summoning: _animator.Play("Summoning"); Vector3 summonSpots = Random.insideUnitSphere/2; summonSpots.y = transform.position.y; Instantiate(_enemyUnit, summonSpots, transform.rotation); break; } _currentBossState = (BossStates)Random.Range(0, 3); _coolDown = _coolDownSet; }
private void onStateEnter(BossStates m_state) { if (debug) { Debug.Log("Entering state" + m_state); } switch (m_state) { case BossStates.Idle: handleIdleEntered(); break; case BossStates.Charging: handleChargingEntered(); break; case BossStates.Stunned: handleStunnedEntered(); break; case BossStates.LookAround: handleLookAroundEntered(); break; } }
void StateMachine() { gameTime += Time.deltaTime; if(numberOfTimesHit == 3) { lerpTimer += Time.deltaTime; Color newCol = (Color.Lerp(originalColor, redColor, lerpTimer)); BossRenderer.material.SetColor("_Color", newCol); if(lerpTimer >1) { lerpTimer = 1; } } switch (BeetleLogic) { case BossStates.INGROUND: //???? just incase the beetle needs to do some logic here if(bNotInGround) { ChangeState(0f, BossStates.IDLE); } break; case BossStates.IDLE: attackInt = Random.value; //sets the attack int _neptoScript.shootCount = 0; //resets the shot count back to zero ResetAnim(); //BossAnim.SetBool("bIsWalking", false); ChangeState(5f, BossStates.WALKING); //after 10 seconds of idling, move to next state break; case BossStates.WALKING: //beetle walks until in range of player then it shoots MoveToPlayer(transform.position, player.position, 2f); BossAnim.SetBool("bIsWalking", true); break; case BossStates.ATTACK: BossAnim.SetBool("bIsWalking", false); //sets walking anim to OFF switch (numberOfTimesHit) //checks how many times the beetle has been hit { case 0: AttackLogic = AttackStates.AIMING; break; case 1: if(attackInt <= 0.5f) { AttackLogic = AttackStates.AIMING; } else { AttackLogic = AttackStates.DASH; } break; case 2: if (attackInt <= 0.5f) { AttackLogic = AttackStates.AIMING; } else { AttackLogic = AttackStates.DASH; } break; case 3: // BossRenderer.material.SetColor("_Color", new Color(0.84f, 0, 0)); if (attackInt <= 0.3f) { AttackLogic = AttackStates.AIMING; } else { AttackLogic = AttackStates.DASH; } break; case 4: // BossRenderer.material.SetColor("_Color", new Color(0.84f, 0, 0)); if (attackInt <= 0.3f) { AttackLogic = AttackStates.AIMING; } else { AttackLogic = AttackStates.DASH; } break; case 5: //dead BossAnim.Play("Boss_ESCAPE"); ResetAnim(); _neptoScript.enabled = false; break; } AttackStateMachine(); break; case BossStates.STUNNED: hasDeflected = false; stunTimer += Time.deltaTime; if (!isWingOpen) { beetleCollider.isTrigger = true; //you can't hit it if the wings are closed BossAnim.SetBool("bWingsClose", true); //check if has tongued if(hasTongued) { BossAnim.SetBool("bWingsClose", false); BossAnim.SetBool("bHasTongued", true); BeetleLogic = BossStates.PRYING; } else if(stunTimer > 10f) { BossAnim.SetTrigger("tStunEnd"); //stun ends BeetleLogic = BossStates.IDLE; //back to idle gameTime = 0; stunTimer = 0; BossAnim.SetBool("bHasTongued", false); } } if (isWingOpen) //if the wings are open while its stunned { beetleCollider.isTrigger = false; BossAnim.SetBool("bWingsClose", false); //set the correct boolean to play the correct animation if (hasHit) //if the player hits the beetle { BossAnim.SetBool("bWingsClose", true); beetleCollider.isTrigger = true; BossAnim.SetBool("bHasDeflected", false); stunTimer = 0; ChangeState(1f, BossStates.IDLE); hasHit = false; isWingOpen = false; } else if (stunTimer > 10f) //but if the timer exceeds { BossAnim.SetTrigger("tStunEnd"); //stun ends BeetleLogic = BossStates.IDLE; //back to idle gameTime = 0; stunTimer = 0; BossAnim.SetBool("bHasDeflected", false); } } break; case BossStates.PRYING: BossAnim.SetBool("bHasTongued", false); hasTongued = false; pryTimer += Time.deltaTime; if (GamepadManager.buttonBDown) { BossAnim.SetTrigger("tPry"); isWingOpen = true; BeetleLogic = BossStates.STUNNED; gameTime = 0; pryTimer = 0; stunTimer = 0; } else if (pryTimer > 10f) { BossAnim.SetTrigger("tPryEnd"); BeetleLogic = BossStates.IDLE; gameTime = 0; pryTimer = 0; } break; case BossStates.HIT: break; case BossStates.DEATH: break; } }
void ChangeState(float timeBeforeStateChange, BossStates nextState) { if(gameTime > timeBeforeStateChange) { BeetleLogic = nextState; gameTime = 0; } }
void MoveToPlayer(Vector3 A, Vector3 B,float _speed, bool isDashing = false) { Vector3 direction = (B - A).normalized; //gets direction direction.y = 0; //makes the AI not fly up by setting U direction to 0 Quaternion endRot = Quaternion.LookRotation(direction); //makes a quaternion for that look dir if(!isDashing) //if the beetle is NOT dashing and is just walking { if (DistanceBetween(A, B) < attackRange) //do something when the player is within attacking range { BeetleLogic = BossStates.ATTACK; //change states to attack gameTime = 0; } transform.rotation = endRot; //rotate the beetle to face the dir Vector3 offSet = transform.rotation.eulerAngles; offSet.y -= 90; transform.eulerAngles = offSet; transform.position += transform.right * Time.deltaTime * _speed; //moves the beetleforward } if(isDashing) //if however, the beetle IS dashing { transform.rotation = endRot; //set the rotation to face the position Vector3 offSet = transform.rotation.eulerAngles; offSet.y -= 90; transform.eulerAngles = offSet; transform.position += transform.right * Time.deltaTime * _speed; //move it forward if (DistanceBetween(A,B)< 2) //if the beetle reaches near it's destination (where player last was_ { DashLogic = DashStates.DASHEND; //change state to end the dash gameTime = 0; } } }
void AttackStateMachine() { BossAnim.SetBool("bIsAttacking", true); switch (AttackLogic) { case AttackStates.AIMING: _neptoScript.range = 20; BossAnim.SetInteger("iAttack", 0); //sets animator to this anim //aiming logic goes here _neptoScript.beetleControl = false; //gives control back to nepto if(hasDeflected) //if player deflected { _neptoScript.range = 5; BossAnim.SetBool("bHasDeflected", true); ChangeState(0f, BossStates.STUNNED); //change state to stunned _neptoScript.beetleControl = true; //gives control back to beetle, disabling the nepto _neptoScript.shootCount = 0; //resets the shot count back to zero BossAnim.SetBool("bIsAttacking", false); //stops attacking animation from playing } if(_neptoScript.shootCount == 4) //if the nepto has shot thrice, regardless of whether you deflected or not { _neptoScript.range = 5; BossAnim.SetBool("bIsAttacking", false); //stops attacking animation from playing _neptoScript.beetleControl = true;//gives control back to the beetle first ChangeState(3f, BossStates.IDLE); //go back to idle after 2 seconds (to allow player time to deflect } break; case AttackStates.DASH: BossAnim.SetInteger("iAttack", 1); //AI deshing goes here attackTime += Time.deltaTime; switch (DashLogic) { case DashStates.CHARGEUP: MoveToPlayer(transform.position, player.position, 0); //makes the beetle only face gulnaz if(attackTime > 3f) { BossAnim.SetTrigger("tCharge"); lastPos = player.position; attackTime = 0; DashLogic = DashStates.DASH; } break; case DashStates.DASH: MoveToPlayer(transform.position, lastPos, 5,true); break; case DashStates.DASHEND: BossAnim.SetTrigger("tDashEnd"); BossAnim.SetBool("bIsAttacking", false); BeetleLogic = BossStates.IDLE; gameTime = 0; DashLogic = DashStates.CHARGEUP; attackTime = 0; break; } break; } }
public void SetStateToChase() { bState = BossStates.Chase; }
void ToAttack() { // trigger reboot-->attack animation here bossState = BossStates.Attack; }
void ToReboot() { // trigger wounded-->reboot animation here bossState = BossStates.Reboot; }
void ToWounded() { // trigger attack-->wounded animation here bossState = BossStates.Wounded; }
public void ChangeState(BossStates newState) { onStateExit(m_state); m_state = newState; onStateEnter(m_state); }
void SetState(BossStates state) { this.state = state; switch (this.state) { case BossStates.Spawn: rigidbody.useGravity = true; rigidbody.isKinematic = false; Camera.main.audio.clip = Resources.Load("Music/boss-music") as AudioClip; Camera.main.audio.Play(); break; case BossStates.Roar: rigidbody.isKinematic = true; targetRoarSize = roarMaxSize; audio.PlayOneShot(roarClip); break; case BossStates.Target: rigidbody.isKinematic = false; float p1Dist = Vector3.Distance(playerOne.transform.position, transform.position); float p2Dist = Vector3.Distance(playerTwo.transform.position, transform.position); currentTarget = (p1Dist < p2Dist) ? playerOne.transform : playerTwo.transform; actionTimer = targetingTime; break; case BossStates.Chase: rigidbody.isKinematic = false; actionTimer = chaseTime; break; case BossStates.Jump: rigidbody.useGravity = false; rigidbody.isKinematic = true; currentVectorTarget = new Vector3(currentTarget.position.x, currentTarget.position.y, currentTarget.position.z); currentVectorTarget.y += 15.0f; break; case BossStates.Hover: actionTimer = 0.25f; break; case BossStates.Slam: rigidbody.useGravity = true; rigidbody.isKinematic = false; break; case BossStates.Dead: Camera.main.audio.clip = Resources.Load("Music/victory") as AudioClip; Camera.main.audio.Play(); Camera.main.SendMessage("ActivateWin"); Destroy(gameObject); break; } }
// Use this for initialization void Start() { bossState = BossStates.Attack; power = 10; gm = GameObject.Find("GameManager").GetComponent<GameManager>(); }
public void SetStateToRaiseZombies() { bState = BossStates.RaiseZombies; RZ.BeginRaisingZombies(); }
public void SetStateToDead() { bState = BossStates.Dead; }