void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == Common_data.PANDA_TAG) { if (is_compress == true) { return; } panda_controller panda = col.gameObject.GetComponent <panda_controller>(); GameObject explode_instance = (GameObject)Instantiate(explode, panda.gameObject.transform.position, explode.transform.rotation); panda.dead(); } else if (col.gameObject.tag == Common_data.MOVE_BLOCK_TAG || col.gameObject.tag == Common_data.BARREL_BLOCK_TAG) { is_compress = true; player.CrossFade("fire_down", 0); } }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == Common_data.BARELL_COLLIDER_TAG) { return; } // checkCollider (col); else if (col.gameObject.tag == Common_data.PANDA_TAG) { float y = 0.0f; float x = 0.0f; panda_controller p_c = col.gameObject.GetComponent <panda_controller>(); p_c.dead(); boom(); } else if (col.gameObject.tag == Common_data.MOVE_BLOCK_TAG || col.gameObject.tag == Common_data.BARREL_BLOCK_TAG) { boom(); } }
void OnTriggerEnter2D(Collider2D col) { if (move_direction == 0) { if (col.gameObject.tag == Common_data.PANDA_TAG) { panda_controller p_c = col.gameObject.GetComponent <panda_controller> (); Debug.Log("panda collider"); if (p_c.move_direction == 0) { p_c.dead(); Instantiate(explode, p_c.gameObject.transform.position, explode.transform.rotation); return; } load_sound(SOUND_TYPE.hit); move_direction = p_c.move_direction; initActionState(); player.CrossFade("dead_begin", 0); Vector3 d = new Vector3(); if (move_direction == 1) { d = Vector3.up; } else if (move_direction == 2) { d = Vector3.down; } else if (move_direction == 3) { d = Vector3.left; } else if (move_direction == 4) { d = Vector3.right; } my_transform.position = col.gameObject.transform.position + d; GameObject explode_instance = (GameObject)Instantiate(explode, my_transform.position, explode.transform.rotation); Debug.Log("panda move dead move is " + p_c.move_direction); } else if (col.gameObject.tag == Common_data.BARREL_BLOCK_TAG) { initActionState(); player.CrossFade("dead_begin", 0); barrel_controller b_c = col.gameObject.GetComponent <barrel_controller> (); move_direction = b_c.move_direction; load_sound(SOUND_TYPE.hit); Vector3 d = new Vector3(); if (move_direction == 1) { d = Vector3.up; } else if (move_direction == 2) { d = Vector3.down; } else if (move_direction == 3) { d = Vector3.left; } else if (move_direction == 4) { d = Vector3.right; } my_transform.position = col.gameObject.transform.position + d; GameObject explode_instance = (GameObject)Instantiate(explode, my_transform.position, explode.transform.rotation); } } else { Debug.Log("dead tag is " + col.gameObject.tag); if (col.tag == Common_data.BARELL_COLLIDER_TAG || col.tag == Common_data.TRAP_COLLIDER_TAG) { return; } if (move_direction == 1) { if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG) { return; } } else if (move_direction == 2) { if (col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG) { return; } } else if (move_direction == 3) { if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.STREET_TAG) { return; } } else if (move_direction == 4) { if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG) { return; } } initActionState(); player.CrossFade("dead_end", 0); last_move = move_direction; move_direction = -1; dead_position = my_transform.position; GameObject explode_instance = (GameObject)Instantiate(explode, dead_position, explode.transform.rotation); dead(); Destroy(this.gameObject.GetComponent <BoxCollider2D>()); } }
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(); } } }