예제 #1
0
    void InteractWithNearestObject()
    {
        GameObject nearestObject = Utils.FindNearestObject(gameObject, objectsInRange);

        if (nearestObject)
        {
            PlayerAndNearObjects playerAndList = new PlayerAndNearObjects(gameObject, objectsInRange);
            nearestObject.SendMessage("InteractWithPlayer", playerAndList);
        }
    }
예제 #2
0
파일: BaseItem.cs 프로젝트: zacktobar13/RPG
 public void InteractWithPlayer(PlayerAndNearObjects playerAndList)
 {
     playerAndList.player.GetComponent <Inventory>().AddToInventory(gameObject);
     playerAndList.objectsInRange.Remove(gameObject);
 }