コード例 #1
0
        public ColliderOverlapResult GatherColliders(float duration = 0f)
        {
            if (!this.gameObject.activeSelf)
            {
                this.gameObject.SetActive(true);
            }
            if (!this.enabled)
            {
                this.enabled = true;
            }

            var result = new ColliderOverlapResult();

            this.StartCoroutine(this.WaitToGatherColliders(duration, result));
            return(result);
        }
コード例 #2
0
        private System.Collections.IEnumerator WaitToGatherColliders(float duration, ColliderOverlapResult result)
        {
            _currentTests.Add(result);

            var rb = this.GetComponent <Rigidbody>();

            if (rb != null)
            {
                rb.WakeUp();
            }

            yield return(new WaitForSeconds(duration));

            _currentTests.Remove(result);
            if (_currentTests.Count == 0)
            {
                this.enabled = false;
            }

            result.Internal_Set();
        }