Exemple #1
0
    protected override void Awake()
    {
        base.Awake();
        baddieType   = EnemyConstants.EnemyTypes.Boss;
        damage       = 20;
        health       = 5000;
        maxHealth    = 5000;
        chaseTimer   = 0;
        shuffleTimer = 0;
        spawnTimer   = 0;
        state        = BossStates.Chase;
        GetComponent <SpriteRenderer>().color = new Color(.85f, .185f, .194f);

        actions = new EnemyActions(player, gameObject);
        actions.SetDetectionDistance(50);
    }
Exemple #2
0
    protected override Vector2 bossMoves()
    {
        switch (state)
        {
        case BossStates.Shuffle:
            if (shuffleTimer >= shuffleTimerMax)
            {
                shuffleTimer = 0;
                actions.MeleeAttack(12, 8);
                print("Get Random Attack");
                //state = BossStates.ChangeType;
                state = (BossStates)getRandomAttack();
                randomSpawn();
                print("State: " + state);
                break;
            }
            shuffleTimer += Time.deltaTime;
            return(transform.position);

        case BossStates.Chase:
            actions.SetDetectionDistance(50);
            if (chaseTimer >= chaseTimerMax)
            {
                chaseTimer = 0;
                actions.MeleeAttack(12, 8);
                print("attack!");
                state = BossStates.Shuffle;
                break;
            }
            chaseTimer += Time.deltaTime;
            return(actions.DetectAndChase(transform.position, player.transform.position, 4));

        case BossStates.Shoot:
            if (shootTimer <= shootTimerMax)
            {
                actions.bossFireGun();
            }
            else
            {
                shootTimer = 0;
                state      = BossStates.Shuffle;
                break;
            }
            shootTimer += Time.deltaTime;
            return(actions.DetectAndChase(transform.position, player.transform.position, 4));

        case BossStates.Smash:
            if (smashTimer >= smashTimerMax)
            {
                smashTimer = 0;
                actions.MeleeAttack(12, 8);
                state = BossStates.Shuffle;
            }
            smashTimer += Time.deltaTime;
            return(transform.position);

        case BossStates.ChangeType:
            weakness = (WeaponController.EnergyTypes)getRandomType();
            switch (weakness)
            {
            case WeaponController.EnergyTypes.Fire:
                GetComponent <SpriteRenderer>().color = new Color(.85f, .185f, .194f);
                break;

            case WeaponController.EnergyTypes.Electric:
                GetComponent <SpriteRenderer>().color = new Color(1f, 0.84f, 0.07f);
                break;

            case WeaponController.EnergyTypes.Freeze:
                GetComponent <SpriteRenderer>().color = new Color(0f, 0.8f, 1f);
                break;

            case WeaponController.EnergyTypes.Kinetic:
                GetComponent <SpriteRenderer>().color = new Color(0.39f, 1f, 0.51f);
                break;

            case WeaponController.EnergyTypes.Explosion:
                GetComponent <SpriteRenderer>().color = Color.grey;
                break;
            }
            state = BossStates.Shuffle;
            break;

        case BossStates.Spawn:
            if (spawnTimer >= spawnTimerMax)
            {
                spawnTimer = 0;
                randomSpawn();
                state = BossStates.Shuffle;
            }
            spawnTimer += Time.deltaTime;
            break;

        default:
            break;
        }
        return(transform.position);
    }