Пример #1
0
    void InteractWithNearestObject()
    {
        GameObject nearestObject = Utils.FindNearestObject(gameObject, objectsInRange);

        if (nearestObject)
        {
            PlayerAndNearObjects playerAndList = new PlayerAndNearObjects(gameObject, objectsInRange);
            nearestObject.SendMessage("InteractWithPlayer", playerAndList);
        }
    }
Пример #2
0
 public void InteractWithPlayer(PlayerAndNearObjects playerAndList)
 {
     playerAndList.player.GetComponent <Inventory>().AddToInventory(gameObject);
     playerAndList.objectsInRange.Remove(gameObject);
 }