ObjectInteraction.CombineObject C# (CSharp) Method

CombineObject() public method

public CombineObject ( GameObject InputObject1, GameObject InputObject2 ) : GameObject
InputObject1 GameObject
InputObject2 GameObject
return GameObject
    public GameObject CombineObject(GameObject InputObject1, GameObject InputObject2)
    {
        //Combines two objects per the UW1/UW2 cmb.dat lists
                int[] lstInput1= new int[8];
                int[] lstInput2= new int[8];
                int[] lstOutput= new int[8];
                int[] lstDestroy1= new int[8];
                int[] lstDestroy2= new int[8];
                int ItemID1 = InputObject1.GetComponent<ObjectInteraction>().item_id;
                int ItemID2 = InputObject2.GetComponent<ObjectInteraction>().item_id;
                bool Destroyed1=false;
                bool Destroyed2=false;
                //UW1 List
                // a_lit_torch(149)(d:0) + a_block_of_incense_blocks_of_incense(278)(d:1) = a_block_of_burning_incense_blocks_of_burning_incense(277)
                // the_Key_of_Truth(225)(d:1) + the_Key_of_Love(226)(d:1) = a_two_part_key(230)
                // the_Key_of_Truth(225)(d:1) + the_Key_of_Courage(227)(d:1) = a_two_part_key(228)
                // the_Key_of_Love(226)(d:1) + the_Key_of_Courage(227)(d:1) = a_two_part_key(229)
                // the_Key_of_Truth(225)(d:1) + a_two_part_key(229)(d:1) = the_Key_of_Infinity(231)
                // the_Key_of_Love(226)(d:1) + a_two_part_key(228)(d:1) = the_Key_of_Infinity(231)
                // the_Key_of_Courage(227)(d:1) + a_two_part_key(230)(d:1) = the_Key_of_Infinity(231)
                // a_lit_torch(149)(d:0) + an_ear_of_corn_ears_of_corn(180)(d:1) = some_popcorn_bunches_of_popcorn(183)
                // some_strong_thread_pieces_of_strong_thread(284)(d:1) + a_pole(216)(d:1) = a_fishing_pole(299)

                //UW2 List
                //a_pole(216)(d:1) + some_thread&pieces_of_thread(300)(d:1) = a_fishing_pole(299)
                //some_thread&pieces_of_thread(300)(d:1) + a_lump_of_wax&lumps_of_wax(210)(d:1) = a_candle(146)
                //a_lit_torch(149)(d:0) + an_ear_of_corn&ears_of_corn(180)(d:1) = some_popcorn&bunches_of_popcorn(183)
                //a_lit_torch(149)(d:0) + a_honeycomb(186)(d:1) = a_lump_of_wax&lumps_of_wax(210)
                //a_nutritious_wafer(191)(d:1) + a_bottle_of_water&bottles_of_water(188)(d:1) = a_bottle_of_ale&bottles_of_ale(187)

                //Debug.Log ("combining" +ItemID1 + " and " + ItemID2 + " in game " + playerUW.game);
                switch (GameWorldController.instance.game.ToUpper())
                {
                case "UW1"://uw1
                        {
                                lstInput1= new int[9]{149,225,225,226,225,226,227,149,284};
                                lstDestroy1 =new int[9]{0,1,1,1,1,1,1,0,1};
                                lstInput2 =new int[9]{278,226,227,227,229,228,230,180,216};
                                lstDestroy2=new int[9]{1,1,1,1,1,1,1,1,1};
                                lstOutput =new int[9]{277,230,228,229,231,231,231,183,299};
                        }
                        break;
                case "UW2"://uw2
                        lstInput1= new int[5]{216,300,149,149,191};
                        lstDestroy1=new int[5]{1,1,0,0,1};
                        lstInput2 =new int[5]{300,300,180,186,188};
                        lstDestroy2=new int[5]{1,1,1,1,1};
                        lstOutput =new int[5]{299,146,183,210,187};
                        break;
                }

                for (int i =0; i <= lstInput1.GetUpperBound(0);i++)
                {
                        //Debug.Log (i + " is " + lstInput1[i] + " and " + lstInput2[i]);
                        if
                                (//Check both input lists for the two items
                                        ((ItemID1 == lstInput1[i]) && (ItemID2==lstInput2[i]))
                                        ||
                                        ((ItemID2 == lstInput1[i]) && (ItemID1==lstInput2[i]))
                                )
                        {//Matching combination.
                                Debug.Log ("Creating a " + lstOutput[i]);
                                if((lstInput1[i] == ItemID1) && (lstDestroy1[i]==1) && (Destroyed1==false) )
                                {
                                        Debug.Log("Destroying " + InputObject1.name);
                                        Destroyed1=true;
                                }
                                if((lstInput1[i] == ItemID2) && (lstDestroy1[i]==1)&& (Destroyed2==false) )
                                {
                                        Debug.Log("Destroying " + InputObject2.name);
                                        Destroyed2=true;
                                }
                                if((lstInput2[i] == ItemID1) && (lstDestroy2[i]==1) && (Destroyed1==false))
                                {
                                        Debug.Log("Destroying " + InputObject1.name);
                                        Destroyed1=true;
                                }
                                if((lstInput2[i] == ItemID2) && (lstDestroy2[i]==1)&& (Destroyed2==false) )
                                {
                                        Debug.Log("Destroying " + InputObject2.name);
                                        Destroyed2=true;
                                }

                                if (Destroyed1==true)
                                {
                                        InputObject1.GetComponent<ObjectInteraction>().consumeObject();
                                }
                                if (Destroyed2==true)
                                {
                                        InputObject2.GetComponent<ObjectInteraction>().consumeObject();
                                }

                                ObjectInteraction CreatedObjectInt = CreateNewObject (lstOutput[i]);
                                if (CreatedObjectInt != null) {
                                        CreatedObjectInt.UpdateAnimation ();
                                        CreatedObjectInt.PickedUp=true;
                                        UWHUD.instance.CursorIcon = CreatedObjectInt.GetInventoryDisplay ().texture;
                                }
                                UWCharacter.InteractionMode=UWCharacter.InteractionModePickup;
                                InteractionModeControl.UpdateNow=true;
                                return CreatedObjectInt.gameObject;
                        }
                }

                return null;
    }