Ejemplo n.º 1
0
        public List <TKPhysicalObj> GetObjectsInMap(Vector2 center, float range, TKPhysicalObj except)
        {
            List <TKPhysicalObj> ret = new List <TKPhysicalObj>();

            for (int i = 0; i < m_lstObjectInMap.Count; ++i)
            {
                TKPhysicalObj phy = m_lstObjectInMap[i];
                if (phy != except &&
                    phy.IsLiving &&
                    phy.CanCollided)
                {
                    Rect t = phy.GetCollideRect();
                    t.position += phy.Position;
                    float vx = Mathf.Abs(t.center.x - center.x);
                    float vy = Mathf.Abs(t.center.y - center.y);

                    float ux = vx - t.width / 2;
                    float uy = vy - t.height / 2;

                    if (ux * ux + uy * uy < range * range)
                    {
                        ret.Add(phy);
                    }
                }
            }
            return(ret);
        }
Ejemplo n.º 2
0
 public override bool CollideByObject(TKPhysicalObj obj)
 {
     if (obj is BaseBomb)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
        public List <TKPhysicalObj> GetObjectsInMap(Rect rect, TKPhysicalObj except)
        {
            List <TKPhysicalObj> ret = new List <TKPhysicalObj>();

            for (int i = 0; i < m_lstObjectInMap.Count; ++i)
            {
                TKPhysicalObj phy = m_lstObjectInMap[i];
                if (phy != except &&
                    phy.IsLiving &&
                    phy.CanCollided)
                {
                    Rect t = phy.GetCollideRect();
                    t.position += phy.Position;
                    if (t.Overlaps(rect))
                    {
                        ret.Add(phy);
                    }
                }
            }
            return(ret);
        }
Ejemplo n.º 4
0
 public void RemoveFromMap(TKPhysicalObj obj)
 {
     m_lstObjectInMap.Remove(obj);
 }
Ejemplo n.º 5
0
 public void AddToMap(TKPhysicalObj obj)
 {
     m_lstObjectInMap.Add(obj);
 }
Ejemplo n.º 6
0
 virtual public bool CollideByObject(TKPhysicalObj obj)
 {
     return(false);
 }