Пример #1
0
 /// <summary>
 /// So its restarted so can be used again
 /// </summary>
 public void Restart()
 {
     Result = null;
     _units.Clear();
     _isBuildingRouting           = true;
     _isIntersectingOnlyObstacles = true;
     _isIntersectingOnlyStills    = true;
 }
Пример #2
0
    /// <summary>
    /// Will say if a building was hit and will return a ExplorerUnit object
    /// </summary>
    /// <param name="result"></param>
    /// <returns></returns>
    private bool WasAObstacleHit()
    {
        _units = _units.OrderBy(a => a.Distance).ToList();

        for (int i = 0; i < _units.Count; i++)
        {
            if (_units[i].IsHasAValidObstacle)
            {
                _units[i].Create4Crystals();//so the crystals are ready
                Result = _units[i];
                return(true);
            }
        }
        return(false);
    }
Пример #3
0
    /// <summary>
    /// Adds a key to the explorer
    /// </summary>
    /// <param name="crystal">Key of the Parent ID with intersect with</param>
    /// <param name="intersection">The point where we intersect</param>
    /// <param name="currPosition">the curr Position of the Crystal reaching Final</param>
    public void AddKey(Crystal crystal, Vector3 intersection, Vector3 currPosition, Vector3 final)
    {
        ExplorerUnit doesExistKey = null;

        if (_units.Count > 0)
        {
            doesExistKey = _units.Find(a => a.Key == crystal.ParentId);
        }

        //so it doesnt add duplicates keys
        if (doesExistKey == null)
        {
            _units.Add(new ExplorerUnit(crystal, intersection, currPosition, final));
        }
        //bz a line can have diff intersections in a building. usually 2
        //if exist will add Intersection
        else
        {
            doesExistKey.AddIntersection(intersection, crystal);
        }

        SetIfIsIntersectingOnlyObstacles(crystal);
    }