示例#1
0
    public void Tick()
    {
        dashTimer += Time.deltaTime;

        if (dashTimer <= _sheep.DashChargeTime)
        {
            _rb.velocity = new Vector2(0f, 0f);
        }
        else if ((dashTimer > _sheep.DashChargeTime) && (dashTimer <= _sheep.DashChargeTime + _sheep.DashTime))
        {
            CinemachineImpulseManager.Play("Weak Impulse");
            if (!hasDashed)
            {
                AudioManager.Instance.Play("Stampede");
                _sheep.StartCoroutine(_sheep.SpawnDashTrail());
                attackDirection         = (GameManager.GetMainPlayerRb().position - _rb.position).normalized;
                hasDashed               = true;
                _sheep.dashHitboxActive = true;
                _rb.velocity            = _sheep.DashSpeed * attackDirection;
            }
        }
        else if (dashTimer > _sheep.DashChargeTime + _sheep.DashTime)         // If done charging and dashing
        {
            AudioManager.Instance.Stop("Stampede");
            _sheep.isDashing        = false;
            _sheep.dashHitboxActive = false;

            if (_sheep.curPhase == 1)
            {
                _sheep.nextState = SheepBossStatesEnum.SheepProjectiling;                 // Transition into projectile after dashing
            }
        }
    }
    public void OnEnter()
    {
        _sheep.curPhase = 2;

        // Transition to phase 2
        _sheep.angryVeinParticle.SetActive(true);
        AudioManager.Instance.Play("SheepAngry");
        CinemachineImpulseManager.Play("Extra Strong Impulse");

        _sheep.ChangeColorToRed();

        _sheep.nextState = SheepBossStatesEnum.SheepLaunchingExplodingSheep;
    }
示例#3
0
    // Checks if player is invulnerable. If not, reduces health by damageAmount.
    public void TakeDamage(int damageAmount)
    {
        if (Time.time - prevDamageTime > DamageInvulnDuration)         // checking if invulnerability time is up
        {
            AudioManager.Instance.PlayPitch("Hurt", UnityEngine.Random.Range(1.5f, 2f));
            CinemachineImpulseManager.Play("Strong Impulse");
            WhiteFlashManager.FlashWhite(gameObject);

            prevDamageTime = Time.time;
            health        -= damageAmount;
        }
        if (health < 0)
        {
            health = 0;
        }
    }
示例#4
0
    protected override void Die()
    {
        isDead = true;
        ChangeColorToWhite();
        StartCoroutine(SpawnDashTrail());
        AudioManager.Instance.Play("SheepAngry");
        AudioManager.Instance.Stop("Stampede");
        CinemachineImpulseManager.Play("Extra Strong Impulse");
        _animator.SetTrigger("die");
        _rb.velocity = new Vector2(0f, 0f);
        GetComponent <Collider2D>().enabled = false;        // disable collisions
        woolBallParticle.SetActive(true);
        angryVeinParticle.SetActive(false);
        Destroy(transform.GetChild(0).gameObject);                               // Destroy healthbar

        GameManager.GetMainPlayer().GetComponent <Collider2D>().enabled = false; // Disable player hitbox

        UIManager.Instance.Invoke("ActivateVictoryScreen", 5f);
    }
示例#5
0
    public void Tick()
    {
        attackTimer += Time.deltaTime;

        if (attackTimer <= _sheep.ScatterProjectileChargeTime)
        {
            _rb.velocity = new Vector2(0f, 0f);
        }
        else if (attackTimer > _sheep.ScatterProjectileChargeTime && attackTimer <= _sheep.ScatterProjectileAnimationTime)
        {
            if (!hasFired)
            {
                CinemachineImpulseManager.Play("Strong Impulse");
                AudioManager.Instance.PlayPitch("Sheep1", 1f);
                hasFired = true;

                _sheep.LaunchProjectilesScatter();
            }
        }
        else if (attackTimer > _sheep.ScatterProjectileAnimationTime)         // Once animation has ended, exit this state
        {
            _sheep.isProjectiling = false;
        }
    }
示例#6
0
 private void Awake()
 {
     CinemachineImpulseManager.Play("Weak Impulse");
     AudioManager.Instance.PlayOneShot("Explosion");
     ps = GetComponent <ParticleSystem>();
 }