Exemple #1
0
    private void SpawnEnemy(int id, Vector3 pos, WaveBase wave)
    {
        EnemyBase enemyBase = Tools.Clone(m_EnemyData.EnemyDict[id]);
        Enemy     enemy     = ObjectManager.Instance.InstantiateObject(enemyBase.Path).GetComponent <Enemy>();

        //HpSlider
        HpSlider hpSlider = ObjectManager.Instance.InstantiateObject(Consts.UI_HpSlider).GetComponent <HpSlider>();

        hpSlider.Init(enemy.gameObject);

        enemy.Init(enemyBase, hpSlider, wave);
        enemy.transform.position = pos;
    }
Exemple #2
0
    private void CreateNewHpSlider(BattleRoleData data)
    {
        GameObject obj = Instantiate(Resources.Load("HpSlider")) as GameObject;

        if (obj != null)
        {
            obj.transform.parent = this.HpSliderContainer.transform;
            HpSlider script = obj.AddComponent <HpSlider>();
            script.Init(data);
            this.HpSliderList.Add(script);
        }
        else
        {
            Debug.LogError("实例化血条失败.");
        }
    }
Exemple #3
0
 public void Init(int seat)
 {
     hp.Init(seat);
     nameText.text = RoomData.seat2PlayerName(seat);
 }