ObjectInteraction.SetWorldDisplay C# (CSharp) Method

SetWorldDisplay() public method

public SetWorldDisplay ( Sprite NewSprite ) : void
NewSprite Sprite
return void
    public void SetWorldDisplay(Sprite NewSprite)
    {
        //WorldDisplay=NewSprite;
                //sr.sprite=WorldDisplay;
                sr.sprite=NewSprite;
    }

Usage Example

Ejemplo n.º 1
0
    public void SpillContentsX()
    {                                                               //Removes the contents of a container out in the real world.
        int     counter;
        TileMap tm = GameWorldController.instance.currentTileMap(); //GameObject.Find("Tilemap").GetComponent<TileMap>();

        GameWorldController.FreezeMovement(this.gameObject);
        ObjectInteraction objInt = this.gameObject.GetComponent <ObjectInteraction>();

        objInt.SetWorldDisplay(objInt.GetEquipDisplay());
        for (short i = 0; i <= MaxCapacity(); i++)
        {
            GameObject Spilled = GetGameObjectAt(i);            //GameObject.Find (GetItemAt (i));
            if (Spilled != null)
            {
                if (Spilled.GetComponent <trigger_base>() != null)
                {
                    Spilled.GetComponent <trigger_base>().Activate(this.gameObject);
                }
                bool    flag        = false;
                Vector3 randomPoint = this.transform.position;
                counter = 0;
                while ((flag == false) && (counter < 25))
                {
                    randomPoint = this.transform.position + Random.insideUnitSphere;
                    if (randomPoint.y < this.transform.position.y)
                    {
                        randomPoint.y = this.transform.position.y + 0.1f;
                    }
                    flag = ((!Physics.CheckSphere(randomPoint, 0.5f)) && (tm.ValidTile(randomPoint)));
                    counter++;
                }
                if (flag == true)
                {                //No object interferes with the spill
                    RemoveItemFromContainer(i);
                    Spilled.transform.position = randomPoint;
                    Spilled.GetComponent <ObjectInteraction>().PickedUp = false;
                    GameWorldController.UnFreezeMovement(Spilled);
                }
                else
                {                //No where to put the item. Put it at the containers position.
                    RemoveItemFromContainer(i);
                    Spilled.transform.position = this.transform.position;
                    Spilled.GetComponent <ObjectInteraction>().PickedUp = false;
                    GameWorldController.UnFreezeMovement(Spilled);
                }
            }
        }
        GameWorldController.UnFreezeMovement(this.gameObject);
    }
All Usage Examples Of ObjectInteraction::SetWorldDisplay