コード例 #1
0
    void OnTriggerExit2D(Collider2D other)
    {
        MovJugador prueba = other.gameObject.GetComponent <MovJugador>();

        Physics2D.gravity = new Vector2(0, -9);
        prueba.enabled    = true;
    }
コード例 #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        MovJugador prueba = other.gameObject.GetComponent <MovJugador>();

        if (prueba != null)
        {
            Physics2D.gravity = new Vector2(0, 0);
            prueba.enabled    = false;
        }
    }
コード例 #3
0
ファイル: MarineEspada.cs プロジェクト: xBlacKnife/GDV_UCM
    //10.ATACA AL JUGADOR
    void AtacaJugador(GameObject go)
    {
        MovJugador Jugador = go.GetComponent <MovJugador>();

        if (Jugador != null && !atacando)
        {
            atacando = true;
            animacion.SetBool("Andando", false);
            animacion.SetBool("Ataca", true);
            Invoke("DejaDeAtacar", 0.5f);
        }
    }
コード例 #4
0
ファイル: BatallaBoss.cs プロジェクト: xBlacKnife/GDV_UCM
    void OnTriggerExit2D(Collider2D other)
    {
        Collider2D iniciobat = GetComponent <BoxCollider2D>();
        MovJugador prueba    = other.GetComponent <MovJugador> ();
        Pajaro     mueve     = GetComponent <Pajaro> ();
        Boss2      Ataca     = GetComponent <Boss2> ();

        if (prueba != null)
        {
            Ataca.enabled       = true;
            iniciobat.isTrigger = false;
            mueve.enabled       = true;
        }
    }
コード例 #5
0
    void OnTriggerStay2D(Collider2D other)
    {
        MovJugador  prueba = other.gameObject.GetComponent <MovJugador>();
        Rigidbody2D rigid  = other.gameObject.GetComponent <Rigidbody2D>();

        if (prueba.enabled == false && Input.GetKey(KeyCode.W))
        {
            rigid.velocity = new Vector3(0, 3f, 0);
        }
        else if (prueba.enabled == false && Input.GetKey(KeyCode.S))
        {
            rigid.velocity = new Vector3(0, -3f, 0);
        }
        else if (prueba.enabled == false && Input.GetKey(KeyCode.D))
        {
            rigid.velocity = new Vector3(2f, 0, 0);
        }
        else if (prueba.enabled == false && Input.GetKey(KeyCode.A))
        {
            rigid.velocity = new Vector3(-2f, 0, 0);
        }
    }
コード例 #6
0
ファイル: Cofre.cs プロジェクト: xBlacKnife/GDV_UCM
    //2.COLISIONES CON EL JUGADOR
    void OnTriggerEnter2D(Collider2D other)
    {
        MovJugador compJugador = other.GetComponent <MovJugador> ();

        if (compJugador != null && !abierto)
        {
            if (enemigo)
            {
                anim.SetBool("Enemigo", true);
            }

            else
            {
                anim.SetBool("Abierto", true);
            }
            if (abrecofre != null)
            {
                GetComponent <AudioSource>().PlayOneShot(abrecofre);
            }
            Invoke("Abrir", 0.5f);
        }
    }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     jugadorAudio = GetComponent <AudioSource>();
     jugador      = GetComponent <MovJugador>();
     vidaActual   = vidaIncial;
 }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     jugador = GetComponent <MovJugador>();
     disparo = GetComponentInChildren <DisparoJugador>();
 }
コード例 #9
0
 void Start()
 {
     jugadorAudio = GetComponent <AudioSource>();
     jugador      = GetComponent <MovJugador>();
     anim         = GetComponent <Animator>();
 }
コード例 #10
0
 // Use this for initialization
 void Start()
 {
     jugador         = GetComponentInChildren <MovJugador>();
     rotacionInicial = transform.rotation;
     fade            = false;
 }