/// <summary>
 /// Agrega o quita un personaje a la seleccion, dependiendo de si ya estaba seleccionado
 /// </summary>
 public void selectCharacter(Character ch)
 {
     if (ch.Selected)
     {
         ch.Selected = false;
         this.selectedCharacters.Remove(ch);
     }
     else
     {
         ch.Selected = true;
         this.selectedCharacters.Add(ch);
     }
 }
        public bool thereIsCollision(Character ch, out ILevelObject obj, out Vector3 n)
        {
            obj = null;

            foreach (ILevelObject colisionable in this.getPosibleColliders(ch))
                if (colisionable.collidesWith(ch, out n)){
                    obj = colisionable;
                    return true;
                }

            n = Vector3.Empty;
            return false;
        }
 private void addCharacter(Character c)
 {
     characters.Add(c);
     c.setLevel(this);
 }
        public bool isInsideVisionRange(Character target, ITerrain terrain, List<ILevelObject> obstacles)
        {
            if (target.isDead())
            {
                changeColor(false);
                return false;
            }

            Vector3 targetPoint = target.BoundingCylinder.closestCyPointToPoint(this.Position);

            if (target.Representation.isCrouched())
            {
                this.current_range = eRange.SHORT_RANGE;

            } else this.current_range = eRange.LONG_RANGE;

            if (isPointInsideCone(targetPoint))
            {
                if (terrain == null || canSeeInTerrain(terrain, targetPoint))
                {
                    if (obstacles.Count == 0 || canSeeWithObstacles(targetPoint, obstacles))
                    {
                        changeColor(true);
                        return true;
                    }
                }
            }

            changeColor(false);

            return false;

        }
 public bool isInsideVisionRange(Character target, List<ILevelObject> obstacles)
 {
     return isInsideVisionRange(target, null, obstacles);
 }
        public bool isInsideVisionRange(Character target, ITerrain terrain)
        {

            return isInsideVisionRange(target, terrain, null);
        }
        /// <summary>
        /// Retorna true si el target esta dentro del cono.
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>

        public bool isInsideVisionRange(Character target)
        {
            return isInsideVisionRange(target, null, null);
        }
 public Life(Character character, float maxPoints, Vector2 size, Color color, Vector2 position)
 {
     this.maxPoints = maxPoints;
     this.points = maxPoints;
     this.character = character;
     this.traslation = position;
     Infinite = false;
     this.size = size;
     this.color = color;
     this.mustUpdate = true;
     this.effect = TgcShaders.loadEffect(CommandosUI.Instance.ShadersDir + "life.fx");
     this.technique = "COLOR";
     
 }
 /// <summary>
 /// Agrega un boton de seleccion de personaje al panel
 /// </summary>
 public void addSelectionButton(Character ch, Selection selection)
 {
     this.buttons.Add(new SelectionButton(ch, selection));
 }
 public bool canSee(Character target)
 {
     return vision.isInsideVisionRange(target, this.level.Terrain, this.level.Objects);
 }
 public SelectionButton(Character _ch, Selection _selection)
 {
     this.ch = _ch;
     this.selectionRef = _selection;
 }
 /// <summary>
 /// Agrega un personaje a la seleccion
 /// </summary>
 public void addSelectedCharacter(Character ch)
 {
     ch.Selected = true;
     this.selectedCharacters.Add(ch);
 }
 public bool collidesWith(Character ch, out Vector3 n)
 {
     return ch.collidesWith(this.BoundingBox, out n);
 }
 internal bool isEnemyOf(Character other)
 {
     return other.OwnedByUser != this.OwnedByUser;
 }
 public bool collidesWith(Character ch, out Vector3 n)
 {
     return ch.collidesWith(this.boundingCylinder, out n);
 }
 public void setCharacterTarget(Character ch)
 {
     this.setTarget(ch);
 }