コード例 #1
0
    protected override void RegistAttribute()
    {
        base.RegistAttribute();

        _cfg = BossConfig.GetData(Id);

        gameObject.name = _cfg.Name;
        var _hp = new GameRangeAttribute(E_Attribute.Hp.ToString(), 0, _cfg.Hp);

        m_Hp = AddRangeAttribute(_hp);
        var _mp = new GameRangeAttribute(E_Attribute.Mp.ToString(), 0, _cfg.Mp, 0.1f);

        m_Mp = AddRangeAttribute(_mp);
        var _attack = new GameAttribute(E_Attribute.Atk.ToString(), _cfg.Attack);

        m_Attack = AddAttribute(_attack);
        var _moveSpeed = new GameAttribute(E_Attribute.MoveSpeed.ToString(), _cfg.MoveSpeed);

        m_MoveSpeed = AddAttribute(_moveSpeed);

        m_CaculateDelta = TimerManager.Instance.AddListener(0, 0.02f, m_MonoAttribute.CaculateRangeDelta, null, true);


        _shield  = new GameRangeAttribute(E_Attribute.Shield.ToString(), 0, _cfg.Shield, 0.02f);
        m_Shield = AddRangeAttribute(_shield);


        UIBattleWindow.ShowBossUI();
        UIBattleWindow.OnBossHpChange(m_Hp.Current, m_Hp.GetMinTotalValue(), m_Hp.GetMaxTotalValue());
        UIBattleWindow.OnBossShieldChange(m_Shield.Current, m_Shield.GetMinTotalValue(), m_Shield.GetMaxTotalValue());
        GetRangeAttribute(E_Attribute.Hp.ToString()).OnValueChanged     += (delta) => { UIBattleWindow.OnBossHpChange(m_Hp.Current, m_Hp.GetMinTotalValue(), m_Hp.GetMaxTotalValue()); };
        GetRangeAttribute(E_Attribute.Shield.ToString()).OnValueChanged += (delta) => { UIBattleWindow.OnBossShieldChange(m_Shield.Current, m_Shield.GetMinTotalValue(), m_Shield.GetMaxTotalValue()); };

        AudioManager.Instance.PlayBGM(_cfg.FightBGM);
    }
コード例 #2
0
    private void Start()
    {
        string path = "";

        switch (Type)
        {
        case EnemyType.怪物:
            MonsterConfig mCfg = MonsterConfig.GetData(EnemyId);
            path = PathManager.RolePrefabsPath + mCfg.Name + "/" + mCfg.Name;
            break;

        case EnemyType.Boss:
            BossConfig bCfg = BossConfig.GetData(EnemyId);
            path = PathManager.RolePrefabsPath + bCfg.Name + "/" + bCfg.Name;
            break;
        }
        var obj = ResourceManager.Load <GameObject>(path);
        var go  = GameObject.Instantiate(obj);

        go.transform.SetParent(transform, false);
        var character = go.GetComponent <Character>();

        MonoBehaviourManager.Add(character);
    }