コード例 #1
0
    // 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
ファイル: SpawnByPortal.cs プロジェクト: ewy0/unitystation
        private IEnumerator ServerRunObjectSequence(GameObject entity, PortalSpawnInfo settings)
        {
            yield return(WaitFor.Seconds(GetFallingTime(settings.PortalHeight)));

            OnObjectLanded?.Invoke(entity);
        }