Пример #1
0
    public override void Die()
    {
        if (nowHP <= 0)
        {
            GameObject slime1 = ObjectPool.getInstance().GetObj("Enemy", "RedSlime");
            GameObject slime2 = ObjectPool.getInstance().GetObj("Enemy", "RedSlime");
            slime1.transform.parent = this.transform.parent;
            slime2.transform.parent = this.transform.parent;
            slime1.GetComponent <NavMeshAgent>().Warp(this.transform.position);
            slime2.GetComponent <NavMeshAgent>().Warp(this.transform.position);
            print(this.transform.position);

            for (int i = 0; i < pastPos.Count; i++)
            {
                myLine.Remove(pastPos[i]);
            }

            slime1.GetComponent <Enemy>().InitData(EnemyDataManage.getInstance().GetEnemyData("RedSlime"), myLine);
            slime2.GetComponent <Enemy>().InitData(EnemyDataManage.getInstance().GetEnemyData("RedSlime"), myLine);
            //slime1.GetComponent<Enemy>().dieEvent += CountDieEnemy;
            //slime2.GetComponent<Enemy>().dieEvent += CountDieEnemy;
        }

        base.Die();
    }
Пример #2
0
    IEnumerator MakeEnemy(WaveData wd)
    {
        yield return(new WaitForSeconds(wd.delay - 5f));

        //提示路线
        if (wd.roadName == "Line1")
        {
            LineHit1.GetComponent <LineHit>().ShowHits();
        }
        else if (wd.roadName == "Line2")
        {
            LineHit2.GetComponent <LineHit>().ShowHits();
        }
        else if (wd.roadName == "Line3")
        {
            LineHit3.GetComponent <LineHit>().ShowHits();
        }
        yield return(new WaitForSeconds(5f));

        //开始刷怪
        for (int i = 0; i < wd.num; i++)
        {
            GameObject enemy = ObjectPool.getInstance().GetObj("Enemy", wd.enemyName);
            enemy.GetComponent <NavMeshAgent>().Warp(this.transform.localPosition);
            enemy.transform.parent = this.transform;
            enemy.GetComponent <Enemy>().InitData(EnemyDataManage.getInstance().GetEnemyData(wd.enemyName), wd.roadName);
            enemy.GetComponent <Enemy>().dieEvent += CountDieEnemy;
            yield return(new WaitForSeconds(0.5f));
        }
    }
Пример #3
0
    public void SelectEnemy(string name)
    {
        enemyName = name;
        EnemyData ed = EnemyDataManage.getInstance().GetEnemyData(enemyName);

        intro_text.text = ed.intro;
        btn_text.text   = "召唤$" + ed.cost;
    }
Пример #4
0
    public void SummonEnemy()
    {
        if (enemyName != "" && roadName != "")
        {
            EnemyData ed = EnemyDataManage.getInstance().GetEnemyData(enemyName);
            if (gc.playerMoney >= ed.cost)
            {
                GameObject enemy = ObjectPool.getInstance().GetObj("Enemy", enemyName);
                enemy.GetComponent <NavMeshAgent>().Warp(EnemyStartPoint.transform.localPosition);
                enemy.transform.parent = EnemyStartPoint.transform;
                enemy.GetComponent <Enemy>().InitData(ed, roadName);

                gc.ReduceMoney(ed.cost);
            }
        }
    }