//reduzir contagem de efeitos pendentes, e excluir inativos/expirados public void DegradarEfeitos() { List <Efeito> aApagar = new List <Efeito>(); foreach (Efeito e in efeitos) { if (e.duracao > 0) { e.duracao--; } if (e.duracao == 0 || e.inativo) { aApagar.Add(e); } } foreach (Efeito e in aApagar) { efeitos.Remove(e); if (e.efeitoExpirar != null) { e.efeitoExpirar(this); //executar o comando que ocorre quando expira o efeito } GerenciadorScript gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); string texto = this.nome + " não está mais sob efeito de " + e.nome + "!"; List <Action <GerenciadorDialogo> > mensagem = new List <Action <GerenciadorDialogo> > { gd => { gd.Dialogo("Efeito", texto); } }; gs.mensagensPendentes.Add(mensagem); } }
public void AdicionarEfeito(string nome) { if (this.pv == 0) { return; } bool jaExiste = false; Efeito novo = DefinesEfeitos.efeitos[nome]; foreach (var e in efeitos) { if (e.nome == nome) { //se efeito já existe, reiniciar a contagem da duração //melhoria possível - efeito pode ter uma função informando o que fazer (nada, resetar, stack) e.duracao = novo.duracao; jaExiste = true; } } if (!jaExiste) { efeitos.Add(novo); print(nome); GerenciadorScript gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); string texto = this.nome + " agora está sob efeito de " + novo.nome + "!"; List <Action <GerenciadorDialogo> > mensagem = new List <Action <GerenciadorDialogo> > { gd => { gd.Dialogo("Efeito", texto); } }; gs.mensagensPendentes.Add(mensagem); } }
private void Start() { gerenciador = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); //coloco o nome do inimigo como nome do prefab tbm gameObject.name = nome; }
// Start is called before the first frame update void Start() { cooldownPadrao = 50; cursor = GameObject.Find("Cursor").GetComponent <ControleCursor>(); gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); caixaPersonagem = GameObject.Find("DialogSpeaker").GetComponent <Text>(); caixaTexto = GameObject.Find("DialogText").GetComponent <Text>(); progressoMsg = 0f; //finalizado = true; }
// Start is called before the first frame update void Start() { cooldownPadrao = 50; gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); input = GameObject.Find("Input").GetComponent <GerenciadorInput>(); cursor = GameObject.Find("Cursor").GetComponent <ControleCursor>(); tilemap = GameObject.Find("Tilemap").GetComponent <Tilemap>(); personagem = gameObject.GetComponent <Personagem>(); ap = GameObject.Find("Placeholder").GetComponent <AttackParent>(); acabaramDeMeAtacar = new List <Personagem>(); }
// Start is called before the first frame update void Start() { cursor = GameObject.Find("Cursor"); canvasAlvo = GameObject.Find("CanvasAlvo"); gerenciadorInput = GameObject.Find("Input").GetComponent <GerenciadorInput>(); slots = new Text[8]; for (int i = 0; i < 8; i++) { slots[i] = GameObject.Find("Slot" + (i + 1) + "Troca").GetComponent <Text>(); } gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); }
void Start() { novaPosicao = transform.position; _tilemap = GameObject.Find("Tilemap").GetComponent <Tilemap>(); acessoCursor = GameObject.Find("CursorAccess").GetComponent <Tilemap>(); gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); gerenciadorInput = GameObject.Find("Input").GetComponent <GerenciadorInput>(); menuInventario = GameObject.Find("CanvasInventario").GetComponent <GerenciadorInventario>(); menuInventarioTroca = GameObject.Find("CanvasInventarioTroca").GetComponent <GerenciadorInventarioTroca>(); menuHabilidades = GameObject.Find("CanvasHabilidades").GetComponent <GerenciadorTelaHab>(); ap = GameObject.Find("Placeholder").GetComponent <AttackParent>(); ap.Init(); }
// Start is called before the first frame update void Start() { name = nome; gerenciador = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); if (gerenciador == null) { Debug.Log("não gerenciador"); } criaInimigo(); }
// Start is called before the first frame update void Start() { cursor = GameObject.Find("Cursor"); canvasAlvo = GameObject.Find("CanvasAlvo"); gerenciadorInput = GameObject.Find("Input").GetComponent <GerenciadorInput>(); gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); slots = new Text[8]; for (int i = 0; i < 8; i++) { slots[i] = GameObject.Find("Slot" + (i + 1) + "Hab").GetComponent <Text>(); } campoDesc = GameObject.Find("DescricaoHab").GetComponent <Text>(); custo = GameObject.Find("CustoLabel").GetComponent <Text>(); alcance = GameObject.Find("AlcanceLabel").GetComponent <Text>(); }
void Awake() { gerenciador = gameObject.GetComponent <GerenciadorScript>(); if (gerenciador == null) { Debug.Log("gerenciador null no Leitor de CSV"); } else { //se não for nulo, carrega a Dungeon e os Personagens carregaDungeon(); carregaPersonagens(); carregaItens(); } }
// Start is called before the first frame update void Start() { cursor = GameObject.Find("Cursor"); canvasAlvo = GameObject.Find("CanvasAlvo"); gerenciadorInput = GameObject.Find("Input").GetComponent <GerenciadorInput>(); gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); slots = new Text[8]; for (int i = 0; i < 8; i++) { slots[i] = GameObject.Find("Slot" + (i + 1)).GetComponent <Text>(); } armaLabel = GameObject.Find("ArmaLabel").GetComponent <Text>(); acoes = new Text[3]; acoes[0] = GameObject.Find("EquipUseBtn").GetComponent <Text>(); acoes[1] = GameObject.Find("TrocaBtn").GetComponent <Text>(); acoes[2] = GameObject.Find("DescartaBtn").GetComponent <Text>(); campoDesc = GameObject.Find("Descricao").GetComponent <Text>(); }
// Start is called before the first frame update void Start() { //andar = Defines.Andar("normal"); efeitos = new List <Efeito>(); //valores auxiliares para movimentação no campo de batalha rota = new List <Vector3>(); rotaBacktrack = new List <Vector3>(); destinoFinal = transform.position; inventario = new Item[8]; habilidades = new Habilidade[8]; //atributos Defines.Inicializacao(nome, gameObject); gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); gs.AdicionarPersonagem(gameObject); anim = GetComponent <Animator>(); ControladorDano.Init(); ap = GameObject.Find("Placeholder").GetComponent <AttackParent>(); }
public void UsarHabilidade(Vector3 posCentral) { //quais alvos selecionar, dependendo se a habilidade afeta alvos do mesmo time ou do time inimigo int timeAlvo = habilidadeAtual.seMesmoTime ? this.time : (this.time + 1) % 2; List <Vector3> tilesAlcancados = habilidadeAtual.areaDeEfeito; List <Personagem> alvos = new List <Personagem>(); GerenciadorScript gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); AttackParent ap = GameObject.Find("Placeholder").GetComponent <AttackParent>(); List <Action <GerenciadorDialogo> > list = new List <Action <GerenciadorDialogo> >(); foreach (Vector3 offset in tilesAlcancados) { //considerando posCentral como centro, tenta ver se encontra um alvo possível em todos os offsets //da área de efeito da habilidade Personagem alvoPossivel = gs.ObjetoNoTile(posCentral + offset); if (alvoPossivel == null) { continue; } else if (alvoPossivel.time == timeAlvo) { list.Add(gd => { gd.IrPara(posCentral + offset); }); list.Add(gd => { ap.Abrir(); ap.SetLeftAnimator(Defines.animacoesAtk[this.nome]); ap.SetRightAnimator(Defines.animacoesAtk[alvoPossivel.nome]); }); list.Add(gd => { habilidadeAtual.efeitoUso(this, alvoPossivel); }); list.Add(gd => { ap.Fechar(); }); } } gs.mensagensPendentes.Add(list); }
void Start() { KartRigidbody = GetComponent <Rigidbody>(); //Identifica e pega a referencia do rigidbody do carro //Ajusta o centro de massa do Kart KartRigidbody.centerOfMass = new Vector3(CenterOfMass.localPosition.x * transform.localScale.x, CenterOfMass.localPosition.y * transform.localScale.y - 0.003f, CenterOfMass.localPosition.z * transform.localScale.z - 0.005f); //Atrito das rodas friccaoLateral = RodaTDir.sidewaysFriction.stiffness; //Armazena a fricção lateral normal das rodas friccaoFrontal = RodaTDir.forwardFriction.stiffness; //Armazena a fricção frontal normal das rodas friccaoLateralDrift = 0.9f; //Armazena a fricção lateral das rodas no drift friccaoFrontalDrift = 0.9f; //Armazena a fricção frontal das rodas no drift CameraScript = camKart.GetComponent <KartCameraScript>(); gerenciador = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); PersonalizaPersonagem(); //Chama a função que muda os atributos de acordo com o personagem posInicial = KartRigidbody.position; //Salva sua posição inicial na corrida rotInicial = KartRigidbody.rotation; //Salva sua rotação inicial na corrida CooldownEspecial = 60; //Define o tempo de recarga do powerup especial }
public void UsarItem(Personagem unid) { GerenciadorScript gs = GameObject.Find("Gerenciador").GetComponent <GerenciadorScript>(); AttackParent ap = GameObject.Find("Placeholder").GetComponent <AttackParent>(); List <Action <GerenciadorDialogo> > list = new List <Action <GerenciadorDialogo> >(); list.Add(gd => { gd.IrPara(unid.transform.position); }); list.Add(gd => { ap.Abrir(); ap.SetLeftAnimator(Defines.animacoesAtk[this.nome]); ap.SetRightAnimator(Defines.animacoesAtk[unid.nome]); }); list.Add(gd => { itemAtual.efeitoUso(this, unid); }); list.Add(gd => { ap.Fechar(); }); inventario[posItemAtual] = null; gs.mensagensPendentes.Add(list); }