public GameObject CreateTrap(TRAPTYPE _traptype, int _PosX, int _PosY) { var oTrap = Instantiate(trapPrefab, new Vector2(_PosX, _PosY), Quaternion.identity); oTrap.transform.SetParent(trapCargo.transform); oTrap.GetComponent <Trap>().trapData.position.PosX = _PosX; oTrap.GetComponent <Trap>().trapData.position.PosY = _PosY; oTrap.GetComponent <Trap>().trapData.trapType = _traptype; switch (_traptype) { case TRAPTYPE.DART: oTrap.GetComponent <SpriteRenderer>().sprite = ResourceManager.Instance.spriteAtlas.GetSprite("trap_dart"); break; case TRAPTYPE.NET: oTrap.GetComponent <SpriteRenderer>().sprite = ResourceManager.Instance.spriteAtlas.GetSprite("trap_net"); break; default: break; } return(oTrap); }
public void ActivateTrap(TRAPTYPE _traptype, Player _player) { switch (_traptype) { case TRAPTYPE.DART: _player.playerData.curHp -= 2; LogManager.Instance.SimpleLog("당신은 다트를 맞았다."); break; case TRAPTYPE.NET: int netDuration = Random.Range(2, 4); Debuff net_entangle = new Debuff(DEBUFFTYPE.ENTANGLE, netDuration); _player.playerData.debuffs.Add(net_entangle); LogManager.Instance.SimpleLog("그물이 당신을 덮쳤다!"); break; } }