void Start() { if (infos == null) { infos = CsvFile.Read <InteragivelInfo>("Assets\\data.csv").ToList(); } dados = infos.Find(i => i.id_interagivel.ToLower() == idInteragivel.ToLower()); // carrega listas de mensagens trechosPreItem = new List <string>(); trechosDuranteItem = new List <string>(); trechosPosItem = new List <string>(); trechosPreItem.AddRange(new string[3] { dados.pre_01, dados.pre_02, dados.pre_03 }); trechosDuranteItem.AddRange(new string[3] { dados.dur_01, dados.dur_02, dados.dur_03 }); trechosPosItem.AddRange(new string[3] { dados.pos_01, dados.pos_02, dados.pos_03 }); trechosPreItem.RemoveAll(s => s == ""); trechosDuranteItem.RemoveAll(s => s == ""); trechosPosItem.RemoveAll(s => s == ""); // iniciar estado = EstadoInteragivel.PRE; _jogador = GameObject.Find("Jogador").GetComponent <Jogador>(); }
void Update() { if (ativo) { if (Input.GetKeyUp(KeyCode.Space) && _jogador.interlocutor == this) { _jogador.estado = EstadoPersonagem.FALANDO; if (_balao != null) { _balao.Destruir(); } if (_jogador.tem.Contains(dados.id_item_req) && estado != EstadoInteragivel.POS) { estado = EstadoInteragivel.DURANTE; } bool estourou = MostrarMsgAtual(); if (estourou) { //if(estado != EstadoInteragivel.POS) trechoAtual = 0; _balao.StartCoroutine("DestruirComDelay", 0.5f); _jogador.estado = EstadoPersonagem.ANDANDO; } } } }
void AdicionarAoInventario() { if (dados.id_item_req.Length == 0 || _jogador.tem.Contains(dados.id_item_req)) { if (dados.id_item_req.Length > 0) { _jogador.tem.Remove(dados.id_item_req); _jogador.naoTemMais.Add(dados.id_item_req); } _jogador.tem.Add(dados.id_item_dado); estado = EstadoInteragivel.POS; } }