Exemplo n.º 1
0
        protected new IMoveSpeed GetSpeed(IEventArgs args, FreeMoveEntity entity)
        {
            if (string.IsNullOrEmpty(useTime))
            {
                return(base.GetSpeed(args, entity));
            }
            else
            {
                if (speed == null)
                {
                    float dis = tempPosition.Distance(GetEntityPosition(entity));
                    if (realTime > 0)
                    {
                        speed = new AlwaysOneSpeed(dis / realTime);
                    }
                    else
                    {
                        speed = new AlwaysOneSpeed(5);
                    }
                }

                return(base.GetSpeed(args, entity));
            }
        }
Exemplo n.º 2
0
        public virtual bool Meet(IEventArgs args)
        {
            UnitPosition sourcePosition = source.Select(args);
            UnitPosition targetPosition = target.Select(args);

            if (sourcePosition != null && targetPosition != null)
            {
                double dis = sourcePosition.Distance(targetPosition);
                if (@out)
                {
                    return(FreeUtil.ReplaceInt(distance, args) <= dis);
                }
                else
                {
                    return(FreeUtil.ReplaceInt(distance, args) >= dis);
                }
            }
            return(false);
        }