Exemplo n.º 1
0
        private void OnValidate()
        {
            var col = GetComponent <Collider>();

            if (!col)
            {
                ManagedLog.LogError($"{Internal_GameObject.name} doesn't have any Collider component!", gameObject);
            }
            if (col && !col.isTrigger
                #region Editor
                && UnityEditor.EditorUtility.DisplayDialog("TriggerEvent", "TriggerEvent collider is not set as trigger, set it now?", "OK", "Cancel")
                #endregion
                )
            {
                col.isTrigger = true;
            }

            if (!_PhysicsObject)
            {
                _PhysicsObject = GetComponent <PhysicsObject>();
            }
            if (!_PhysicsObject)
            {
                _PhysicsObject = Internal_GameObject.AddComponent <PhysicsObject>();
            }
        }
Exemplo n.º 2
0
        public UniformScale(
            Transform transform,
            float duration,
            float targetScale,
            float delay    = 0f,
            EaseCurve?ease = null,
            string name    = null,
            OperationSkipCondition skipCondition = null)
        {
            _targetScale   = targetScale;
            _transform     = transform;
            _duration      = duration;
            Delay          = delay;
            _skipCondition = skipCondition;

            _ease = ease;

            _updateAction = UpdateAction;

            Name = name ?? $"{(_transform ? _transform.name + " "  : "")} {nameof(UniformScale)}";

            BindTo(transform);

#if UNITY_EDITOR    // Check if initial scale is uniform.
            if (Math.Abs(_transform.localScale.x - _transform.localScale.y) > Mathf.Epsilon ||
                Math.Abs(_transform.localScale.x - _transform.localScale.z) > Mathf.Epsilon)
            {
                ManagedLog.LogError($"{transform.name} is scale is not uniform.");
            }
#endif
        }
Exemplo n.º 3
0
        public void SetIsVisible(bool isVisible)
        {
            Internal_GameObject.SetActive(isVisible);

#if UNITY_EDITOR
            if (!Internal_GameObject.activeInHierarchy)
            {
                var firstDisabledParent = FindDisabledParent(Internal_Transform);
                ManagedLog.LogError($"{gameObject.GetScenePath()} will not be visible because one of it's parents ({firstDisabledParent.gameObject.GetScenePath()} is disabled. ");
            }
            Transform FindDisabledParent(Transform t)
            {
                while (true)
                {
                    if (!t.parent.gameObject.activeSelf)
                    {
                        return(t.parent);
                    }
                    if (t.parent == null)
                    {
                        return(null);
                    }
                    t = t.parent;
                }
            }
#endif
        }
Exemplo n.º 4
0
 public static void Stop(Coroutine coroutine)
 {
     if (coroutine == null)
     {
         ManagedLog.LogError($"Tried to stop a null coroutine.");
         return;
     }
     Runner.StopCoroutine(coroutine);
 }