예제 #1
0
        private void Update()
        {
            if (_gc.InteractThisFrame())
            {
                if (_closest != null)
                {
                    _closest.BroadcastMessage("OnCharacterInteract", gameObject, SendMessageOptions.DontRequireReceiver);

                    // prevent from interacting 2 times with object
                    _closest = null;
                }
                else
                {
                    BroadcastMessage("OnNoInteractableFound", SendMessageOptions.DontRequireReceiver);
                }
            }

            if (_gc.CancelThisFrame())
            {
                for (int i = 0; i < _nbObjectFound; i++)
                {
                    var foundObject = _foundObjects[i];

                    if (foundObject.CompareTag(interactingTag))
                    {
                        foundObject.BroadcastMessage("OnStopInteraction");
                    }
                }
            }
        }
예제 #2
0
 private void Update()
 {
     if (_storedResource != null && _gc.CancelThisFrame())
     {
         LetResourceDown();
     }
 }