Beispiel #1
0
 void Awake()
 {
     _renderer   = GetComponent <SpriteRenderer>();
     _collider   = GetComponent <Collider2D>();
     player      = GameObject.FindGameObjectsWithTag("Player");
     vidaJugador = player[0].GetComponent <VidaJugador>();
 }
Beispiel #2
0
    private void OnCollisionEnter2D(Collision2D objeto)
    {
        VidaJugador vida = objeto.gameObject.GetComponent <VidaJugador>();

        if (vida)
        {
            vida.RestaVida(daño);
        }
    }
    void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode)
    {
        player = GameObject.FindWithTag("Player").gameObject;

        if (SceneManager.GetActiveScene().name != "level2_1")
        {
            if (player != null)
            {
                vida    = GameObject.FindWithTag("healthbar").GetComponent <VidaJugador>();
                energia = GameObject.FindWithTag("energybar").GetComponent <EnergiaJugador>();
            }
        }
    }
Beispiel #4
0
    private void Update()
    {
        isInFov = inFOV(transform, player, maxAngle, maxRadius);
        VidaJugador vida = PLAYER.GetComponent <VidaJugador>();

        if (isInFov)
        {
            FaceTarget();
            vida.isTrue = true;
            agent.SetDestination(player.position);
        }
        else
        {
            vida.isTrue = false;
        }
    }
Beispiel #5
0
    private bool cheats = false; //si es true los cheats están activos

    /// <summary>
    /// Método que se asegura de que solo haya un GameManager al mismo tiempo
    /// y de que no se destruya al cambiar de escena
    /// </summary>
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
            //DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject);
        }

        if (GOjugador)
        {
            ataquejugador = GOjugador.GetComponent <AtaqueJugador>();
            jugador       = GOjugador.GetComponent <ControlJugador>();
            vidaJ         = GOjugador.GetComponent <VidaJugador>();
            matJ          = GOjugador.GetComponent <Materiales>();
        }
    }
Beispiel #6
0
 void Awake()
 {
     _rigidbody  = GetComponent <Rigidbody2D>();
     _animator   = GetComponent <Animator>();
     vidaJugador = GetComponent <VidaJugador>();
 }
 void Start()
 {
     puntaje     = GameObject.Find("ScoreManager").GetComponent <Score> ();
     vida        = GameObject.Find("Player").GetComponent <VidaJugador> ();
     numeroBalas = GameObject.Find("RifleDeAsalto").GetComponent <DisparoRayCast> ();
 }
 // Use this for initialization
 void Start()
 {
     jugador     = GameObject.FindGameObjectWithTag("Player");
     vidaJugador = jugador.GetComponent <VidaJugador>();
 }
Beispiel #9
0
 void Awake()
 {
     vidaJugador = FindObjectOfType <VidaJugador>();
     cmpAnimator = GetComponent <Animator>();
 }
Beispiel #10
0
 void Awake()
 {
     player      = GameObject.FindGameObjectsWithTag("Player");
     vidaJugador = player[0].GetComponent <VidaJugador>();
 }
Beispiel #11
0
 void Start()
 {
     vida = GetComponent <VidaJugador>();
 }
Beispiel #12
0
 void Start()
 {
     playerVida = GetComponentInParent <VidaJugador>();
 }