Ejemplo n.º 1
0
    void Check_Paradoxes()
    {
        List <int> paradoxes_to_remove = new List <int>();

        for (int i = 0; i < paradoxes.Count; i++)
        {
            Collider[] col_array = Physics.OverlapSphere(paradoxes[i].position, 0.3f);

            bool is_obj_present = false;
            foreach (Collider col in col_array)
            {
                Pickup_Loop temp_pickup = col.GetComponent <Pickup_Loop>();
                bool        is_dropped  = true;
                if (temp_pickup != null)
                {
                    is_dropped = !temp_pickup.is_picked_up;
                }
                if ((col.tag == paradoxes[i].tag) && (is_dropped))
                {
                    is_obj_present = true;
                }
            }

            if (paradoxes[i].object_present_state == is_obj_present)
            {
                paradoxes_to_remove.Add(i);
            }
        }

        foreach (var index in paradoxes_to_remove)
        {
            Destroy(paradoxes[index].warning_indicator);
            paradoxes.RemoveAt(index);
        }
    }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     tm  = GameObject.FindGameObjectWithTag("Timeline_Manager").GetComponent <Timeline_Manager>();
     pl  = GetComponent <Pickup_Loop>();
     mr  = GetComponent <MeshRenderer>();
     col = GetComponent <Collider>();
     rb  = GetComponent <Rigidbody>();
 }
Ejemplo n.º 3
0
    public void Drop_Item()
    {
        Object_Interaction temp_obj_interaction = new Object_Interaction();

        temp_obj_interaction.objects    = grabbed_item.gameObject;
        temp_obj_interaction.pos        = grabbed_item.transform.position;
        temp_obj_interaction.grab_state = false;

        objects.Add(temp_obj_interaction);
        grabbed_item.is_picked_up = false;
        grabbed_item     = null;
        grabbed_item_obj = null;
        is_holding       = false;
    }
Ejemplo n.º 4
0
    void Camera_Check(float i_normalized_time, int timestamp_index)
    {
        Plane[] planes;

        planes = GeometryUtility.CalculateFrustumPlanes(check_player_camera);
        if (GeometryUtility.TestPlanesAABB(planes, check_obj_collider.bounds))
        {
            is_seen          = true;
            lowest_seen_time = i_normalized_time;

            bool is_original = false;

            foreach (var obj in tm.timeline_memory[timestamp_index].seen_objs)
            {
                Pickup_Loop temp_pickup = check_obj.GetComponent <Pickup_Loop>();
                Vector3     check_pos;
                if (temp_pickup != null)
                {
                    check_pos = temp_pickup.last_pos;
                }
                else
                {
                    check_pos = check_obj.transform.position;
                }


                if (Vector3.Distance(obj.position, check_pos) <= 0.4f)
                {
                    is_original = true;
                }
            }

            if (is_original)
            {
                is_obj_timeline_original = true;
            }
            else
            {
                is_obj_timeline_original = false;
            }
        }
    }
Ejemplo n.º 5
0
    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;
    }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        Collider[] found_objs = Physics.OverlapSphere(transform.position, 2.0f);


        bool is_obj_present = false;

        foreach (Collider collider in found_objs)
        {
            if (collider.tag == obj_tag)
            {
                satisfying_obj = collider.gameObject;
                is_obj_present = true;

                Pickup_Loop obj_pickup = satisfying_obj.GetComponent <Pickup_Loop>();

                if (obj_pickup != null)
                {
                    obj_pickup.snap_pos = transform.position;
                }
            }
        }

        if (is_player_altering)
        {
            if (is_obj_present)
            {
                renderer.enabled = false;
            }
            else
            {
                renderer.enabled = true;
            }
        }

        if ((holder.grabbed_item_obj == satisfying_obj) && (satisfying_obj != null))
        {
            is_player_altering = true;
        }
        else
        {
            is_player_altering = false;
        }

        if (completion_time > (tm.iteration_num * tm.iteration_delay))
        {
            Destroy(gameObject);
        }

        //if (completion_time - current_time >= 28.5f)
        //{
        //    Debug.Log("RIP");
        //    Destroy(gameObject);
        //}


        if (current_time >= completion_time - 0.1f)
        {
            col.enabled = true;
            if (is_obj_present)
            {
                if (!is_destroying)
                {
                    is_destroying = true;
                    health        = 99999999;

                    Destroy(this.gameObject);
                    //StartCoroutine(Destroy_In(0.5f));
                }
            }
            else
            {
                health--;
            }
        }

        if (health <= 0)
        {
            Debug.Log("FAILED AT POS: " + transform.position + " COMPLETION TIME: " + completion_time + "CURRENT TIME: " + current_time);
            tm.Activate_Paradox_Increment(2.0f);
            Destroy(this.gameObject);
        }
    }
Ejemplo n.º 7
0
    private void Object_Correction()
    {
        Debug.Log("Running object calc");
        for (int i = 0; i < tm.time_point_list.Count; i++)
        {
            if (tm.time_point_list[i].normalized_timestamp >= tm.modified_current_time)
            {
                if (safe_objects.Count > 0)
                {
                    foreach (var data in safe_objects)
                    {
                        bool has_match = false;
                        Time_Point_Correction_Data temp_correction = new Time_Point_Correction_Data();
                        temp_correction.index = i;
                        for (int j = 0; j < tm.time_point_list[i].object_locations.Count; j++)
                        {
                            Pickup_Loop temp_pickup = data.obj.GetComponent <Pickup_Loop>();
                            if (Vector3.Distance(data.pos, tm.time_point_list[i].object_locations[j].position) < 0.5f)
                            {
                                if (tm.time_point_list[i].object_locations[j].obj.tag == "Blue_Box")
                                {
                                    Debug.Log("BLUE BOX");
                                }
                                //Debug.Log("MATCHING OBJECT");
                                has_match = true;

                                temp_correction.is_remove     = true;
                                temp_correction.removal_index = j;

                                tm.time_point_list[i].object_locations.RemoveAt(j);
                                Debug.Log("Object Removed");
                                held_obj = temp_pickup.gameObject;

                                j = tm.time_point_list[i].object_locations.Count;
                            }
                        }

                        if (!has_match)
                        {
                            //for (int j = 0; j < tm.time_point_list[i].object_locations.Count; j++)
                            //{
                            //    Debug.Log("");
                            //    if (Vector3.Distance(data.pos, tm.time_point_list[i].object_locations[j].position) < 0.4f)
                            //    {

                            //    }

                            //}

                            foreach (var obj_type in tm.object_type_list)
                            {
                                if (obj_type.tag == data.obj.tag)
                                {
                                    temp_correction.is_create  = true;
                                    temp_correction.obj_type   = obj_type.obj;
                                    temp_correction.create_pos = data.pos;

                                    //Debug.Log("NO MATCH SPAWN");
                                    Debug.Log("Object Added");
                                    Timeline_Manager.Object_Spawns temp_spawn = new Timeline_Manager.Object_Spawns();
                                    temp_spawn.position = data.pos;
                                    temp_spawn.obj      = obj_type.obj;

                                    tm.time_point_list[i].object_locations.Add(temp_spawn);
                                    //temp_spawn = tm.time_point_list[i].object_locations[j];
                                }
                            }
                        }

                        time_point_corrections.Add(temp_correction);
                    }
                }
            }
        }
        Debug.Log("Finished check");
        Debug.Log("==========================");
    }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     pl = GetComponent <Pickup_Loop>();
     pm = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Movement>();
 }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        Physics.Raycast(transform.position, transform.forward, out hit, 5.0f, layer_collision_raycasting);

        if (hit.collider != null)
        {
            Click_Button click_button = hit.collider.GetComponent <Click_Button>();

            if (click_button != null)
            {
                click_button.is_highlighted = true;
            }
        }

        if (trigger_grab)
        {
            //Debug.Log("Trigger Grab Ran");
            trigger_grab = false;
            if (!is_holding)
            {
                //Debug.Log("is not holding");
                // Debug.Log("HIT: " + hit.collider);

                if (hit.collider != null)
                {
                    Pickup_Loop  pickup       = hit.collider.GetComponent <Pickup_Loop>();
                    Click_Button click_button = hit.collider.GetComponent <Click_Button>();

                    if (pickup != null)
                    {
                        //Debug.Log("Picked up");
                        grabbed_item_obj    = pickup.gameObject;
                        is_holding          = true;
                        pickup.is_picked_up = true;
                        grabbed_item        = pickup;

                        Object_Interaction temp_obj_interaction = new Object_Interaction();
                        temp_obj_interaction.objects    = pickup.gameObject;
                        temp_obj_interaction.pos        = pickup.transform.position;
                        temp_obj_interaction.grab_state = true;

                        objects.Add(temp_obj_interaction);
                    }
                    else if (click_button != null)
                    {
                        click_button.is_activated = !click_button.is_activated;

                        foreach (var door in click_button.doors)
                        {
                            doors.Add(door);
                        }
                    }
                }
            }
            else
            {
                Physics.Raycast(grabbed_item.transform.position, -transform.forward, out hit);

                if ((hit.collider.gameObject.CompareTag("Player")) || (hit.collider.gameObject.CompareTag("Player_Dupe")))
                {
                    Object_Interaction temp_obj_interaction = new Object_Interaction();
                    temp_obj_interaction.objects    = grabbed_item.gameObject;
                    temp_obj_interaction.pos        = grabbed_item.transform.position;
                    temp_obj_interaction.grab_state = false;

                    objects.Add(temp_obj_interaction);
                    //Debug.Log("is holding");
                    if (grabbed_item != null)
                    {
                        //Debug.Log("Dropped");
                        grabbed_item.is_picked_up = false;
                    }
                    grabbed_item = null;
                    is_holding   = false;
                }
            }
        }

        if (grabbed_item != null)
        {
            grabbed_item.hold_pos            = transform.position + (transform.forward * 1.5f);
            grabbed_item.object_holding_this = this.gameObject;
        }
    }