예제 #1
0
 public void DestroyLasso()
 {
     if (ropeSpawner.RopeFired)
     {
         ropeSpawner.destroyTheRope();
     }
 }
예제 #2
0
    void OnCollisionEnter2D(Collision2D col)
    {
        _velocity = new Vector3(0, 0, 0);
        Debug.Log("LAYER::  " + col.gameObject.layer);

        if (IsInLayerMask(col.gameObject, canBeLassoed) && !hitObject)
        {
            Debug.Log("LAYER " + col.gameObject.layer + " is in layer mask");
            Debug.Log("NAME::  " + col.gameObject.name);
            col.gameObject.GetComponent <Lassoed>().isLassoed = true;
            col.gameObject.GetComponent <Enemy>().StopCoroutine("SeePlayer");
            col.gameObject.GetComponent <Enemy>().seePlayer = false;
            col.gameObject.GetComponent <Enemy>().animator.SetBool("Lassoed", true);
            enemyHooked = col.gameObject;
            col.gameObject.GetComponent <HingeJoint2D>().connectedBody = gameObject.rigidbody2D;
            RopeSpawner a = GameObject.FindWithTag("Player").GetComponent <RopeSpawner>();
            gameObject.GetComponent <SpriteRenderer>().enabled = false;
            a.fishCaught(enemyHooked);
        }

        if (IsInLayerMask(col.gameObject, dontHurt) && !hitObject)
        {
            Debug.Log("LAYER " + col.gameObject.layer + " is in layer mask");
            Debug.Log("NAME::  " + col.gameObject.name);
            RopeSpawner a = GameObject.FindWithTag("Player").GetComponent <RopeSpawner>();
            a.destroyTheRope();
        }
        hitObject = true;
    }