Example #1
0
 public void RemoveFromBlacklist(Prey _prey)
 {
     if (m_preys.Contains(_prey))
     {
         m_preys.Remove(_prey);
     }
 }
Example #2
0
        public override void Update(int timeLastFrame)
        {
            base.Update(timeLastFrame);
            if (!m_enable)
            {
                return;
            }

            m_spotPrey = null;
            Blacklist blacklist = Mgr <Scene> .Singleton.GetSharedObject(typeof(Blacklist).ToString())
                                  as Blacklist;

            ShadowSystem shadowSystem = GameObject.Scene.m_shadowSystem;

            if (blacklist != null)
            {
                foreach (Prey prey in blacklist.Preys)
                {
                    Vector2 preyPosition = prey.GetPointInWorld();
                    if (IsPointInOnLight(preyPosition))
                    {
                        Vector3 myPosition = GameObject.AbsPosition;
                        Vector2 dist       = preyPosition - new Vector2(myPosition.X, myPosition.Y);
                        if (dist.LengthSquared() > m_senseDistance * m_senseDistance &&
                            shadowSystem != null && !shadowSystem.IsPointEnlighted(preyPosition))
                        {
                            continue;
                        }
                        m_debugShape.DiffuseColor = Color.Red;
                        DiffuseColor = Color.Red;
                        m_spotPrey   = prey;
                    }
                }
            }
            if (!SpotAny())
            {
                m_debugShape.DiffuseColor = Color.Green;
                DiffuseColor = Color.Green;
            }
        }
Example #3
0
 public void AddToBlacklist(Prey _prey)
 {
     m_preys.Add(_prey);
 }