Example #1
0
    /// <summary>
    /// Attack logic of the boss.
    /// </summary>
    /// <param name="e">Boss reference</param>
    protected override void AttackPlayer(BossEnemy e)
    {
        // Attack only if allowed.
        if (attackAllowed && !attackStarted)
        {
            //Play animation.
            Animator anim = e.GetComponent <Animator>();

            if (anim != null)
            {
                anim.SetTrigger("Special");
            }

            attackStarted = true;

            // Spawn meteorits
            CreateMeteorField(e);

            attackAllowed = false;
        }


        // Timer logic.
        if (currentAttackTimer >= e.RangedAttackInterval)
        {
            attackAllowed      = true;
            currentAttackTimer = 0f;
        }

        // Increase attack timer.
        currentAttackTimer += Time.deltaTime;
    }
Example #2
0
    private void Spawn(EnemyType type)
    {
        GameObject en = Random.value <= 0.5f ? Instantiate(currentEnemyType, spawnPositionLeft, this.transform.rotation, this.transform):
                        Instantiate(currentEnemyType, spawnPositionRight, this.transform.rotation, this.transform);

        float movementDifficulty = baseMovementSpeed + 0.3f * currentDifficulty;

        if (type == EnemyType.Boss)
        {
            BossEnemy be = en.AddComponent <BossEnemy>();
            be.SetValues(5, baseMovementSpeed);
            be.SetChargePosition(chargePositionL, chargePositionR);
        }
        else if (type == EnemyType.Smart)
        {
            SmartEnemy se = en.AddComponent <SmartEnemy>();
            se.SetValues(3, GaussianRandom(movementDifficulty, 0.90f));
            se.SetColor(smartEnemyColor);
        }
        else
        {
            MinionEnemy me = en.AddComponent <MinionEnemy>();
            me.SetValues(1, GaussianRandom(movementDifficulty, 0.90f));
        }
    }
Example #3
0
    /// <summary>
    /// Attack logic of the boss.
    /// </summary>
    /// <param name="e">Boss reference</param>
    protected virtual void AttackPlayer(BossEnemy e)
    {
        // Attack only if allowed.
        if (attackAllowed && !attackStarted)
        {
            //Debug.Log("Attack!!! Pew Pew Pew!");

            //Play animation.
            Animator anim = e.GetComponent <Animator>();

            if (anim != null)
            {
                anim.SetTrigger("Melee");
            }

            attackStarted = true;

            GameObject areaOfDamageReference = GameObject.Instantiate(e.MeleeAreaOfDamage, e.TargetPlayer.position, e.MeleeAreaOfDamage.transform.rotation) as GameObject;
            areaOfDamageReference.GetComponent <BossMeleeScript>().InitMeleeScript(e.AreoOfDamageRadius, e.AreaOfDamageTime, e, e.MeleeAttackDamage);

            attackAllowed = false;
        }

        // Timer logic.
        if (currentAttackTimer >= e.AttackInterval)
        {
            attackAllowed      = true;
            currentAttackTimer = 0f;
        }

        // Increase attack timer.
        currentAttackTimer += Time.deltaTime;
    }
Example #4
0
    public override void OnStateEnter(Transform player, GameObject self)
    {
        stateMachine = self.GetComponent <BossEnemy>();
        stateMachine.timeSinceWallSpawn = 0;
        behaviorComplete = false;

        int activeWallCounter = 0;

        foreach (var wall in wallList)
        {
            if (wall.isActive)
            {
                activeWallCounter++;
            }
        }

        if (activeWallCounter <= wallResetThreshold)
        {
            //Put animation trigger here once we have an animation
            foreach (var wall in wallList)
            {
                if (!wall.isActive)
                {
                    wall.Enable();
                }
            }
        }

        behaviorComplete = true;
    }
Example #5
0
        public void AtkSpecialRight()
        {
            var boss = new BossEnemy();

            //son valores double , el tercer parametro es la especificacion de los decimales
            Assert.AreEqual(166.6, boss.SpecialAttackPower, 0.07);
        }
        private void DisposeBoss(Vector3 position)
        {
            EnemyList = new List <GameObject>();
            EnemyList.Add(ObjectPoolManager.Instance.EnemyObjectPool.PopBossObject());
            BossEnemy bossenemyScript = EnemyList[0].GetComponent <BossEnemy>();

            switch (BossCount)
            {
            case 0:
                bossenemyScript.SetStatus(100, 10, false);
                bossenemyScript.SetType(false);
                break;

            case 1:
                bossenemyScript.SetStatus(150, 15, false);
                bossenemyScript.SetType(false);
                break;

            case 2:
                bossenemyScript.SetStatus(200, 25, true);
                bossenemyScript.SetType(true);
                break;
            }
            BossCount++;
        }
Example #7
0
    /// <summary>
    /// Attacks the player.
    /// </summary>
    /// <param name="e">Boss enemy reference.</param>
    protected void AttackPlayer(BossEnemy e)
    {
        MonoBehaviour m = e.TargetPlayer.GetComponent <MonoBehaviour>();

        if (m is BasePlayer)
        {
            BasePlayer p = (BasePlayer)m;

            // Take Damage
            p.TakeDamage(e.MeleeAttackDamage, e);

            // Camera shake
            CameraManager.CameraReference.ShakeOnce();

            // Add force to the player.
            Rigidbody rigid = p.GetComponent <Rigidbody>();

            if (rigid != null)
            {
                // Add attack force.
                rigid.AddExplosionForce(e.PushAwayForce, e.transform.position, e.AttackRange * 1.5f, 0f, ForceMode.Impulse);
            }

            // Reset current damage counter of the boss.
            e.SprintPhase.currentDamage = 0;
            attackFinished = true;
        }
    }
Example #8
0
        public void HaveCorrectPower()
        {
            output.WriteLine("Test Demo");
            BossEnemy sut = new BossEnemy();

            Assert.Equal(166.667, sut.TotalSpecialAttackPower, 3);
        }
 new void Awake()
 {
     base.Awake();
     //取得
     _attack = GetComponent <LarvaAttack>();
     _boss   = GetComponent <BossEnemy>();
 }
        public void HaveCorrectPower()
        {
            outputHelper.WriteLine("Creating Boss Enemy");
            BossEnemy sut = new BossEnemy();

            Assert.Equal(166.667, sut.TotalSpecialAttackPower, 3);
        }
Example #11
0
        public void HaveCorrectPower()
        {
            _output.WriteLine("Creating Boss Enemy");
            var sut = new BossEnemy();

            Assert.Equal(166.667, sut.SpecialAttackPower, 3);
        }
Example #12
0
 public void Spawn(OnAllEnemiesDestroyedDelegate onAllEnemiesDestroyedDelegate)
 {
     _onAllEnemiesDestroyedDelegate = onAllEnemiesDestroyedDelegate;
     _boss = SpawnManager.Instance.CreateBossEnemy();
     _boss.SetDeathDelegate(OnEnemyDeath);
     _boss.enabled = false;
 }
Example #13
0
    private void GetBoss(Collider other)
    {
        BossEnemy bossEnemy = other.gameObject.GetComponent <BossEnemy>();

        if (bossEnemy.isDie)
        {
            return;
        }

        if (enemyColor == _bulletColor)
        {
            if (bossEnemy.counterShoot > 1)
            {
                bossEnemy.GetShoot();
            }
            else
            {
                bossEnemy.Colored();
                if (isLast)
                {
                    bossEnemy.gm.targetCamera.SetReturn();
                }
                other.gameObject.GetComponent <BoxCollider>().enabled = false;
            }
        }
        else
        {
            bossEnemy.SetBlood(_bulletColor, false);
        }
    }
Example #14
0
        public void HaveCorrectPower()
        {
            BossEnemy sut   = new BossEnemy();
            var       power = sut.SpecialAttackPower;

            Assert.Equal(166.667, power, 3);
        }
Example #15
0
    /// <summary>
    /// Actions of the State.
    /// </summary>
    /// <param name="player">Player reference</param>
    /// <param name="npc">NPC reference</param>
    public override void Act(GameObject player, GameObject npc)
    {
        // Reset navigation settings. =========================
        NavMeshAgent agent = npc.GetComponent <NavMeshAgent>();

        if (player != null && agent.enabled)
        {
            agent.updateRotation = true;
            agent.Resume();
            agent.SetDestination(player.transform.position);
        }
        // ===================================================

        MonoBehaviour m = npc.GetComponent <MonoBehaviour>();

        if (m != null && m is BossEnemy)
        {
            BossEnemy e = (BossEnemy)m;

            //Play animation.
            Animator anim = e.GetComponent <Animator>();

            if (anim != null)
            {
                anim.SetTrigger("Sprint");
            }

            if (CheckAttackRange(e))
            {
                AttackPlayer(e);
            }
        }
    }
Example #16
0
    /// <summary>
    /// Spawns an enemy in the range of the boss.
    /// </summary>
    /// <param name="e">Boss enemy</param>
    protected virtual void SpawnMob(BossEnemy e)
    {
        if (currentMobSpawnTimer >= e.MobSpawnPhase.spawnInterval)
        {
            //Play animation.
            Animator anim = e.GetComponent <Animator>();

            if (anim != null)
            {
                anim.SetTrigger("Special");
            }

            Vector2 randomCirclePoint = UnityEngine.Random.insideUnitCircle * e.MobSpawnPhase.spawnRadius
                                        + new Vector2(e.transform.position.x, e.transform.position.z);

            Vector3 spawnPosition = new Vector3(randomCirclePoint.x, e.transform.position.y, randomCirclePoint.y);

            NavMeshHit hit;
            bool       posFound = NavMesh.SamplePosition(spawnPosition, out hit, 5f, NavMesh.AllAreas);

            if (posFound)
            {
                GameObject mob = GameObject.Instantiate(e.MobSpawnPhase.mobPrefab) as GameObject;
                mob.SetActive(false);
                mob.transform.position = hit.position;
                mob.SetActive(true);
            }

            // Reset timer
            currentMobSpawnTimer = 0f;
        }

        // Increase mob timer
        currentMobSpawnTimer += Time.deltaTime;
    }
Example #17
0
    /// <summary>
    /// Attack logic of the boss.
    /// </summary>
    /// <param name="e">Boss reference</param>
    protected override void AttackPlayer(BossEnemy e)
    {
        // Attack only if allowed.
        if (attackAllowed && !attackStarted)
        {
            //Debug.Log("RangedBoss: Attack!");

            //Play animation.
            Animator anim = e.GetComponent <Animator>();

            if (anim != null)
            {
                anim.SetTrigger("Shoot");
            }

            attackStarted = true;
            // Spawn bullet
            CreateBullet(e);
            attackAllowed = false;
        }


        // Timer logic.
        if (currentAttackTimer >= e.RangedAttackInterval)
        {
            attackAllowed      = true;
            currentAttackTimer = 0f;
        }

        // Increase attack timer.
        currentAttackTimer += Time.deltaTime;
    }
    private void Attack()
    {
        RaycastHit hit;

        var layerMask = 1 << 11; // Bit shifts the index of layer 11 (Player layer) to get bit mask

        layerMask = ~layerMask;  // We invert it using the ~ sign so that we can collide with everything EXCEPT Layer 11 which is the player.
                                 // This is so that we don't shoot ourselves.

        if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out hit, attackRange, layerMask))
        {
            if (hit.collider.tag == "Enemy")
            {
                Debug.Log("OUCH");
                enemy = hit.collider.transform.GetComponent <Enemy>();
                enemy.TakeDamage(damage);
            }
            if (hit.collider.tag == "Boss")
            {
                Debug.Log("OUCH");
                boss = hit.collider.transform.GetComponent <BossEnemy>();
                boss.TakeDamage(damage);
            }
        }
    }
        public void Should_Be_BossEnemy_When_IsBoss_True_And_Return_Correct_Name()
        {
            Enemy     enemy     = _sut.Create("Zombie King", true);
            BossEnemy bossEnemy = Assert.IsType <BossEnemy>(enemy);

            Assert.Equal("Zombie King", bossEnemy.Name);
        }
Example #20
0
        public void HaveCorrectPower()
        {
            _testOutputHelper.WriteLine("Creating Boss Enemy");
            var sut = new BossEnemy();

            Assert.Equal(166.667, sut.TotalSpecialAttackPower, precision: 3);
        }
Example #21
0
    void Update()
    {
        WaveManager();
        if (WaveTime >= 0)
        {
            timetext.text = "Time: " + (int)WaveTime;
        }
        else
        {
            timetext.text = "Time: " + (int)WaveDownTime;
        }

        if (Hero.S.health >= 0)
        {
            healthtext.text = "Health: " + Hero.S.health;
        }
        else
        {
            healthtext.text = "Health: 0";
        }
        scoretext.text = "Score: " + score;
        if (isBoss == true)
        {
            bossObject    = GameObject.FindWithTag("Boss");
            bossMAIN      = bossObject.GetComponent <BossEnemy>();
            Bosstext.text = "Boss: " + (int)bossMAIN.health;
        }
        else
        {
            Bosstext.text = " ";
        }
    }
Example #22
0
    private IEnumerator Poisoned_Damaged_Boss_Cor()
    {
        BossEnemy _boss = GetComponent <BossEnemy>();

        if (_boss == null)
        {
            yield break;
        }

        //フラグの変更
        is_Poisoned = true;

        //ダメージの計算
        int damage = POISON_DAMAGE_BOSS;

        if (CollectionManager.Instance.Is_Collected("Medicine"))
        {
            damage += POISON_DAMAGE_POWER_UP;
        }
        //ダメージを与える
        for (int i = 0; i < damage; i++)
        {
            _boss.Damaged(1, "Poison");
            yield return(new WaitForSeconds(0.4f));
        }

        is_Poisoned = false;
        if (Compare_Color(_sprite.color, poisoned_Color))
        {
            _sprite.color = default_Color;
        }
    }
Example #23
0
 /// <summary>
 /// Announces the boss wave.
 /// </summary>
 protected void AnnounceBossWave(BossEnemy boss)
 {
     if (bossWave != null)
     {
         bossWave.PlayRandomClip();
     }
 }
Example #24
0
    /// <summary>
    /// Decreases the enemy count.
    /// </summary>
    protected void BossDied(BossEnemy e)
    {
        try
        {
            MonoBehaviour m = bossSpawnInfo.boss.GetComponent <MonoBehaviour>();

            if (m != null && m is BossEnemy && e != null)
            {
                BossEnemy b = m as BossEnemy;

                // Add the ressource value if the name is equal.
                if (b.EnemyName == e.EnemyName)
                {
                    accumulatedRessourceValue += BossSpawnInfo.enemyRessourceValue;
                }
            }
            else if (e == null)
            {
                // Add the ressource also if the incoming boss is null -> the boss may be destroyed in a bad constellation
                accumulatedRessourceValue += bossSpawnInfo.enemyRessourceValue;
            }
        }
        catch (Exception exception)
        {
            // Add the ressource also if the incoming boss is null -> the boss may be destroyed in a bad constellation
            accumulatedRessourceValue += bossSpawnInfo.enemyRessourceValue;
            Debug.Log("<color='ff0000'>Boss exception: </color>" + exception.ToString());
        }

        CurrentEnemyCount--;
    }
Example #25
0
        public void BossShouldHitCriticaly()
        {
            _output.WriteLine("Creating Boss Enemy");
            BossEnemy sut = new BossEnemy();
            var       SpecialAttackRound = sut.TotalSpecialAttackPower;

            Assert.Equal(166.7, Math.Round(SpecialAttackRound, 1));
        }
 public void SetBoss(BossEnemy boss)
 {
     gameObject.SetActive(true);
     currentBoss = boss;
     bossHealthbar.InitHealthbar(currentBoss);
     bossHealthbar.SetHealth(currentBoss.mHealth);
     bossName.text = currentBoss.entityName;
 }
 void Awake()
 {
     _boss_Enemy = GetComponent <BossEnemy>();
     //ダメージ量変更
     damaged_Tag_Dictionary["PlayerAttackTag"]       = 20;
     damaged_Tag_Dictionary["PlayerKickTag"]         = 20;
     damaged_Tag_Dictionary["PlayerChargeAttackTag"] = 28;
 }
 private void Start()
 {
     enemyRB   = GetComponent <Rigidbody2D>();
     enemyAnim = GetComponent <Animator>();
     // timeBtwShots = startTimeBtwShots;
     player = GameManager.Instance.player.transform;
     HP     = GetComponent <BossEnemy>();
 }
                 public void CreateBossEnemy_CastReturnedType()
 
     {EnemyFactory sut=new EnemyFactory();
         Enemy enemy=sut.Create("Zombie King",true);
        BossEnemy boss= Assert.IsType<BossEnemy>(enemy);
        Assert.Equal("Zombie King",boss.Name);
         
     }
        public void ShouldCreateBossEnemy_Cast()
        {
            var sut = new EnemyFactory();

            object enemy = sut.Create(true);

            BossEnemy bossEnemy = Assert.IsType <BossEnemy>(enemy);
        }
Example #31
0
 void Awake()
 {
     //Find Parent Enemy Component
     bossParent = transform.root.GetComponent<BossEnemy>();
     if(bossParent == null) Debug.LogError("No enemy parent found!");
 }