Пример #1
0
    void OnMouseDown()
    {
        Globals.action = true;
        if (Globals.action)
        {
            if (Globals.inside_engine) // If I am inside the engine case
            {
                // Find and select the other object to swap (Engine)
                other_obj = GameObject.Find("Engine");

                // Swap object
                sw_obj.swap(Sat_V2, other_obj);
            }
            else if (Globals.inside_payload) // If I am inside the payload case
            {
                if (Globals.inside_LEM)      // If I am inside the LEM case
                {
                    other_obj = GameObject.Find("LEM");
                    sw_obj.swap(Sat_V2, other_obj);
                }
                else if (Globals.inside_skylab) // If I am inside the skylab case
                {
                    other_obj = GameObject.Find("Skylab");
                    sw_obj.swap(Sat_V2, other_obj);
                }
                else // If I am in the payload menu section
                {
                    // Don't swap anything
                }
            }

            Globals.action = false;
            resetStaticVariables();
            resetButtonPosition();
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        // Move pointer (Finger indicator)

        GameObject           Test_button = GameObject.Find("Test_button");
        test_camera_image_V2 test_camera_image_V2_script = Test_button.GetComponent <test_camera_image_V2>();

        Vector3 coord = test_camera_image_V2_script.cameraToWorldCoord(x_coord + 30, y_coord - 40);

        GameObject finger_indicator = GameObject.Find("Finger Indicator");

        finger_indicator.transform.position = coord;

        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // Detect action

        if (Globals.action)
        {
            sw_obj = GameObject.Find("swap_object_support").GetComponent <swapObject>();

            if (Globals.select_engine && Globals.inside_engine == false)
            {
                // Select the object to swap (Saturn V and F1 Engine)
                GameObject Sat_V     = GameObject.Find("Sat_V2");
                GameObject F1_engine = GameObject.Find("Engine");

                // Swap object
                sw_obj.swap(Sat_V, F1_engine);

                Globals.inside_engine = true;
                removeButton();
            }
            else if (Globals.select_payload && Globals.inside_payload == false)
            {
                Globals.inside_payload = true;
                GameObject.Find("Back_button").transform.position = new Vector3(-718, 345, 1977.315f);

                sw_obj.swap(GameObject.Find("Payload_button"), GameObject.Find("LEM_button"));
                sw_obj.swap(GameObject.Find("Engine_button"), GameObject.Find("Skylab_button"));
            }
            else if (Globals.select_LEM && Globals.inside_payload)
            {
                // Select the object to swap (Saturn V and LEM)
                GameObject Sat_V = GameObject.Find("Sat_V2");
                GameObject LEM   = GameObject.Find("LEM");

                // Swap object
                sw_obj.swap(Sat_V, LEM);

                Globals.inside_LEM = true;
                removeButton();
            }
            else if (Globals.select_skylab && Globals.inside_payload)
            {
                // Select the object to swap (Saturn V and Skylab)
                GameObject Sat_V  = GameObject.Find("Sat_V2");
                GameObject Skylab = GameObject.Find("Skylab");

                // Swap object
                sw_obj.swap(Sat_V, Skylab);

                Globals.inside_skylab = true;
                removeButton();
            }

            Globals.action = false;
        }
    }