Esempio n. 1
0
        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 4)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]))
            {
                return false;
            }

            float posX, posY, posZ;
            if( !float.TryParse(eventParams[1], out posX) ||
                !float.TryParse(eventParams[2], out posY) ||
                !float.TryParse(eventParams[3], out posZ) )
            {
                return false;
            }

            if (!target.HasProperty("EntityName") || !target.HasProperty("Target"))
            {
                return false;
            }

            UnityEngine.Vector3 targetPosition = new UnityEngine.Vector3();
            targetPosition.x = posX;
            targetPosition.y = posY;
            targetPosition.z = posZ;

            target.SetProperty("EntityName", eventParams[0]);
            target.SetProperty("Target", targetPosition);
            return true;
        }
Esempio n. 2
0
        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 2)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]))
            {
                return false;
            }

            float duration;
            if (!float.TryParse(eventParams[1], out duration))
            {
                return false;
            }

            if(!target.HasProperty("Name") || !target.HasProperty("Duration"))
            {
                return false;
            }

            target.SetProperty("Name", eventParams[0]);
            target.SetProperty("Duration", duration);
            return true;
        }
        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 2)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]) || string.IsNullOrEmpty(eventParams[1]))
            {
                return false;
            }
            if (!target.HasProperty("EntityName") || !target.HasProperty("ComponentName"))
            {
                return false;
            }

            target.SetProperty("EntityName", eventParams[0]);
            target.SetProperty("ComponentName", eventParams[1]);
            return true;
        }
Esempio n. 4
0
        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 1)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]))
            {
                return false;
            }
            if (!target.HasProperty("SceneName"))
            {
                return false;
            }

            target.SetProperty("SceneName", eventParams[0]);
            return true;
        }