Ejemplo n.º 1
0
        static void CreateFogOfWarVolume(MenuCommand menuCommand)
        {
            GameObject fv = Resources.Load <GameObject> ("CNPro/Prefabs/FogOfWarVolume");

            if (fv == null)
            {
                Debug.LogError("Could not load FogOfWarVolume from Resources/CNPro/Prefabs folder!");
                return;
            }
            GameObject newPOI = Instantiate(fv);

            newPOI.name = "Mini-Map Fog Of War Volume";

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newPOI, menuCommand.context as GameObject);

            // Register root object for undo.
            Undo.RegisterCreatedObjectUndo(newPOI, "Create Mini-Map Fog Of War Volume");
            Selection.activeObject = newPOI;

            // Enable fog of war automatically
            CompassPro compass = CompassPro.instance;

            if (compass != null)
            {
                compass.fogOfWarEnabled = true;
            }
        }
 void OnEnable()
 {
     _compass                 = (CompassPro)target;
     _headerTexture           = Resources.Load <Texture2D>("CNPro/CompassNavigatorProHeader");
     expandCompassBarSettings = EditorPrefs.GetBool("CNProCompassBarSettings", true);
     expandCompassPOISettings = EditorPrefs.GetBool("CNProCompassPOISettings", false);
     expandTitleSettings      = EditorPrefs.GetBool("CNProTitleSettings", false);
     expandMiniMapSettings    = EditorPrefs.GetBool("CNProMiniMapSettings", false);
     expandFogOfWarSettings   = EditorPrefs.GetBool("CNProFogOfWarSettings", false);
 }
Ejemplo n.º 3
0
        void ShowFogArea(bool state)
        {
            CompassPro compass = CompassPro.instance;

            if (compass != null)
            {
                Bounds bounds = GetComponent <BoxCollider>().bounds;
                float  alpha  = state ? this.alpha : 0f;
                compass.SetFogOfWarAlpha(bounds, alpha, border);
            }
        }
Ejemplo n.º 4
0
        void OnEnable()
        {
            CompassPro compass = CompassPro.instance;

            if (!Application.isPlaying && compass != null && compass.POIisRegistered(this))
            {
                id = 0;
            }
            if (id == 0)
            {
                id = System.Guid.NewGuid().GetHashCode();
            }
        }
Ejemplo n.º 5
0
        void NotifyChanges()
        {
            oldPos    = transform.position;
            oldScale  = transform.localScale;
            oldAlpha  = alpha;
            oldBorder = border;
            oldOrder  = order;
            CompassPro compass = CompassPro.instance;

            if (compass != null)
            {
                compass.UpdateFogOfWar();
            }
        }
Ejemplo n.º 6
0
        // Use this for initialization
        void Start()
        {
            CompassPro compass = CompassPro.instance;

            if (compass == null)
            {
                return;
            }

            if (dontDestroyOnLoad && Application.isPlaying)
            {
                if (compass.POIisRegistered(this))
                {
                    Destroy(gameObject);
                    return;
                }
                DontDestroyOnLoad(gameObject);
            }

            compass.POIRegister(this);
        }