Example #1
0
        public bool isTowerOnPath(TDTower t)
        {
            // first check if intersting any corner
            TDPathPoint lastPoint = null;

            foreach (TDPath p in this.Paths)
            {
                foreach (TDPathPoint pp in p.PathPoints)
                {
                    if (TDMath.Intersects(t.Location, t.Size, pp.Location, GridSize))
                    {
                        return(true);
                    }
                    else
                    {
                        // check intersecting any line
                        if (lastPoint != null)
                        {
                            if (TDMath.Intersects(t, pp, lastPoint))
                            {
                                return(true);
                            }
                        }

                        lastPoint = pp;
                    }
                }
            }

            return(false);
        }
Example #2
0
        internal bool isTowerOnTowers(TDTower target)
        {
            foreach (TDTower t in this.Towers)
            {
                if (TDMath.Intersects(target.Location, target.Size, t.Location, t.Size))
                {
                    return(true);
                }
            }

            return(false);
        }