public Vector3 getPlayerPosition()
 {
     if (playerEntity != null)
     {
         return(playerEntity.getPosition());
     }
     return(Vector3.Zero);
 }
 public float getDistanceFrom(UnitEntity ent)
 {
     return((float)Math.Sqrt(Math.Pow((int)this.getPosition().X - (int)ent.getPosition().X, 2) + Math.Pow((int)this.getPosition().Z - (int)ent.getPosition().Z, 2)));
 }
        public void Draw(GameTime gameTime)
        {
            Matrix view       = camera.getView();
            Matrix projection = camera.getProjection();

            try
            {
                if (playerEntity != null)
                {
                    if (!targetPos.Equals(normalTargetPos))
                    {
                        game.getWayToGoEffect().Draw(view, projection, targetPos, Vector3.Zero, 1.0f);
                    }
                    if (targetNode != null)
                    {
                        game.getWayToGoEffect().Draw(view, projection, targetNode.getPosition(), Vector3.Zero, 1.0f);
                    }
                    foreach (WarpEntity ent in warpsEntity.Values)
                    {
                        if (ent != null)
                        {
                            ent.Draw(view, projection);
                        }
                    }
                    foreach (ItemEntity ent in itemsEntity.Values)
                    {
                        if (ent != null)
                        {
                            ent.Draw(view, projection);
                        }
                    }
                    // Draw all entity
                    foreach (UnitEntity ent in monstersEntity.Values)
                    {
                        if (ent != null)
                        {
                            if (playerEntity.getDistanceFrom(ent) <= 256)
                            {
                                ent.Draw(view, projection);
                            }
                            if (playerEntity.getDistanceFrom(ent) <= 128)
                            {
                                ent.DrawInfo(view, projection);
                                ent.DrawDamage(view, projection);
                            }
                        }
                    }
                    foreach (UnitEntity ent in npcsEntity.Values)
                    {
                        if (ent != null)
                        {
                            if (playerEntity.getDistanceFrom(ent) <= 256)
                            {
                                ent.Draw(view, projection);
                            }
                            if (playerEntity.getDistanceFrom(ent) <= 128)
                            {
                                ent.DrawInfo(view, projection);
                                ent.DrawDamage(view, projection);
                            }
                        }
                    }
                    foreach (UnitEntity ent in playersEntity.Values)
                    {
                        if (ent != null)
                        {
                            if (playerEntity.getDistanceFrom(ent) <= 256)
                            {
                                ent.Draw(view, projection);
                            }
                            if (playerEntity.getDistanceFrom(ent) <= 128)
                            {
                                ent.DrawInfo(view, projection);
                                ent.DrawDamage(view, projection);
                            }
                        }
                    }
                    playerEntity.Draw(view, projection);
                    playerEntity.DrawInfo(view, projection);
                    playerEntity.DrawDamage(view, projection);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.StackTrace);
            }
        }