Пример #1
0
    private void Find1stReachBrdge()
    {
        CheckFindReachBrigeStatus();

        //wont go in if lookingForSeeNow is false
        if (!lookingForSeeNow)
        {
            return;
        }
        canIReach = _canIReach.Bean.Result;

        if (!_canIReach.IsStarted && canIReach == -5)
        {
            _canIReach = new CanIReach(_currentIni, _currentBridge, _person);
            print("_canIReach assignemtn:" + _currentBridge.MyId);
        }
        else if (canIReach == 1)
        {
            lookingForSeeNow = false;
        }
        else if (canIReach == -1)
        {
            throw new Exception("All Bridges should be reacheable ");
        }
    }
Пример #2
0
 private void CrossBridge()
 {
     print("_currentBridge found:" + _currentBridge.name);
     if (!_canIReachCross.IsStarted)
     {
         print("Assigning _canIReachCross");
         _canIReachCross = new CanIReach(_currentFin, _currentBridge, _person, true);
     }
     //wants to check and update again to see if any new value was set
     canIWalk = _canIReachCross.Bean.Result;
 }
Пример #3
0
 /// <summary>
 /// If index is -1 iwll return bot and top randomly, wil assing val to 'index' as weell
 /// if index is diff that than will return specific value passed
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public GameObject[] BottomTop(CanIReach canIReach)
 {
     if (canIReach.PairUsed == -1)
     {
         var t = new GameObject[] { Bottom(), Top() };
         canIReach.PairUsed = picked;
         return(t);
     }
     else
     {
         //so they load
         Bottom();
         Top();
         return(new GameObject[] { _bottoms[canIReach.PairUsed], _tops[canIReach.PairUsed] });
     }
 }
Пример #4
0
    /// <summary>
    /// This recursive will keep asking him self first if current brdige can be
    /// walked to... and after the Async call to CanIWalkToBridge have decided if can or not
    ///
    /// Then will move to the next brdige
    /// </summary>
    /// <param name="br">A llist of brdiges ordered 'from'</param>
    /// <param name="from">The from </param>
    /// <returns>A bridge we can walk to if is one, otherwise null</returns>
    Bridge GetClosestBridgeICanWalkTo(List <Bridge> br, Vector3 from)
    {
        if (index < br.Count)
        {
            if (!_canIReachBridge.IsStarted)
            {
                _canIReachBridge = new CanIReach(from, br[index], _person);
            }
            //wants to check and update again to see if any new value was set
            int flag = _canIReachBridge.Bean.Result;


            //means CanIWalkToBridge is posbile
            if (flag == 1)
            {
                _canIReachBridge.Restart();
                _canIReachBridge.Bean.CleanBean();
                return(br[index]);
            }
            //means cant walk there
            else if (flag == -1)
            {
                index++;
                _canIReachBridge.Bean.CleanBean();
                GetClosestBridgeICanWalkTo(br, from);
            }
            //mens is still processing so I need to ask again
            else if (flag == -5)
            {
                //onces the Delta Capsule has found is routable or not will call again RecursiveRoutine()
                return(null);
            }
        }
        //means that either we went thru all bridges or flag is -100
        index = 0;
        _canIReachBridge.Restart();
        return(null);
    }
Пример #5
0
    private void StartRoute()
    {
        CanIReach.InvertIfNeeded(ref _validFrom, ref _validToBot, _inverse);

        _router = new Router(_validFrom, _validToBot, _person);
    }