void Object_Check() { // Find out if an object was seen when it wasn't meant to be foreach (var dupe in duplicate_player_list) { if (dupe.paradox_suspicion > 0.0f) { dupe.paradox_suspicion -= (1.0f * time_speed); } foreach (var visible_obj in dupe_objs) { foreach (var cam in visible_obj.vis.seen_cams) { if (visible_obj.obj != null) { if (cam == dupe.obj.GetComponentInChildren <Camera>()) { bool is_obj_new = true; if (timeline_memory[dupe.timestamp].is_obj_seen) { foreach (var obj in timeline_memory[dupe.timestamp].seen_objs) { if (Vector3.Distance(obj.position, visible_obj.obj.transform.position) <= 1.5f) { is_obj_new = false; } } } if (is_obj_new) { //Debug.Log("NEW"); dupe.paradox_suspicion += (2.0f * time_speed); //Debug.Log("Suspicion: " + dupe.paradox_suspicion); } if (dupe.paradox_suspicion >= 15.0f) { Debug.Log("NEW: OBJECT NAME: " + visible_obj.obj.name + " + POSITION: " + visible_obj.obj.transform.position); Activate_Paradox_Increment(1.0f); dupe.paradox_suspicion = 0.0f; } } } } } // Find next time this object is seen if (dupe.has_obj_check_completed == false) { if (timeline_memory[dupe.timestamp].is_obj_seen == true) { foreach (var obj_check in timeline_memory[dupe.timestamp].seen_objs) { bool is_completion_time_found = false; //int current_timestamp_check = timeline_memory[dupe.timestamp].next_obj_seen_timestamp; int current_timestamp_check = dupe.timestamp + 1; int counter = 0; while (!is_completion_time_found) { if (timeline_memory[current_timestamp_check].seen_objs != null) { foreach (var obj in timeline_memory[current_timestamp_check].seen_objs) { if (Vector3.Distance(obj_check.position, obj.position) <= 1.0f) { is_completion_time_found = true; if ((current_timestamp_check == 0) /* || (timeline_memory[current_timestamp_check].timestamp >= (iteration_delay * (iteration_num - dupe.iter_num)))*/) { is_completion_time_found = true; } else { GameObject new_marker = Instantiate(marker, obj.position, new Quaternion()); snap_markers.Add(new_marker); Align_Check marker_script = new_marker.GetComponent <Align_Check>(); marker_script.completion_time = timeline_memory[current_timestamp_check].timestamp + (iteration_delay * dupe.iter_num); marker_script.obj_tag = obj.tag; } } } } if (!is_completion_time_found) { //current_timestamp_check = timeline_memory[current_timestamp_check].next_obj_seen_timestamp; current_timestamp_check++; } if (current_timestamp_check >= timeline_memory.Count) { is_completion_time_found = true; } counter++; } } //Debug.Log(dupe.iter_num + " : " + (current_timestamp_check - dupe.timestamp)); } } if (dupe.has_door_check_completed == false) { if (timeline_memory[dupe.timestamp].door_data_record != null) { foreach (var door in timeline_memory[dupe.timestamp].door_data_record) { bool is_completion_time_found = false; //int current_timestamp_check = timeline_memory[dupe.timestamp].next_obj_seen_timestamp; int current_timestamp_check = dupe.timestamp + 1; int counter = 0; while (!is_completion_time_found) { if (timeline_memory[current_timestamp_check].door_data_record != null) { foreach (var door_data in timeline_memory[current_timestamp_check].door_data_record) { if (door.door_activation == door_data.door_activation) { is_completion_time_found = true; if ((current_timestamp_check == 0) /* || (timeline_memory[current_timestamp_check].timestamp >= (iteration_delay * (iteration_num - dupe.iter_num)))*/) { is_completion_time_found = true; } else { //Debug.Log("DOOR TIMER AT: " + timeline_memory[current_timestamp_check].timestamp); GameObject new_marker = Instantiate(door_marker, door_data.door_obj.transform.position, new Quaternion()); Door_State_Check state_checker = new_marker.GetComponent <Door_State_Check>(); state_checker.Set_Linked_Door(door.door_activation); state_checker.expected_state = door_data.last_state; state_checker.completion_time = timeline_memory[current_timestamp_check].timestamp + (iteration_delay * dupe.iter_num); snap_markers.Add(new_marker); } } } } if (!is_completion_time_found) { //current_timestamp_check = timeline_memory[current_timestamp_check].next_obj_seen_timestamp; current_timestamp_check++; } if (current_timestamp_check >= timeline_memory.Count) { is_completion_time_found = true; } counter++; } } } } dupe.has_obj_check_completed = true; dupe.has_door_check_completed = true; } List <GameObject> temp_markers = new List <GameObject>(); foreach (var marker in snap_markers) { if (marker != null) { Align_Check object_align = marker.GetComponent <Align_Check>(); Door_State_Check door_check = marker.GetComponent <Door_State_Check>(); if (object_align != null) { object_align.current_time = current_time; temp_markers.Add(marker); } else if (door_check != null) { door_check.current_time = current_time; temp_markers.Add(marker); } } } snap_markers.Clear(); snap_markers = temp_markers; }
private void Skip_Dupes_Forward() { foreach (var time_dupe in duplicate_player_list) { int dupe_timestamp = time_dupe.timestamp; bool is_skip_done = false; foreach (var jump_timestamp in time_jump_timestamps) { if (!is_skip_done) { if (jump_timestamp == dupe_timestamp) { is_skip_done = true; } else if (jump_timestamp > dupe_timestamp) { if (timeline_memory[jump_timestamp].held_object_tag != timeline_memory[time_dupe.timestamp].held_object_tag) { if ((timeline_memory[jump_timestamp].is_holding_object) && (!timeline_memory[time_dupe.timestamp].is_holding_object)) { GameObject obj_to_be_held = null; foreach (var obj_type in object_type_list) { if (timeline_memory[jump_timestamp].held_object_tag == obj_type.tag) { obj_to_be_held = obj_type.obj; } } Set_Grabbed_Item(time_dupe, obj_to_be_held); } else if ((!timeline_memory[jump_timestamp].is_holding_object) && (timeline_memory[time_dupe.timestamp].is_holding_object)) { Destroy_Grabbed_Item(time_dupe); } else { Destroy_Grabbed_Item(time_dupe); GameObject obj_to_be_held = null; foreach (var obj_type in object_type_list) { if (timeline_memory[jump_timestamp].held_object_tag == obj_type.tag) { obj_to_be_held = obj_type.obj; } } Set_Grabbed_Item(time_dupe, obj_to_be_held); } } time_dupe.timestamp = jump_timestamp; is_skip_done = true; } } } } // Snap marker jump calculations foreach (var marker in snap_markers) { if (marker != null) { Align_Check align_marker = marker.GetComponent <Align_Check>(); if (align_marker != null) { float completion_time = align_marker.completion_time; if (completion_time < iteration_delay * iteration_num) { align_marker.completion_time += iteration_delay; Debug.Log("Forward"); } } } } }