public BossForm GetRandomBoss()
    {
        int      index = Random.Range(0, bossForms.Count);
        BossForm form  = bossForms[index];

        return(form);
    }
示例#2
0
        public FirstBossBehavior(Actor actor, Player player) : base(actor, player, 0.1f)
        {
            actor.velocity = new Vector2(0, 0.1f);
            this.target    = player;
            Vector2 lastTurn = actor.position;

            bossForm = BossForm.first;
        }
示例#3
0
    //===
    public void Create(BossForm form, Vector3 spawnPos)
    {
        ApplyForm(form);
        respawnCooltimer = RespawnCooltime;
        isAlive          = true;

        this.spawnPos      = spawnPos;
        transform.position = spawnPos;
    }
示例#4
0
    void Reroll()
    {
        GameManager.Instance.playerData.gem -= reroll_cost_gem;
        rerollCount += 1;

        currentBossForm = nextBossForm;
        nextBossForm    = DataHandler.Instance.GetRandomBoss();

        UpdateUI();
        AudioHandler.Instance.PlaySFX(AudioHandler.Instance.sfxFolder[0]);
        GameManager.Instance.SaveGame();
    }
    public void Build()
    {
        Room     room = GetComponent <Room>();
        BossForm form = BossUpgrade.currentBossForm;
        Boss     boss = Instantiate(DataHandler.Instance.bossPrefab);

        boss.transform.SetParent(transform);
        Vector3 pos = room.roomCollider.bounds.center + new Vector3(spawnOffset_x, 0, 0);

        boss.Create(form, pos);

        this.boss = boss;
    }
示例#6
0
    //===
    void PurchaseBoss()
    {
        GameManager.Instance.playerData.gold -= bossPurchaseCost;
        GameManager.Instance.playerData.bossPurchaseCount += 1;

        UIHandler.Instance.floorBuilder.SetActiveBossButton(true);

        currentBossForm = nextBossForm;
        nextBossForm    = DataHandler.Instance.GetRandomBoss();

        UpdateUI();
        AudioHandler.Instance.PlaySFX(AudioHandler.Instance.sfxFolder[0]);
        GameManager.Instance.SaveGame();
    }
示例#7
0
    void ApplyForm(BossForm form)
    {
        this.form = form;
        maxHp     = form.hp * EnhancedRate;
        hp        = maxHp;
        hpBar.UpdateBar(hp, maxHp);
        damage = form.damage * EnhancedRate;

        spellCooltimer = form.spellCooltime * SpellCooltimeRate;

        splashDamage.SetScale(form.damageRadiusScale);
        renderer.sprite = form.sprite;
        gameObject.AddComponent <BoxCollider2D>();

        StartCoroutine(thr_healthRegen());
        StartCoroutine(thr_bossSpell());
        DataHandler.Instance.playerBosses.Add(this);
        if (DataHandler.Instance.dataUpdated != null)
        {
            DataHandler.Instance.dataUpdated();
        }
    }
示例#8
0
    void Load()
    {
        if (GameManager.Instance.playerData.isNewBegin)
        {
            currentBossForm = null;
            nextBossForm    = DataHandler.Instance.GetRandomBoss();
            rerollCount     = 0;
            return;
        }

        string value = PlayerPrefs.GetString("BossUpgrade");

        value = value.Trim(new char[] { '(', ')' });
        value = value.Replace(" ", "");
        string[] values = value.Split(',');
        Boss.EnhancedRate          = float.Parse(values[0]);
        Boss.RespawnCooltime       = float.Parse(values[1]);
        Boss.HealthRegenPercentage = float.Parse(values[2]);

        currentBossForm = DataHandler.Instance.GetBossForm(PlayerPrefs.GetString("CurrentBossForm_Id"));
        nextBossForm    = DataHandler.Instance.GetBossForm(PlayerPrefs.GetString("NextBossForm_Id"));

        rerollCount = PlayerPrefs.GetInt("BossRerollCount");
    }
示例#9
0
        public override void run()
        {
            if (target != null && target.world.hasLineOfSight(target.position, actor.position, false) && (actor.world as GameWorld).bossTriggered)
            {
                Vector2 dest = target.position - actor.position;
                if ((actor as ILife).life.life > 1500)
                {
                    bossForm = BossForm.first;

                    if (delay > 0)
                    {
                        delay--;
                    }
                    else
                    {
                        delay = 35 + (int)Math.Round(actor.world.tileEngine.randGen.NextDouble() * delaytime);
                        if (Math.Abs(dest.X) < Math.Abs(dest.Y))
                        {
                            this.direction = new Vector2(0, dest.Y);
                        }
                        else
                        {
                            this.direction = new Vector2(dest.X, 0);
                        }
                        this.direction.Normalize();
                    }
                    actor.force += this.direction * .5f;

                    int frame = Actor.indexFromDirection(this.direction, 4, .25f);
                    actor.anim = (actor as FirstBoss).moveAnimation[(int)bossForm][frame];
                }
                else if ((actor as ILife).life.life > 1000)
                {
                    bossForm = BossForm.second;

                    delay--;
                    if (delay > 75)
                    {
                    }
                    else
                    {
                        actor.force += dest * .003f;
                    }
                    if (delay < 0)
                    {
                        delay = 150;
                    }
                    if (Math.Abs(dest.X) < Math.Abs(dest.Y))
                    {
                        this.direction = new Vector2(0, dest.Y);
                    }
                    else
                    {
                        this.direction = new Vector2(dest.X, 0);
                    }
                    this.direction.Normalize();
                    int frame = Actor.indexFromDirection(this.direction, 4, .25f);
                    actor.anim = (actor as FirstBoss).moveAnimation[(int)bossForm][frame];
                }
                else
                {
                    bossForm = BossForm.third;

                    (actor as FirstBoss).damage = 0;
                    dest        = actor.position - (actor as FirstBoss).startPos;
                    actor.force = dest * -.003f;


                    demonCooldown--;
                    if (demonCooldown <= 0)
                    {
                        sendDemon     = true;
                        demonCooldown = demonDelay;
                    }

                    if (dest.Length() < 150)
                    {
                        delay--;
                        if (delay < 0)
                        {
                            delay = (int)Math.Round(60 + (actor as ILife).life.life * .1f);
                            dest  = target.position - actor.position;

                            if (Math.Abs(dest.X) < Math.Abs(dest.Y))
                            {
                                if (dest.Y > 0)
                                {
                                    direction  = new Vector2(0, -1);
                                    actor.anim = (actor as FirstBoss).moveAnimation[(int)bossForm][2];
                                }
                                else
                                {
                                    direction  = new Vector2(0, 1);
                                    actor.anim = (actor as FirstBoss).moveAnimation[(int)bossForm][0];
                                }
                            }
                            else
                            {
                                if (dest.X > 0)
                                {
                                    direction  = new Vector2(1, 0);
                                    actor.anim = (actor as FirstBoss).moveAnimation[(int)bossForm][3];
                                }
                                else
                                {
                                    direction  = new Vector2(-1, 0);
                                    actor.anim = (actor as FirstBoss).moveAnimation[(int)bossForm][1];
                                }
                            }
                        }
                        else
                        {
                            if (delay % 6 == 0)
                            {
                                Vector2 loc;
                                float   width;
                                float   height;
                                if (direction.Y == 0)
                                {
                                    width  = 30 * Tile.size;
                                    height = 28 * Tile.size;
                                    if (direction.X < 0)
                                    {
                                        loc = new Vector2(((FirstBoss)actor).startPos.X - 30 * Tile.size + width * (float)actor.world.tileEngine.randGen.NextDouble(), ((FirstBoss)actor).startPos.Y - 14 * Tile.size + height * (float)actor.world.tileEngine.randGen.NextDouble());
                                    }
                                    else
                                    {
                                        loc = new Vector2(((FirstBoss)actor).startPos.X + width * (float)actor.world.tileEngine.randGen.NextDouble(), ((FirstBoss)actor).startPos.Y - 14 * Tile.size + height * (float)actor.world.tileEngine.randGen.NextDouble());
                                    }
                                }
                                else
                                {
                                    width  = 44 * Tile.size;
                                    height = 14 * Tile.size;
                                    if (direction.Y < 0)
                                    {
                                        loc = new Vector2(((FirstBoss)actor).startPos.X - 30 * Tile.size + width * (float)actor.world.tileEngine.randGen.NextDouble(), ((FirstBoss)actor).startPos.Y + height * (float)actor.world.tileEngine.randGen.NextDouble());
                                    }
                                    else
                                    {
                                        loc = new Vector2(((FirstBoss)actor).startPos.X - 30 * Tile.size + width * (float)actor.world.tileEngine.randGen.NextDouble(), ((FirstBoss)actor).startPos.Y - 14 * Tile.size + height * (float)actor.world.tileEngine.randGen.NextDouble());
                                    }
                                }

                                target.world.addActor(new FirePillar((target.world as GameWorld), loc, Vector2.Zero));
                            }
                        }
                    }
                }
            }

            if (actor.velocity.Length() > 0.1f)
            {
                if (actor.velocity.Length() > 6.0f)//For if the boss' speed is ever dynamic?
                {
                    actor.world.tileEngine.audioComponent.setSoundPitch(actor.audioSet[2], 1.0f);
                }
                else
                {
                    actor.world.tileEngine.audioComponent.setSoundPitch(actor.audioSet[2], 0.0f);
                }

                actor.world.tileEngine.audioComponent.playSound(actor.audioSet[2], false);
            }
            else
            {
                actor.world.tileEngine.audioComponent.stopSound(actor.audioSet[2]);
            }
        }