Exemple #1
0
        IEnumerator SetupWormhole()
        {
            yield return(new WaitForFixedUpdate());

            singularityMaterial.DisableKeyword("WORMHOLE_ON");
            singularityMaterial.EnableKeyword("WORMHOLE_OFF");
            hasWormhole = false;

            if (!String.IsNullOrEmpty(wormholeTarget))
            {
                SingularityObject wormholeTargetSingularity = Singularity.Instance.loadedObjects.SingleOrDefault(_so => _so.name == wormholeTarget);

                if (ReferenceEquals(wormholeTargetSingularity, null))
                {
                    Utils.LogError("Wormhole target not found, disabling");
                    yield break;
                }
                singularityMaterial.SetTexture("wormholeCubemap", wormholeTargetSingularity.singularityCubeMap.singularityCubemap);
                singularityMaterial.DisableKeyword("WORMHOLE_OFF");
                singularityMaterial.EnableKeyword("WORMHOLE_ON");
                wormholeCubeMap = wormholeTargetSingularity.singularityCubeMap;
                hasWormhole     = true;
            }
        }
Exemple #2
0
 void AddSingularityObject(ConfigNode _cn)
 {
     if (_cn.HasValue("name") && _cn.HasValue("gravity"))
     {
         Transform scaledBodyTransform = ScaledSpace.Instance.transform.FindChild(_cn.GetValue("name"));
         if (!ReferenceEquals(scaledBodyTransform, null))
         {
             try
             {
                 SingularityObject singularityObject = scaledBodyTransform.gameObject.AddComponent <SingularityObject> ();
                 loadedObjects.Add(singularityObject);
                 singularityObject.Init(_cn);
             }
             catch (Exception e)
             {
                 Utils.LogError("Couldn't add singularity object to " + _cn.GetValue("name") + ", Exception thrown: " + e.ToString());
             }
         }
         else
         {
             Utils.LogError("Unable to find " + _cn.GetValue("name") + ", skipping ...");
         }
     }
 }