Пример #1
0
    public Dijkstra(TravelerController TC)
    {
        // initialize the traveler profile catalog
        TravelerProfileCatalog.Initialize();

        Actor = TC;
    }
Пример #2
0
    /// <summary>
    /// At the station, the travelers are sorted to different list based on which station they are getting off.
    /// </summary>
    /// <param name="traveler"></param>
    public void SortTravelersToDisembarkStation(TravelerController traveler)
    {
        foreach (var transit in traveler.GetStagesTransits())
        {
            if (line.stations.Contains(transit))
            {
                //Debug.LogFormat("{0}, {1}", transit, NextStation);
                if (transit == nextStation)
                {
                    continue;
                }

                //if (line.category == LineCategory.Bus)
                //{
                //    foreach (var item in disembarkersAtStation)
                //    {
                //        Debug.Log(item.Key);
                //    }
                //    Debug.LogFormat("line: {0}, transit: {1}, traveler: {2}", line, transit, traveler);
                //}
                disembarkersAtStation[transit.id].Add(traveler);
            }
            else
            {
                //Debug.LogWarningFormat("PassengerController does not transit at all in this line?!");
            }
        }
        //Debug.LogFormat("{0}, station: {1}", ToString(), NextStation);
    }
Пример #3
0
        public static bool OnEndConversation(TravelerController __instance)
        {
            // call directly instead of firing event
            __instance.EndConversation(__instance._delayToRestartAudio);
            __instance._talking = false;

            return(false);
        }
Пример #4
0
        public static bool OnStartConversation(TravelerController __instance)
        {
            __instance._talking = true;
            // call directly instead of firing event
            __instance.StartConversation();

            return(false);
        }
Пример #5
0
    void Update()
    {
        // turns the traveler gameobject to face the direction of travel
        TravelerController travelerController = GetComponentInParent <TravelerController> ();

        if (travelerController != null && travelerController.FacingDirection != Vector3.zero)
        {
            // only set the rotation if the FacingDirection vector has valid values (i.e. not all zeroes)
            transform.rotation = Quaternion.LookRotation(travelerController.FacingDirection);
        }
    }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     assetsLib = GameObject.FindGameObjectWithTag("Assets").GetComponent <AssetsLibrary>();
     markBox   = gameObject.transform.GetChild(2).gameObject.GetComponent <SpriteRenderer>();
     trav      = GetComponent <TravelerController>();
     hpcon     = gameObject.transform.GetChild(1).gameObject.GetComponent <HealthbarController>();
     pinfo     = new PlayerInfo(2, hpcon);
     ec        = gameObject.GetComponent <EnemyControllerNew>();
     attTimer  = ec.pinfo.stats.attackCooldown;
     gi.ec.Add(ec);
 }
Пример #7
0
        internal static void StopTravelerAudio(this TravelerAudioManager manager, TravelerController traveler)
        {
            var signalName = TravelerToSignalName(traveler);

            if (signalName == null)
            {
                return;
            }

            var signal = manager._signals.First(x => x.GetName() == signalName);

            signal.GetOWAudioSource().FadeOut(0.5f);
        }
    // Update is called once per frame
    void Update()
    {
        //TODO : Reset actorMinDistance to infinity when the winning actor reached the goal node
        //

        for (int i = 0; i < Actors.Length; i++)
        {
            // If the actors current position - the goal nodes position is < minDistance
            if (Vector3.Distance(Actors[i].transform.position, GoalNode.transform.position) < actorMinDistance && ActorReachedGoalNode == false)
            {
                // Actor in first is the current actor
                actorInFirst = Actors[i];

                // Stores the minimum distance
                actorMinDistance = Vector3.Distance(Actors[i].transform.position, GoalNode.transform.position);
            }
        }

        // Prints the actor in first place
        uiPosText.text = "1st: " + actorInFirst;

        // Changes the color of the position text respectivley by the color of the leading actor
        uiPosText.color = actorInFirst.GetComponentInChildren <MeshRenderer>().material.color;


        // If the actor is in first place and they reached the goal node
        if (actorInFirst.CurrentNode == GoalNode)
        {
            ActorReachedGoalNode = true;
            resetActorsGoalNode  = true;


            if (ActorReachedGoalNode == true && actorRunOnce == true)
            {
                //Debug.Log(actorInFirst + "Has won");
                actorInFirst.GetComponent <GUIActorBPMDisplay>().addToWinCount();
                //actorInFirst.GetComponent<GUIActorBPMDisplay>().GUIWinCount.text = "Wins: " + actorInFirst.GetComponent<GUIActorBPMDisplay>().winCount + 1;
                //actorMinDistance = Mathf.Infinity;
                ActorReachedGoalNode = actorRunOnce = false;
            }
        }
        else
        {
            //ActorReachedGoalNode = false;
            actorRunOnce = true;
            goalNodeReset();
        }

        // If the actors have a new goal node
    }
Пример #9
0
        public static bool StartConversation(TravelerController __instance)
        {
            if (__instance._animator != null && __instance._animator.enabled)
            {
                __instance._playingAnimID = __instance._animator.IsInTransition(0)
                                        ? __instance._animator.GetNextAnimatorStateInfo(0).fullPathHash
                                        : __instance._animator.GetCurrentAnimatorStateInfo(0).fullPathHash;
                __instance._animator.SetTrigger("Talking");
            }

            Locator.GetTravelerAudioManager().StopTravelerAudio(__instance);

            return(false);
        }
Пример #10
0
    void SpawnTraveler(int start, int end, TravelPreference preference = TravelPreference.time)
    {
        var itinerary = routingController.GetItinerary(start, end, preference);
        int index     = Mathf.FloorToInt(UnityEngine.Random.Range(0, spawnPoints.Count));

        //if (itinerary == null)
        //    return;

        GameObject newTraveler = TravelerController.CreateGameObject(itinerary);

        newTraveler.transform.SetParent(travelers.transform);
        newTraveler.transform.position = RandomSpawnPoint(spawnPoints[index]);
        //Debug.Log(itinerary);
    }
Пример #11
0
    /// <summary>
    /// While leaving the station, the vehicle will take on some travelers
    /// based on its capacity.
    /// </summary>
    /// <param name="station"></param>
    public void EmbarkFrom(StationController station)
    {
        int available = capacity - GetHeadCount();
        Queue <TravelerController> travelers;
        string key = LineController.MakeKeyString(line.id, direction);

        if (station.lineQueues.TryGetValue(key, out travelers))
        {
            for (int i = 0; i < available && travelers.Count > 0; i++)
            {
                TravelerController tc = travelers.Dequeue();
                SortTravelersToDisembarkStation(tc);
                tc.Embark();
            }
        }
    }
Пример #12
0
        public static bool EndConversation(TravelerController __instance, float audioDelay)
        {
            if (__instance._animator != null && __instance._animator.enabled)
            {
                if (audioDelay > 0f)
                {
                    __instance._animator.CrossFadeInFixedTime(__instance._playingAnimID, audioDelay, -1, -audioDelay);
                }
                else
                {
                    __instance._animator.SetTrigger("Playing");
                }
            }

            Locator.GetTravelerAudioManager().PlayTravelerAudio(__instance, audioDelay);

            return(false);
        }
Пример #13
0
        /// bad, but works great
        private static SignalName?TravelerToSignalName(TravelerController traveler)
        {
            var name = traveler.name;

            if (name.Contains("Esker"))
            {
                return(SignalName.Traveler_Esker);
            }

            if (name.Contains("Chert"))
            {
                return(SignalName.Traveler_Chert);
            }

            if (name.Contains("Riebeck"))
            {
                return(SignalName.Traveler_Riebeck);
            }

            if (name.Contains("Gabbro"))
            {
                return(SignalName.Traveler_Gabbro);
            }

            if (name.Contains("Feldspar"))
            {
                return(SignalName.Traveler_Feldspar);
            }

            if (name.Contains("Nomai"))
            {
                return(SignalName.Traveler_Nomai);
            }

            if (name.Contains("Prisoner"))
            {
                return(SignalName.Traveler_Prisoner);
            }

            return(null);
        }
Пример #14
0
 /// <summary>
 /// This will look at what queue the traveler should go to and
 /// put it in that queue.
 /// </summary>
 /// <param name="traveler"></param>
 public void QueueTraveler(TravelerController traveler)
 {
     if (outOfService)
     {
         traveler.ArrivedAt(this);
     }
     else
     {
         string lineId = traveler.GetNextLineQueueId();
         Queue <TravelerController> queue;
         if (lineQueues.TryGetValue(lineId, out queue))
         {
             queue.Enqueue(traveler);
         }
         else
         {
             Debug.LogWarningFormat("TravelerController went to the wrong station?!");
         }
         //Debug.Log(ToString());
     }
 }
Пример #15
0
        internal static void PlayTravelerAudio(this TravelerAudioManager manager, TravelerController traveler, float audioDelay)
        {
            var signalName = TravelerToSignalName(traveler);

            if (signalName == null)
            {
                return;
            }

            var signal = manager._signals.First(x => x.GetName() == signalName);

            manager._playAfterDelay = false;
            manager._playAudioTime  = Time.time + audioDelay;
            Delay.RunWhen(() => Time.time >= manager._playAudioTime, () =>
            {
                if (!signal.IsOnlyAudibleToScope() || signal.GetOWAudioSource().isPlaying)
                {
                    signal.GetOWAudioSource().FadeIn(0.5f);
                    signal.GetOWAudioSource().timeSamples = 0;
                }
            });
        }
    private TravelerController Actor;           // Object of the Traveler Controlle Class

    void Start()
    {
        // Gets this GameObject's Traveler Controller componenet
        Actor = this.GetComponent <TravelerController>();
    }
Пример #17
0
 void Update()
 {
     actorInFirst = SingletonsObject.GetComponent <ActorPositionManager>().actorInFirst;
 }