Пример #1
0
    IEnumerator End()
    {
        UISystem.instance.SetMenuPresence(true);
        InterfaceUtilities.FadeToBlack(false, 2.0f);
        yield return(new WaitForSeconds(3.0f));

        InterfaceUtilities.AddCaption(LocalizationSystem.GetEntry("end.thanks"), new Vector2(400.0f, 100.0f), 40.0f, Color.white, true, false, 2.0f);
        yield return(new WaitForSeconds(5.0f));

        SceneManager.LoadScene(0);
    }
        public void RemoveEntityProcessor <T>() where T : ComponentSystemBase
        {
            InterfaceUtilities.RemoveInterfaceImplementationsOfTypeFromList(typeof(T), ref processors);
            foreach (GeometryVision geoVision in geoVisions)
            {
                var system = geoVision.EntityWorld.GetExistingSystem <T>();

                if (system != null)
                {
                    geoVision.EntityWorld.DestroySystem(system);
                }
            }
        }
        public static void HandleEntityImplementationAddition <TImplementation, TCollection>(
            TImplementation entitySystemToAdd, HashSet <TCollection> listOfInterfaces, World eWorld, Action action)
            where TImplementation : ComponentSystemBase, TCollection, new()
        {
            if (entitySystemToAdd == null)
            {
                if (eWorld == null)
                {
                    eWorld = World.DefaultGameObjectInjectionWorld;
                }

                var eye = eWorld.CreateSystem <TImplementation>();
                InterfaceUtilities.AddImplementation(eye, listOfInterfaces);
                action();
            }
        }
Пример #4
0
        /// <summary>
        /// Use this to remove eye game object or entity implementation.
        /// Also handles removing the MonoBehaviour component if the implementation is one
        /// </summary>
        /// <typeparam name="T"></typeparam>
        public void RemoveEntityEye <T>() where T : ComponentSystemBase
        {
            // Currently only one system
            var eye = GetEye <GeometryVisionEntityEye>();

            if (eye != null)
            {
                InterfaceUtilities.RemoveInterfaceImplementationsOfTypeFromList(typeof(T), ref eyes);
            }

            var system = EntityWorld.GetExistingSystem <T>();

            if (system != null)
            {
                EntityWorld.DestroySystem(system);
            }
        }
Пример #5
0
 /// <summary>
 /// Use this to remove eye game object or entity implementation.
 /// Also handles removing the MonoBehaviour component if the implementation is one
 /// </summary>
 /// <typeparam name="T"></typeparam>
 public void RemoveEye <T>()
 {
     InterfaceUtilities.RemoveInterfaceImplementationsOfTypeFromList(typeof(T), ref eyes);
     if (typeof(T) == typeof(GeometryVisionEye))
     {
         var eye = GetComponent <GeometryVisionEye>();
         //also remove the mono behaviour from gameObject, if it is one. TODO: get the if implements monobehaviour
         //Currently there is only 2 types. Other one is MonoBehaviour and the other one not
         if (Application.isPlaying && eye != null)
         {
             Destroy(eye);
         }
         else if (Application.isPlaying == false && eye != null)
         {
             DestroyImmediate(eye);
         }
     }
 }
Пример #6
0
        /// <summary>
        /// Adds eye/camera component to the list and makes sure that the implementation to be added is unique.
        /// </summary>
        /// <typeparam name="T">Implementation IGeoEye to add</typeparam>
        public void AddGameObjectEye <T>()
        {
            HandleGameObjectEyeAddition();

            //local functions//

            void HandleGameObjectEyeAddition()
            {
                InterfaceUtilities.AddImplementation <IGeoEye, GeometryVisionEye>(InitEye, Eyes, gameObject);

                //Constructor function that gets called when adding the implementation
                IGeoEye InitEye()
                {
                    var addedEye = (IGeoEye)gameObject.GetComponent(typeof(T));

                    addedEye.Runner    = Runner;
                    addedEye.Id        = new Hash128().ToString();
                    addedEye.GeoVision = this;
                    var added = (Component)addedEye;

                    return((IGeoEye)added);
                }
            }
        }
Пример #7
0
    private IEnumerator Start()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        StartCoroutine(InterfaceUtilities.InitResources());

        m_WindowStack = new Stack <WindowSelectable>();
        ResourceRequest req = Resources.LoadAsync("UI/ConfirmPopup");

        while (!req.isDone)
        {
            yield return(null);
        }

        m_ConfirmPopup = req.asset as GameObject;

        req = Resources.LoadAsync("UI/PauseMenu");

        while (!req.isDone)
        {
            yield return(null);
        }

        m_PauseWindow = req.asset as GameObject;

        CloseWindowAction.action.performed += CancelInputPressed;
        TogglePauseAction.action.performed += PauseInputPressed;
    }
 public T GetTargetingProgram <T>()
 {
     return((T)InterfaceUtilities.GetInterfaceImplementationOfTypeFromList(typeof(T), targetingPrograms));
 }
Пример #9
0
 /// <summary>
 /// Used to get the eye implementation for either game object or entities from hash set.
 /// </summary>
 /// <typeparam name="T">Implementation to get. If none exists return default T</typeparam>
 /// <returns></returns>
 public T GetEye <T>()
 {
     return((T)InterfaceUtilities.GetInterfaceImplementationOfTypeFromList(typeof(T), eyes));
 }
 /// <summary>
 /// Gets the processor of given type from the runner.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public T GetProcessor <T>()
 {
     return((T)InterfaceUtilities.GetInterfaceImplementationOfTypeFromList(typeof(T), Processors));
 }