Esempio n. 1
0
    private void FadeInOutline()
    {
        // Setup the color to use for the flash
        Color       color = effectColor;
        ButtonSound sound = ButtonSound.Hover;

        // If we have an operation source then instead set the color to the intended operation type color
        if (OperationInProgress)
        {
            color = UISettings.GetOperatorColor(operationSource.MatrixParent.IntendedNextOperationType);
            sound = ButtonSound.Preview;
        }

        // Create the pop effect for hovering
        PunchSize(sound);

        // If wer still have an outline then make it invisible
        if (currentOutline)
        {
            currentOutline.Remove();
        }

        // Fade in a new outline
        currentOutline = OutlineManager.FadeInOutline(transform, effectType, color);
    }
Esempio n. 2
0
    public static void Initialize()
    {
        // Instantiate the effects manager from the resources and make it not destroy on load
        instance = ResourcesExtensions.InstantiateFromResources <OutlineManager>(nameof(OutlineManager), null);
        DontDestroyOnLoad(instance);

        // Re-initialize the pools on scene loaded
        SceneManager.sceneLoaded += instance.OnSceneLoaded;
    }
Esempio n. 3
0
    public void Initialise()
    {
        //create the list which contain all the spriterenderer
        List <SpriteRenderer> sprites = new List <SpriteRenderer> ();

        //try to get the outlinemanager
        if (vOutlineManager == null)
        {
            vOutlineManager = Camera.main.GetComponent <OutlineManager>();

            //if not create the outline manager on the main camera
            //by default, it will have red, blue and green color
            if (vOutlineManager == null)
            {
                vOutlineManager = Camera.main.gameObject.AddComponent <OutlineManager>();
            }
        }

        if (vOutlineManager == null)
        {
            Debug.Log("Add a Camera to the game");
        }

        //is his master
        SetMasterOutline(this);

        //get all the sprite renderer below
        foreach (SpriteRenderer vCurRenderer in GetComponentsInChildren <SpriteRenderer> ().OfType <SpriteRenderer> ().ToList())
        {
            sprites.Add(vCurRenderer);
        }


        foreach (SpriteRenderer vRenderer in sprites)
        {
            //try to get this component
            Outline vOutline = vRenderer.GetComponent <Outline> ();

            //if doesn't exist, create it

            /*
             *          if (vOutline == null) {
             *                  vOutline = vRenderer.GetComponent<Outline>();
             *  vOutline.vOutlineManager = vOutlineManager;
             *                  vOutline.color = color;
             *                  vOutline.vOutlineType = vOutlineType;
             *
             *                  //save master for this once
             *                  vOutline.SetMasterOutline (this);
             *          }
             */

            //start them all
            //vOutline.StartOutline ();
        }
    }
Esempio n. 4
0
    void Awake()
    {
        if (!Instance)
        {
            Instance = this;
        }
        else
        {
            DestroyImmediate(this.gameObject);
        }

        cachedLayers = new Dictionary <GameObject, Dictionary <Renderer, int> >();
        Shader.SetGlobalFloat("isMac", Application.platform == RuntimePlatform.OSXPlayer ? 1 : 0);
    }
Esempio n. 5
0
    private void Start()
    {
        outline.enabled = true;
        if (instance == null)
        {
            instance = this;
        }
        else if (instance == this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        InitializeManager();
    }
Esempio n. 6
0
 void Start()
 {
     ShowOutline     = false;
     vOutlineManager = Camera.main.GetComponent <OutlineManager>();
 }
Esempio n. 7
0
 public void Flash(Color color)
 {
     OutlineManager.FadeOutOutline(transform, effectType, color);
 }