public void Create_Object(String i_tag, Vector3 i_pos) { GameObject obj_to_be_held = null; foreach (var obj_type in object_type_list) { if (obj_type.tag == i_tag) { obj_to_be_held = obj_type.obj; break; } } if (obj_to_be_held != null) { GameObject new_obj = Instantiate(obj_to_be_held, i_pos, new Quaternion(0.0f, 0.0f, 0.0f, 0.0f)); objects_vis.Add(new_obj.GetComponent <Visible_Check>()); Duplicate_Data obj_data = new Duplicate_Data(); obj_data.obj = new_obj; obj_data.vis = new_obj.GetComponent <Visible_Check>(); dupe_objs.Add(obj_data); } }
void Destroy_Grabbed_Item(Duplicate_Data i_time_dupe) { i_time_dupe.object_holder.is_holding = false; Destroy(i_time_dupe.object_holder.grabbed_item_obj); i_time_dupe.object_holder.grabbed_item_obj = null; i_time_dupe.object_holder.grabbed_item = null; }
void Set_Playback_States(Duplicate_Data i_dupe) { i_dupe.obj.transform.position = Vector3.Lerp(i_dupe.obj.transform.position, timeline_memory[i_dupe.timestamp].position, 0.4f); i_dupe.obj_look_pivot.localRotation = timeline_memory[i_dupe.timestamp].view_rotation; i_dupe.obj.SetActive(!timeline_memory[i_dupe.timestamp].is_jumping); i_dupe.object_holder.gameObject.SetActive(!timeline_memory[i_dupe.timestamp].is_jumping); if ((timeline_memory[i_dupe.timestamp].is_grab_activated) && (i_dupe.has_grabbed_this_interval == false)) { i_dupe.has_grabbed_this_interval = true; i_dupe.object_holder.trigger_grab = true; } }
void Restart_Loop() { loop_restarted = true; for (int i = 0; i < time_travelling_objects.Count; i++) { time_travelling_objects[i].is_cooldown_active = false; } if (!is_jumping_to_custom_time_point) { Reset_Objects(moveable_object_spawns); foreach (var door in door_list) { door.is_door_opening = false; } } else { is_jumping_to_custom_time_point = false; } GameObject spawned_obj = Instantiate(loop_obj); Duplicate_Data dupe_data = new Duplicate_Data(); dupe_data.obj = spawned_obj; dupe_data.timestamp = 1; dupe_data.iter_num = iteration_num; dupe_data.obj_look_pivot = spawned_obj.GetComponent <Movement_Playback>().this_pivot; dupe_data.object_holder = spawned_obj.GetComponentInChildren <Hold_Object>(); dupe_data.has_grabbed_this_interval = false; dupe_data.paradox_suspicion = 0; vis.Add_Camera(spawned_obj.GetComponentInChildren <Camera>()); foreach (var obj in dupe_objs) { if (obj != null) { foreach (var cam in vis.cams) { obj.vis.Add_Camera(cam); } } } duplicate_player_list.Add(dupe_data); }
void Reset_Objects(List <Object_Spawns> i_objects_to_spawn) { foreach (var new_spawn in i_objects_to_spawn) { GameObject created_obj = Instantiate(new_spawn.obj, new_spawn.position, new Quaternion()); Duplicate_Data input_data = new Duplicate_Data(); input_data.obj = created_obj; input_data.vis = created_obj.GetComponent <Visible_Check>(); input_data.timestamp = 0; input_data.iter_num = iteration_num; dupe_objs.Add(input_data); } }
void Set_Grabbed_Item(Duplicate_Data i_time_dupe, GameObject i_object_to_be_held) { GameObject created_obj = Instantiate(i_object_to_be_held, i_time_dupe.obj.transform.position + i_time_dupe.obj.transform.forward, new Quaternion()); Duplicate_Data input_data = new Duplicate_Data(); input_data.obj = created_obj; input_data.vis = created_obj.GetComponent <Visible_Check>(); input_data.timestamp = 0; input_data.iter_num = iteration_num; dupe_objs.Add(input_data); i_time_dupe.object_holder.is_holding = true; i_time_dupe.object_holder.grabbed_item_obj = created_obj; Pickup_Loop spawned_pickup = created_obj.GetComponent <Pickup_Loop>(); i_time_dupe.object_holder.grabbed_item = spawned_pickup; spawned_pickup.object_holding_this = i_time_dupe.obj; spawned_pickup.is_picked_up = true; }