void do_down_block(Collider2D col) { //Debug.Log("do_down_block "+ move_direction); bool isStop = false; if (move_direction == 1) { if ((col.gameObject.transform.position.x == transform.position.x) && (col.gameObject.transform.position.y < transform.position.y)) { isStop = true; transform.position = col.gameObject.transform.position + Vector3.up; //Debug.Log("down"); } else { isStop = false; } } else if (move_direction == 2) { unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>(); u_c.open_door(); return; } else if (move_direction == 3) { return; } else if (move_direction == 4) { return; } if (isStop == true) { load_sound(); if (col.gameObject.transform.position.y + 0.5 < transform.position.y) { move_direction = 0; } else { return; } } }
void OnTriggerEnter2D(Collider2D col) { Debug.Log("attact tag is " + col.tag); if (col.gameObject.tag == Common_data.PANDA_TAG) { explode_effect(col); panda_controller p_c = col.gameObject.GetComponent <panda_controller>(); p_c.dead(); load_sound(); dead(); } else if (col.gameObject.tag == Common_data.ICE_BLOCK_TAG) { explode_effect(col); dead(); ice_controller i_c = col.gameObject.GetComponent <ice_controller>(); i_c.attact(); } else if (col.gameObject.tag == Common_data.UP_BLOCK_TAG) { if (move_direction == 1) { unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>(); u_c.open_door(); } else if (move_direction == 2) { explode_effect(col); load_sound(); dead(); } else { return; } } else if (col.gameObject.tag == Common_data.DOWN_BLOCK_TAG) { if (move_direction == 1) { explode_effect(col); load_sound(); dead(); } else if (move_direction == 2) { unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>(); u_c.open_door(); } else { return; } } else if (col.gameObject.tag == Common_data.LEFT_BLOCK_TAG) { if (move_direction == 3) { unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>(); u_c.open_door(); } else if (move_direction == 4) { explode_effect(col); load_sound(); dead(); } else { return; } } else if (col.gameObject.tag == Common_data.RIGHT_BLOCK_TAG) { if (move_direction == 4) { unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>(); u_c.open_door(); } else if (move_direction == 3) { explode_effect(col); load_sound(); dead(); } else { return; } } else { if (col.gameObject.tag != Common_data.BARELL_COLLIDER_TAG && col.gameObject.tag != Common_data.ATTACT_ENEMY_TAG && col.gameObject.tag != Common_data.STREET_TAG && col.gameObject.tag != "trap_collider" && col.gameObject.tag != "trap" && col.gameObject.tag != Common_data.BULLET_TAG) { explode_effect(col); load_sound(); dead(); } } }