CreateObjectInteraction() public static méthode

public static CreateObjectInteraction ( GameObject myObj, GameObject parentObj, float DimX, float DimY, float DimZ, float CenterY, string WorldString, string InventoryString, string EquipString, int ItemType, int ItemId, int link, int Quality, int Owner, int isMoveable, int isUsable, int isAnimated, int useSprite, int isQuant, int isEnchanted, int flags, int inUseFlag ) : ObjectInteraction
myObj GameObject
parentObj GameObject
DimX float
DimY float
DimZ float
CenterY float
WorldString string
InventoryString string
EquipString string
ItemType int
ItemId int
link int
Quality int
Owner int
isMoveable int
isUsable int
isAnimated int
useSprite int
isQuant int
isEnchanted int
flags int
inUseFlag int
Résultat ObjectInteraction
    private void CreateRuneStone(int ItemID)
    {
        string     Item  = ItemID.ToString("000");
        GameObject myObj = new GameObject("SummonedObject_" + playerUW.PlayerMagic.SummonCount++);

        myObj.layer = LayerMask.NameToLayer("UWObjects");
        //myObj.transform.position = playerUW.playerInventory.InventoryMarker.transform.position;
        //myObj.transform.parent=playerUW.playerInventory.InventoryMarker.transform;
        ObjectInteraction.CreateObjectGraphics(myObj, "Sprites/OBJECTS_224", true);
        ObjectInteraction.CreateObjectInteraction(myObj, 0.5f, 0.5f, 0.5f, 0.5f, "Sprites/OBJECTS_224", "Sprites/OBJECTS_" + Item, "Sprites/OBJECTS_" + Item, ObjectInteraction.RUNE, 224, 1, 40, 0, 1, 1, 0, 1, 1, 0, 0, 1);

        myObj.AddComponent <RuneStone>();

        myObj.transform.position = new Vector3(64.5f, 4.0f, 24.5f);
        WindowDetect.UnFreezeMovement(myObj);
    }
    GameObject CreateFish()
    {    //Create food
        //int ObjectNo = 182;
        GameObject myObj = new GameObject("SummonedObject_" + playerUW.PlayerMagic.SummonCount++);

        myObj.layer = LayerMask.NameToLayer("UWObjects");
        myObj.transform.position = playerUW.playerInventory.InventoryMarker.transform.position;
        myObj.transform.parent   = playerUW.playerInventory.InventoryMarker.transform;
        ObjectInteraction.CreateObjectGraphics(myObj, "Sprites/OBJECTS_182", true);
        //CreateObjectInteraction(myObj,0.5f,0.5f,0.5f,0.5f, "Sprites/OBJECTS_" +ObjectNo, "Sprites/OBJECTS_"+ObjectNo, "Sprites/OBJECTS_"+ObjectNo, ObjectInteraction.FOOD, ObjectNo, 1, 40, 0, 1, 0, 1);
        ObjectInteraction.CreateObjectInteraction(myObj, 0.5f, 0.5f, 0.5f, 0.5f, "Sprites/OBJECTS_182", "Sprites/OBJECTS_182", "Sprites/OBJECTS_182", ObjectInteraction.FOOD, 182, 1, 40, 0, 1, 1, 0, 1, 1, 0, 0, 1);

        Food fd = myObj.AddComponent <Food>();

        fd.Nutrition = 5;      //TODO:determine values to use here.
        return(myObj);
    }
    public int item_type;    //The type of the object created

    public override void ExecuteTrap(int triggerX, int triggerY, int State)
    {
        //Debug.Log ("an arrow trap has gone off. It will spawn a " + item_index + " of type " + item_type + " along vector " + this.gameObject.transform.rotation);
        GameObject myObj = new GameObject("SummonedObject_" + playerUW.PlayerMagic.SummonCount++);

        myObj.layer = LayerMask.NameToLayer("UWObjects");
        myObj.transform.position = this.transform.position;
        myObj.transform.rotation = this.transform.rotation;
        //myObj.transform.parent=playerUW.playerInventory.InventoryMarker.transform;
        ObjectInteraction.CreateObjectGraphics(myObj, "Sprites/OBJECTS_" + item_index, true);
        ObjectInteraction.CreateObjectInteraction(myObj, 0.5f, 0.5f, 0.5f, 0.5f, "Sprites/OBJECTS_" + item_index.ToString("000"), "Sprites/OBJECTS_" + item_index.ToString("000"), "Sprites/OBJECTS_" + item_index, item_type, item_index, 0, objInt.Quality, objInt.Owner, 1, 1, 0, 1, 0, 0, 0, 1);
        myObj.AddComponent <object_base>();

        //Vector3 ThrowDir;// =myObj.transform.position + (myObj.transform.rotation.eulerAngles.normalized);
        WindowDetectUW.UnFreezeMovement(myObj);
        //ThrowDir = myObj.transform.position + (myObj.transform.forward);
        //Debug.Log (objInt.transform.name + " " + myObj.transform.position  + " to " + ThrowDir + " via " + myObj.transform.rotation.eulerAngles.normalized);
        //myObj.GetComponent<Rigidbody>().AddForce(ThrowDir* 10.0f);
        myObj.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.Continuous;
        myObj.GetComponent <Rigidbody>().AddForce(myObj.transform.forward * 50.0f * ((float)(objInt.Owner)));

        //myObj.transform.position=ThrowDir;
    }
    public bool 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 (playerUW.game)
        {
        case 1:        //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 2:        //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();
                }

                //Create the new object
                GameObject myObj = new GameObject("SummonedObject_" + playerUW.PlayerMagic.SummonCount++);
                myObj.layer = LayerMask.NameToLayer("UWObjects");
                myObj.transform.position = playerUW.playerInventory.InventoryMarker.transform.position;
                myObj.transform.parent   = playerUW.playerInventory.InventoryMarker.transform;
                ObjectInteraction.CreateObjectGraphics(myObj, "Sprites/OBJECTS_" + lstOutput[i], true);

                switch (lstOutput[i])
                {
                case 299:                //Fishing pole
                    ObjectInteraction.CreateObjectInteraction(myObj, 0.5f, 0.5f, 0.5f, 0.5f, "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), ObjectInteraction.FISHING_POLE, lstOutput[i], 1, 40, 0, 1, 1, 0, 1, 1, 0, 0, 1);
                    myObj.AddComponent <FishingPole>(); break;

                case 183:                //Popcorn
                    ObjectInteraction.CreateObjectInteraction(myObj, 0.5f, 0.5f, 0.5f, 0.5f, "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), ObjectInteraction.FOOD, lstOutput[i], 1, 40, 0, 1, 1, 0, 1, 1, 0, 0, 1);
                    Food fd = myObj.AddComponent <Food>();
                    fd.Nutrition = 5;
                    break;

                default:
                    ObjectInteraction.CreateObjectInteraction(myObj, 0.5f, 0.5f, 0.5f, 0.5f, "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), "Sprites/OBJECTS_" + lstOutput[i].ToString("000"), 23, lstOutput[i], 1, 40, 0, 1, 1, 0, 1, 1, 0, 0, 1);
                    myObj.AddComponent <object_base>(); break;
                }
                playerUW.playerInventory.ObjectInHand = myObj.name;
                ObjectInteraction CreatedObjectInt = myObj.GetComponent <ObjectInteraction>();
                if (CreatedObjectInt != null)
                {
                    CreatedObjectInt.UpdateAnimation();
                    playerUW.CursorIcon = CreatedObjectInt.InventoryDisplay.texture;
                }

                UWCharacter.InteractionMode      = UWCharacter.InteractionModePickup;
                InteractionModeControl.UpdateNow = true;
                return(true);
            }
        }

        return(false);
    }