Example #1
0
    public static LifetimeRequest Query(GameObject gameObject)
    {
        var request = new LifetimeRequest();

        gameObject.SendMessage(MessageName, request, SendMessageOptions.DontRequireReceiver);

        return(request);
    }
Example #2
0
    void OnLifetimeRequest(LifetimeRequest request)
    {
        if (!enabled)
        {
            return;
        }

        request.MinLifetime = IsDetonated ? 0 : LifetimeResponseValue;
    }
Example #3
0
    private IEnumerator WaitForTransientObjects()
    {
        float transientWaitStartTimestamp = Time.fixedTime;

        while (true)
        {
            float waitTimeElapsed = Time.fixedTime - transientWaitStartTimestamp;
            float maxWaitTime     = TransientObjectsMaxWaitTime - waitTimeElapsed;

            var transientObjects = LifetimeRequest
                                   .Query(CurrentPlayerOwnedObjects.Select(ownedObject => ownedObject.gameObject))
                                   .Where(objLifetime => objLifetime.MinLifetime <= maxWaitTime && objLifetime.MinLifetime > 0);

            if (transientObjects.Any())
            {
                yield return(this.WaitForFixedSeconds(0.25f));
            }
            else
            {
                break;
            }
        }
    }
Example #4
0
 void OnLifetimeRequest(LifetimeRequest request)
 {
     request.MinLifetime = TimeLeft;
 }
Example #5
0
 public ObjectLifetime(GameObject gameObject, LifetimeRequest response)
 {
     this.GameObject = gameObject;
     this.Response   = response;
 }
Example #6
0
    void OnLifetimeRequest(LifetimeRequest request)
    {
        float timeElapsed = Time.fixedTime - createdTimestamp;

        request.MinLifetime = Delay - timeElapsed;
    }
Example #7
0
 void OnLifetimeRequest(LifetimeRequest request)
 {
     request.MinLifetime = Mathf.Max(1, Duration) - TimeElapsed;
 }