void Start() { players = GameObject.FindGameObjectsWithTag ("Player"); for(int i=0;i<players.Length;i++) { if(players[i].GetComponent<MovimentaPersonagem>() != null) { player = players[i].GetComponent<MovimentaPersonagem>(); } } }
private void Start() { jogador = GameObject.FindWithTag(Tags.Jogador); controlaJogador = jogador.GetComponent <ControlaJogador>(); movimentaZumbi = GetComponent <MovimentaPersonagem>(); animaZumbi = GetComponent <AnimaPersonagem>(); statusZumbi = GetComponent <Status>(); direcao = transform.position; aleatorizarZumbi(); scriptControlaInterface = GameObject.FindWithTag(Tags.Interface).GetComponent <ControlaInterface>(); }
private void Start() { jogador = GameObject.FindWithTag(Tags.Jogador).transform; agente = GetComponent <NavMeshAgent>(); statusChefe = GetComponent <Status>(); agente.speed = statusChefe.velocidade; animacaoChefe = GetComponent <AnimaPersonagem>(); movimentoChefe = GetComponent <MovimentaPersonagem>(); scriptControlaInterface = GameObject.FindWithTag(Tags.Interface).GetComponent <ControlaInterface>(); sliderVida.maxValue = statusChefe.vidaInicial; AtualizarInterface(); }
public void HitPlayer(MovimentaPersonagem player, Vector2 direcao, float forcaEmpurrao) { if (player.podeHit) { PlayerPrefs.SetInt("VIDAS",PlayerPrefs.GetInt("VIDAS")-1); if (PlayerPrefs.GetInt("VIDAS") >0) { player.hit = true; //player.tempo = 0.0f; if(direcao.x == -1) { player.forcaEmpurrao = -forcaEmpurrao; } if(direcao.x == 1) { player.forcaEmpurrao = forcaEmpurrao; } } } }