Ejemplo n.º 1
0
        public bool IsValid(out string message)
        {
            if (string.IsNullOrEmpty(eventID))
            {
                message = "[EventTarget] EventID is missing";
                return(false);
            }

            if (parameter == null || parameter.IsValid())
            {
                message = "[EventTarget] Parameter is invalid";
                return(false);
            }

            message = "EventTarget is valid.";
            return(true);
        }
Ejemplo n.º 2
0
        //=====================================================================================================================//
        //=================================================== Public Methods ==================================================//
        //=====================================================================================================================//

        #region Public Methods

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool IsValid(out string message)
        {
            if (gameObject == null)
            {
                message = "[GameObjectTarget] Target GameObject is null.";
                return(false);
            }

            if (action == ActionType.BroadcastToListeners && (cachedListeners == null || cachedListeners.Count == 0))
            {
                message = "[GameObjectTarget] Broadcast has no target listeners.";
                return(false);
            }

            if ((action == ActionType.SendMessage || action == ActionType.BroadcastMessage) && (string.IsNullOrEmpty(_methodName) || !parameter.IsValid()))
            {
                message = "[GameObjectTarget] SendMessage method is null or parameter is invalid.";
                return(false);
            }

            message = "GameObjectTarget is valid.";
            return(true);
        }
Ejemplo n.º 3
0
        public bool IsValid(out string message)
        {
            if (_gameObject == null)
            {
                ClearReferences(true);
                message = "[BehaviourTarget] GameObject is null!";
                return(false);
            }

            if (action == ActionType.Disable || action == ActionType.Enable)
            {
                switch (type)
                {
                case BehaviourType.Behaviour:
                    ClearAllExcept(behaviour);
                    if (behaviour == null)
                    {
                        message = "[BehaviourTarget] Target Behaviour is null!";
                        return(false);
                    }
                    break;

                case BehaviourType.Cloth:
                    ClearAllExcept(cloth);
                    if (cloth == null)
                    {
                        message = "[BehaviourTarget] Target Cloth is null!";
                        return(false);
                    }

                    break;

                case BehaviourType.Collider:
                    ClearAllExcept(collider);
                    if (collider == null)
                    {
                        message = "[BehaviourTarget] Target Collider is null!";
                        return(false);
                    }

                    break;

                case BehaviourType.LODGroup:
                    ClearAllExcept(lodGroup);
                    if (lodGroup == null)
                    {
                        message = "[BehaviourTarget] Target LODGroup is null!";
                        return(false);
                    }

                    break;

                case BehaviourType.Renderer:
                    ClearAllExcept(renderer);
                    if (renderer == null)
                    {
                        message = "[BehaviourTarget] Target Renderer is null!";
                        return(false);
                    }

                    break;
                }
            }
            else
            {
                ClearReferences();

                if (behaviour == null)
                {
                    _methodName = "";
                    _methodIdx  = -1;
                    message     = "[BehaviourTarget] Target Behaviour is null!";
                    return(false);
                }

                if (action == ActionType.InvokeMethod && (string.IsNullOrEmpty(_methodName) || !_methodArg.IsValid()))
                {
                    message = "[BehaviourTarget] Target Method is invalid!";
                    return(false);
                }
            }

            message = "BehaviourTarget is valid";
            return(true);
        }