コード例 #1
0
 public static bool IsAlive(Transform target)
 {
     return((bool)ProxyUtils.InvokeStaticProxiedEx(WorldUtilsTypeName, "IsAlive", new InvokeStaticProxyOptions()
     {
         MatchParameterTypes = true
     }, target));
 }
コード例 #2
0
        private void Awake()
        {
            try
            {
                Debug.Log($"Creating a scene controller of type {SceneControllerClass}");

                gameObject.SetActive(false);

                Type controllerType = CoreUtils.GetLoadedTypes()
                                      .Where(t => t.Name == SceneControllerClass)
                                      //.Where(t => t.Name.EndsWith(SceneControllerClass))
                                      .Single();
                MonoBehaviour controller = (MonoBehaviour)gameObject.AddComponent(controllerType);

                ProxyUtils.SetProxyFields(this, controller); //this call does 90% of the magic

                //fires awake, probably
                gameObject.SetActive(true);

                //it will also fire OnEnable and OnDisable
                //that _shouldn't_ be a problem but if we need to we can re-root the world
            }
            catch (Exception e)
            {
                Debug.LogError($"Error setting up proxied scene controller {e.GetType().Name}");
                Debug.LogException(e);
            }
            finally
            {
                gameObject.SetActive(true);
            }
        }
コード例 #3
0
 /// <summary>
 /// Checks if this object is considered an "actor" object
 /// </summary>
 public static bool IsActor(GameObject gameObject)
 {
     return((bool)ProxyUtils.InvokeStaticProxiedEx(WorldUtilsTypeName, "IsActor", new InvokeStaticProxyOptions()
     {
         MatchParameterTypes = true
     }, gameObject));
 }
コード例 #4
0
        //TODO ParameterMatchTypes for below


        /// <summary>
        /// Sets parameters and loads a different scene
        /// </summary>
        public static void ChangeScene(string scene, string spawnPoint, Vector3 position, Quaternion rotation, bool skipLoading)
        {
            ProxyUtils.InvokeStaticProxiedEx(WorldUtilsTypeName, "ChangeScene", new InvokeStaticProxyOptions()
            {
                MatchParameterTypes = true,
                ParameterMatchTypes = new Type[] { typeof(string), typeof(string), typeof(Vector3), typeof(Quaternion), typeof(bool) }
            },
                                             scene, spawnPoint, position, rotation, skipLoading);
        }
コード例 #5
0
#pragma warning restore 0414

        //we actually just create an EntityPlaceholder

        private void Awake()
        {
            Type placeholderType = CCBase.BaseGameTypes
                                   .Where(t => t.FullName == "CommonCore.World.EntityPlaceholder")
                                   .Single();
            MonoBehaviour controller = (MonoBehaviour)gameObject.AddComponent(placeholderType);

            ProxyUtils.SetProxyFields(this, controller);
        }
コード例 #6
0
 /// <summary>
 /// Spawn an effect into the world (Effects/*)
 /// </summary>
 public static GameObject SpawnEffect(string effectID, Vector3 position, Quaternion rotation, Transform parent, bool useUniqueId)
 {
     return((GameObject)ProxyUtils.InvokeStaticProxiedEx(WorldUtilsTypeName, "SpawnEffect", new InvokeStaticProxyOptions()
     {
         MatchParameterTypes = true,
         ParameterMatchTypes = new Type[] { typeof(string), typeof(Vector3), typeof(Quaternion), typeof(Transform), typeof(bool) }
     },
                                                         effectID, position, rotation, parent, useUniqueId));
 }
コード例 #7
0
 /// <summary>
 /// Spawn an entity into the world (entities/*)
 /// </summary>
 public static GameObject SpawnEntity(string formID, string thingID, Vector3 position, Quaternion rotation, Transform parent)
 {
     return((GameObject)ProxyUtils.InvokeStaticProxiedEx(WorldUtilsTypeName, "SpawnEntity", new InvokeStaticProxyOptions()
     {
         MatchParameterTypes = true,
         ParameterMatchTypes = new Type[] { typeof(string), typeof(string), typeof(Vector3), typeof(Quaternion), typeof(Transform) }
     },
                                                         formID, thingID, position, rotation, parent));
 }
コード例 #8
0
 /// <summary>
 /// Transitions to the GameOverScene, does not clear game data
 /// </summary>
 public static void ShowGameOver()
 {
     ProxyUtils.InvokeStaticProxied(SharedUtilsTypeName, "ShowGameOver");
 }
コード例 #9
0
 /// <summary>
 /// Creates a full finalsave
 /// </summary>
 /// <remarks>
 /// <para>Ignores all restrictions on saving; finalsaves are special</para>
 /// <para>Does not commit scene state before saving</para>
 /// </remarks>
 public static void DoFinalSaveEx()
 {
     ProxyUtils.InvokeStaticProxied(SaveUtilsTypeName, "DoFinalSaveEx");
 }
コード例 #10
0
 /// <summary>
 /// Gets the scene controller (returns null on fail)
 /// </summary>
 public static MonoBehaviour TryGetSceneController()
 {
     return((MonoBehaviour)ProxyUtils.InvokeStaticProxied(SharedUtilsTypeName, "TryGetSceneController"));
 }
コード例 #11
0
 /// <summary>
 /// Loads a saved game to state and transitions to its scene
 /// </summary>
 /// <param name="saveName">The name of the save file, with prefix and extension but without path</param>
 public static void LoadGame(string saveName, bool force)
 {
     ProxyUtils.InvokeStaticProxied(SharedUtilsTypeName, "LoadGame", saveName, force);
 }
コード例 #12
0
 /// <summary>
 /// Changes to a new scene, setting up state and calling transitions appropriately
 /// </summary>
 public static void ChangeScene(string scene)
 {
     ProxyUtils.InvokeStaticProxied(SharedUtilsTypeName, "ChangeScene", scene);
 }
コード例 #13
0
 /// <summary>
 /// Clears data, sets up MetaState, and transitions to main menu scene
 /// </summary>
 public static void EndGame()
 {
     ProxyUtils.InvokeStaticProxied(SharedUtilsTypeName, "EndGame");
 }
コード例 #14
0
 /// <summary>
 /// Finds an entity by thing ID (name)
 /// </summary>
 public static MonoBehaviour FindEntityByTID(string TID)
 {
     return((MonoBehaviour)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "FindEntityByTID", TID));
 }
コード例 #15
0
 /// <summary>
 /// Finds an object by thing ID (name)
 /// </summary>
 public static GameObject FindObjectByTID(string TID)
 {
     return((GameObject)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "FindObjectByTID", TID));
 }
コード例 #16
0
 /// <summary>
 /// Finds a child by name, recursively, and ignores placeholders
 /// </summary>
 public static Transform FindDeepChildIgnorePlaceholders(Transform aParent, string aName)
 {
     return((Transform)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "FindDeepChildIgnorePlaceholders", aParent, aName));
 }
コード例 #17
0
 /// <summary>
 /// Checks if this scene is considered a world scene (ie has WorldSceneController)
 /// </summary>
 public static bool IsWorldScene()
 {
     return((bool)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "IsWorldScene"));
 }
コード例 #18
0
 /// <summary>
 /// Finds the player and returns their controller (does not guarantee an actual PlayerController!)
 /// </summary>
 public static MonoBehaviour GetPlayerController()
 {
     return((MonoBehaviour)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "GetPlayerController"));
 }
コード例 #19
0
 /// <summary>
 /// Gets the player object (or null if it doesn't exist)
 /// </summary>
 public static GameObject GetPlayerObject()
 {
     return((GameObject)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "GetPlayerObject"));
 }
コード例 #20
0
 /// <summary>
 /// Creates an autosave, if allowed to do so, displaying an indicator and suppressing exceptions
 /// </summary>
 public static void DoAutoSave(bool commit)
 {
     ProxyUtils.InvokeStaticProxied(SaveUtilsTypeName, "DoAutoSave", commit);
 }
コード例 #21
0
 /// <summary>
 /// Gets the currently active "main" camera
 /// </summary>
 /// <remarks>
 /// <para>The logic for this is different than Camera.main. It searches the player object, if it exists, first.</para>
 /// <para>Note that this is potentially very slow: it has good best-case but horrendous worst-case performance.</para>
 /// </remarks>
 public static Camera GetActiveCamera()
 {
     return((Camera)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "GetActiveCamera"));
 }
コード例 #22
0
 /// <summary>
 /// Finds all entities with form ID (entity name)
 /// </summary>
 public static IList FindEntitiesWithFormID(string formID)
 {
     return((IList)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "FindEntitiesWithFormID", formID));
 }
コード例 #23
0
 /// <summary>
 /// Clears data, sets up MetaState, and transitions to specified scene
 /// </summary>
 public static void EndGame(string sceneOverride)
 {
     ProxyUtils.InvokeStaticProxied(SharedUtilsTypeName, "EndGame", sceneOverride);
 }
コード例 #24
0
 /// <summary>
 /// Finds all entities with CommonCore tag
 /// </summary>
 public static IList FindEntitiesWithTag(string tag)
 {
     return((IList)ProxyUtils.InvokeStaticProxied(WorldUtilsTypeName, "FindEntitiesWithTag", tag));
 }
コード例 #25
0
 /// <summary>
 /// Changes to a new scene, setting up state and calling transitions appropriately
 /// </summary>
 public static void ChangeScene(string scene, bool skipLoading)
 {
     ProxyUtils.InvokeStaticProxied(SharedUtilsTypeName, "ChangeScene", scene, skipLoading);
 }
コード例 #26
0
 /// <summary>
 /// Gets the last save file, or null if it doesn't exist
 /// </summary>
 public static string GetLastSave()
 {
     return((string)ProxyUtils.InvokeStaticProxied(SaveUtilsTypeName, "GetLastSave"));
 }
コード例 #27
0
 /// <summary>
 /// Saves the current state to file
 /// </summary>
 /// <param name="saveName">The name of the save file, with prefix and extension but without path</param>
 /// <param name="commit">Whether to commit or not</param>
 public static void SaveGame(string saveName, bool commit, bool force)
 {
     ProxyUtils.InvokeStaticProxied(SharedUtilsTypeName, "SaveGame", saveName, commit, force);
 }
コード例 #28
0
 /// <summary>
 /// Creates an autosave, if allowed to do so, displaying an indicator and suppressing exceptions
 /// </summary>
 /// <remarks>Defaults to commit=false</remarks>
 public static void DoAutoSave()
 {
     ProxyUtils.InvokeStaticProxied(SaveUtilsTypeName, "DoAutoSave");
 }
コード例 #29
0
 /// <summary>
 /// Loads the quicksave if it exists
 /// </summary>
 /// <remarks>Note that this does not display the indicator and can throw exceptions</remarks>
 public static void DoQuickLoadEx()
 {
     ProxyUtils.InvokeStaticProxied(SaveUtilsTypeName, "DoQuickLoadEx");
 }
コード例 #30
0
 /// <summary>
 /// Creates an autosave
 /// </summary>
 /// <remarks>Note that this does not display the indicator and can throw exceptions</remarks>
 public static void DoAutoSaveEx(bool commit, bool force)
 {
     ProxyUtils.InvokeStaticProxied(SaveUtilsTypeName, "DoAutoSaveEx", commit, force);
 }