Beispiel #1
0
        public bool Add(EnteredEvent oEvent, IVehicle vehicle)
        {
            Vehicle = vehicle;

            if (!HasEntered)
            {
                Events.Add(oEvent);
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Enters this segment
        /// </summary>
        public virtual void Enter(bool suspend = false)
        {
            // We will announce that this segment has been entered in a moment...
            EnteredEvent e = new EnteredEvent(this);

            // Inform the previous segment its been exited
            if (current != null && current != this)
            {
                current.Exit();
            }

            // If the segment is currently active, let's do a restart instead
            // This will set everything back to the initial state at this segment
            if (state != State.Inactive && restart)
            {
                Restart();
                e.restarted = true;
            }

            if (debug)
            {
                StratusDebug.Log($"Entering", this);
            }

            // Invoke the optional callbacks
            if (onEntered != null)
            {
                onEntered.Invoke();
            }

            // If not suspended, toggle this segment
            Toggle(!suspend);

            // This is now the current segment
            StratusScene.Dispatch <EnteredEvent>(e);
            state   = State.Entered;
            current = this;
        }
 private void OnEnteredEvent(EnteredEvent e)
 {
 }