void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "AI") { keyPickUp = col.gameObject.GetComponent <KeyPickUp>(); // If the ai has the key then kill zone is on if (keyPickUp.hasKey == true) { entered = true; } } }
// Use this for initialization void Start() { //Gets scripts off player baseEnter = player.GetComponent<BaseEnter>(); buttonRoom = player.GetComponent<ButtonRoom>(); grid = player.GetComponent<Grid>(); keyPickUp = player.GetComponent<KeyPickUp>(); paint = player.GetComponent<Paint>(); //Sets all scripts enabled to false initially baseEnter.enabled = false; buttonRoom.enabled = false; grid.enabled = false; keyPickUp.enabled = false; paint.enabled = false; //player starts in first room so it initially returns true for first room inFirstRoom = true; inSecondRoom = false; inThirdRoom = false; inFourthRoom = false; }
// Use this for initialization void Start() { pickUpScript = player.GetComponent<KeyPickUp>(); shader = Shader.Find("Diffuse"); }