private CharacterInfo GetCanAttackUserTarget(UserInfo user)
        {
            //float dist = user.GetActualProperty().AttackRange;
            float dist = 3f;
            LinkedListDictionary <int, UserInfo> list = user.SceneContext.UserManager.Users;

            for (LinkedListNode <UserInfo> node = list.FirstValue; null != node; node = node.Next)
            {
                UserInfo other = node.Value;
                if (null != other && CharacterRelation.RELATION_ENEMY == CharacterInfo.GetRelation(user, other))
                {
                    if (Geometry.DistanceSquare(user.GetMovementStateInfo().GetPosition3D(), other.GetMovementStateInfo().GetPosition3D()) <= dist * dist)
                    {
                        return(other);
                    }
                }
            }
            return(null);
        }
Пример #2
0
 public void Init(float width, float height)
 {
     map_width_  = width;
     map_height_ = height;
     GetCell(new Vector3(width, 0, height), out max_row_, out max_col_);
     max_row_++;
     max_col_++;
     if (max_col_ % 2 == 0)
     {
         max_row_++;
     }
     cells_arr_ = new LinkedListDictionary <int, CharacterInfo> [max_row_, max_col_];
     for (int i = 0; i < max_row_; ++i)
     {
         for (int j = 0; j < max_col_; ++j)
         {
             cells_arr_[i, j] = new LinkedListDictionary <int, CharacterInfo>();
         }
     }
 }