示例#1
0
        /// <summary>
        /// Apply Speed Action.
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public bool ApplyAction(ActionSpeed action)
        {
            if (action.relative)
            {
                this.speed += action.speed;
            }
            else
            {
                this.speed = action.speed;
            }

            if (this.speed < 0)
            {
                this.speed = 0;
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Apply Speed Action.
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public bool ApplyAction(ActionSpeed action)
        {
            if (action.relative)
            {
                this.speed += action.speed;
            }
            else
            {
                this.speed = action.speed;
            }

            if (this.speed < 0)
            {
                this.speed = 0;
            }

            if (_logRelativeActions && action.relative)
            {
                logger.Verbose("Speed set to " + this.speed);
            }

            return(true);
        }