public void SetID(int id)
 {
     this.enemyID      = id;
     this.image.sprite = EnemyInfo.GetEnemyInfo(id).image;
     if (id == 0)
     {
         this.image.color = Color.clear;
     }
     else
     {
         this.image.color = Color.white;
     }
 }
    public void ShowEnemyInfo(int id)
    {
        EnemyInfo.ENEMY info = EnemyInfo.GetEnemyInfo(id);
        show_image.sprite = info.image;
        show_name.text    = info.name;
        show_intro.text   = info.intro;

        string hp;

        if (info.hp > 1500)
        {
            hp = "非常高";
        }
        else if (info.hp > 700)
        {
            hp = "高";
        }
        else if (info.hp > 300)
        {
            hp = "普通";
        }
        else
        {
            hp = "低";
        }

        string speed;

        if (info.cellTime > 0.8)
        {
            speed = "非常慢";
        }
        else if (info.cellTime > 0.61)
        {
            speed = "较慢";
        }
        else if (info.cellTime > 0.46)
        {
            speed = "较快";
        }
        else
        {
            speed = "非常快";
        }

        string abilities = "";

        if (info.physicalResist > 0)
        {
            abilities += "物理抗性" + info.physicalResist + "; ";
        }
        if (info.magicalResist > 0)
        {
            abilities += "魔法抗性" + info.magicalResist + "; ";
        }

        if (info.frozenResist)
        {
            abilities += "免疫冰冻" + "; ";
        }
        if (info.burnResist)
        {
            abilities += "免疫烧伤" + "; ";
        }
        //if (info.physicalResist > 0) abilities += "物理抗性" + info.physicalResist + "; ";



        show_msg1.text = "生命:" + hp + " 速度:" + speed + "\n赏金:" + info.reward;
        show_msg2.text = "特殊能力:" + abilities;
    }
Esempio n. 3
0
    /*
     * public GameObject CreateEnemy()
     * {
     *  GameObject newEnemy = Instantiate(cirno);
     *  //newEnemy.GetComponent<EnemyScript>().SetPosition(enemyStart_wPos);
     *  EnemyScript enemyScript = newEnemy.GetComponent<EnemyScript>();
     *  enemyScript.mapController = this.mapController;
     *  enemyScript.SetPosition(enemyStart_wPos);
     *  enemyScript.cellTime = 0.5f;
     *
     *  enemyList.Add(enemyScript);
     *
     *  //Debug.Log("enemy's position is in Cell "+mapController.WorldToCell(newEnemy.transform.position));
     *
     *  return newEnemy ;
     * }*/

    public GameObject CreateEnemy(int enemyID, Vector3 pos)
    {
        GameObject newEnemy = null;

        switch (enemyID)
        {
        case EnemyInfo.ENEMY_CIRNO:
            newEnemy = Instantiate(cirno);
            break;

        case EnemyInfo.ENEMY_RUMIA:
            newEnemy = Instantiate(rumia);
            break;

        case EnemyInfo.ENEMY_MAOYU:
            newEnemy = Instantiate(maoyu);
            break;

        case EnemyInfo.ENEMY_MEILIN:
            newEnemy = Instantiate(meilin);
            break;

        case EnemyInfo.ENEMY_SAKUYA:
            newEnemy = Instantiate(sakuya);
            break;

        case EnemyInfo.ENEMY_PATCHOULI:
            newEnemy = Instantiate(patchouli);
            break;

        case EnemyInfo.ENEMY_REMILIA:
            newEnemy = Instantiate(remilia);
            break;

        case EnemyInfo.ENEMY_FLANDRE:
            newEnemy = Instantiate(flandre);
            break;

        case EnemyInfo.ENEMY_ALICE:
            newEnemy = Instantiate(alice);
            break;

        case EnemyInfo.ENEMY_SHANGHAI:
            newEnemy = Instantiate(shanghai);
            break;

        case EnemyInfo.ENEMY_SANAE:
            newEnemy = Instantiate(sanae);
            break;

        case EnemyInfo.ENEMY_AYA:
            newEnemy = Instantiate(aya);
            break;

        case EnemyInfo.ENEMY_RIN:
            newEnemy = Instantiate(rin);
            break;

        case EnemyInfo.ENEMY_CHEN:
            newEnemy = Instantiate(chen);
            break;

        case EnemyInfo.ENEMY_KAGUYA:
            newEnemy = Instantiate(kaguya);
            break;

        case EnemyInfo.ENEMY_YUUGI:
            newEnemy = Instantiate(yuugi);
            break;

        case EnemyInfo.ENEMY_SUIKA:
            newEnemy = Instantiate(suika);
            break;

        case EnemyInfo.ENEMY_SUIKA_SMALL:
            newEnemy = Instantiate(suika_small);
            break;

        case EnemyInfo.ENEMY_SUWAKO:
            newEnemy = Instantiate(suwako);
            break;

        case EnemyInfo.ENEMY_KANAKO:
            newEnemy = Instantiate(kanako);
            break;

        case EnemyInfo.ENEMY_EIRIN:
            newEnemy = Instantiate(eirin);
            break;

        case EnemyInfo.ENEMY_YUKARI:
            newEnemy = Instantiate(yukari);
            break;

        case EnemyInfo.ENEMY_YUUKA:
            newEnemy = Instantiate(yuuka);
            break;

        case EnemyInfo.ENEMY_YOUMU:
            newEnemy = Instantiate(youmu);
            break;

        case EnemyInfo.ENEMY_YUYUKO:
            newEnemy = Instantiate(yuyuko);
            break;

        case EnemyInfo.ENEMY_SHIKIEKI:
            newEnemy = Instantiate(shikieki);
            break;
        }

        EnemyScript enemyScript = newEnemy.GetComponent <EnemyScript>();

        enemyScript.mapController = this.mapController;
        enemyScript.ID            = enemyID;
        //enemyScript.SetPosition(enemyStart_wPos);
        enemyScript.SetPosition(pos);

        //加载基础属性
        EnemyInfo.ENEMY info = EnemyInfo.GetEnemyInfo(enemyID);
        enemyScript.SetHP(info.hp, info.hp);
        enemyScript.reward         = info.reward;
        enemyScript.cellTime       = info.cellTime;
        enemyScript.physicalResist = info.physicalResist;
        enemyScript.magicalResist  = info.magicalResist;
        enemyScript.stunedResist   = info.stuntResist;
        enemyScript.burnedResist   = info.burnResist;
        enemyScript.frozenResist   = info.frozenResist;
        enemyScript.poisonedResist = info.poisonResist;


        //根据关卡提高怪物属性
        float x;

        if (wave < 20)
        {
            x = 1;
        }
        else
        {
            x = 1 + (float)((wave - 20)) * 0.1f;
        }
        //x = 4f;
        if (x > 10)
        {
            x = 10;
        }
        //根据rank提高属性
        if (rank > 0)
        {
            x += 0.2f * rank;

            float y = Mathf.Pow(0.9f, rank);
            enemyScript.cellTime *= y;
        }


        float newhp = enemyScript.maxHp * x;

        if (wave > 10)
        {
            newhp += (wave - 10) * 10;
        }
        enemyScript.SetHP(newhp, newhp);

        //enemyScript.cellTime = 0.5f;


        enemyList.Add(enemyScript);

        return(newEnemy);
    }