// Update is called once per frame
    void Update()
    {
        if (doGroundedChecks && groundCheckCooldown <= 0 && IsOnGround()) // super hacky
        {
            OnObjectLanded?.Invoke(this);
            doGroundedChecks    = false;
            groundCheckCooldown = maxGroundCheckInterval;
        }

        if (groundCheckCooldown > 0)
        {
            groundCheckCooldown -= Time.deltaTime;
        }

        if (noChildCheckCooldown > 0)
        {
            noChildCheckCooldown -= Time.deltaTime;
        }
        else if (doNoChildChecks)
        {
            if (transform.childCount <= 0)
            {
                OnObjectLanded?.Invoke(this);
            }
            noChildCheckCooldown = noChildCheckInterval;
        }
    }
Пример #2
0
        private IEnumerator ServerRunObjectSequence(GameObject entity, PortalSpawnInfo settings)
        {
            yield return(WaitFor.Seconds(GetFallingTime(settings.PortalHeight)));

            OnObjectLanded?.Invoke(entity);
        }