//砖块生成怪物 public void GenMonster(int monsterId) { NPC_Info = Cfg_NPC.GetCfg(monsterId); if (NPC_Info.AppearOnStart == 1) { SetBrickState(BrickState.monster); } monsterAttr = new MonsterAttr(); monsterAttr.GameEvent.OnMonsterAttrChanged += SetMonsterAttrShow; monsterAttr.GameEvent.OnMonsterDie += MonsterDie; MonsterAttr.TransToAttr(NPC_Info, ref monsterAttr); //设置怪物图片和颜色 string monsterAsset = COMMON.MonsterIconPath + NPC_Info.AssetName; COMMON.SetSprite(modelIcon, monsterAsset); modelIcon.material = COMMON.spriteMaterials[NPC_Info.Color]; }
private void GenEquipItem(List <int> equipList) { equipItem.SetActive(true); equipObjList = new List <GameObject>(); int index = 0; foreach (var i in equipList) { Cfg_Item cfg_Item = Cfg_Item.GetCfg(i); string AssetName = COMMON.ItemIconPath + cfg_Item.AssetName; GameObject equip = Instantiate(equipItem, equipItem.transform.parent); equipObjList.Add(equip); SpriteRenderer itemSprite = equip.GetComponent <SpriteRenderer>(); COMMON.SetSprite(itemSprite, AssetName); itemSprite.material = COMMON.spriteMaterials[cfg_Item.Color]; equip.SetActive(index == 0); index++; } equipItem.SetActive(false); }