public void Start()
 {
     Source                   = 100;
     spriteRenderer           = GetComponent <SpriteRenderer>();
     spriteGlowEffect         = GetComponent <SpriteGlowEffect>();
     spriteGlowEffect.enabled = false;
 }
Exemple #2
0
    public void CreateSample(Vector2Int pos)
    {
        Sample samp = new Sample(pos);

        samples.Add(samp);
        sampGlow = samp.obj.GetComponentInChildren <SpriteGlowEffect>();
    }
    private void BuilCell(Quaternion rotation, int index, float i, float j, Vector2 pivot, Rect rec)
    {
        //----------------------Cordinates for cell--------------------------------------
        float xCordinate = (pixel * i) + (pixel / 2);
        float yCordinate = (pixel * j) + (pixel / 2);

        //Creating cells-----------------------------------------------------------------
        GameObject cell = new GameObject();

        //-------------------------Bounding with script----------------------------------
        cell.AddComponent <TouchRotate>();
        //-------------------------------------------------------------------------------

        //-------------------------------------------------------------------------------
        RectTransform rectTransform = cell.AddComponent <RectTransform>() as RectTransform;
        BoxCollider2D box2D         = cell.AddComponent <BoxCollider2D>() as BoxCollider2D;

        //Creating with z: +90 position, because default z position is -180 and we want it to be 0
        cell.transform.SetPositionAndRotation(new Vector3(0, 0, 0),
                                              rotation);

        //Naming Cell and Setting his parent----------------------------------------
        cell.name        = "cell_" + xCordinate.ToString() + "x" + yCordinate.ToString();
        cellsParent.name = "Parent_Of_Cells\\" + pieceCount.ToString() + "-Children";
        cell.transform.SetParent(cellsParent.transform);

        //Scalling------------------------------------------
        rectTransform.sizeDelta = new Vector2(pixel, pixel);
        box2D.size = new Vector2(pixel, pixel);
        cell.transform.localScale = new Vector3(1, 1, 1);

        //Positioning; anchorMin and anchorMax are for starting position bottom left corner of parent.
        rectTransform.anchorMin        = new Vector2(0f, 0f);
        rectTransform.anchorMax        = new Vector2(0f, 0f);
        rectTransform.anchoredPosition = new Vector3(x: xCordinate, y: yCordinate);

        //------------------------------------------Creating Sprite Texture--------------------------------------------------------------------
        Texture2D spriteTexture = new Texture2D((int)(pixel * 100f), (int)(pixel * 100f));
        var       pixels        = painting.texture.GetPixels((int)((pixel * 100f) * i), (int)((pixel * 100f) * j), (int)(pixel * 100f), (int)(pixel * 100f));

        spriteTexture.SetPixels(pixels);
        spriteTexture.Apply();


        //Setting sprite to Cell--------------------------------------------------------------
        SpriteRenderer spriteRenderer = cell.AddComponent <SpriteRenderer>() as SpriteRenderer;

        spriteRenderer.sprite           = Sprite.Create(spriteTexture, rec, pivot);
        spriteRenderer.sortingLayerName = "Cells";
        spriteRenderer.material.shader  = glowShader;
        SpriteGlowEffect glowEffect = cell.AddComponent <SpriteGlowEffect>();

        //--------------------------------
        glowEffect.OutlineWidth   = 0;
        glowEffect.AlphaThreshold = 0.01f;

        //-----------------------
        //Finally, adding our cell to the list.
        cells.SetValue(cell, index);
    }
    // Use this for initialization
    void Start()
    {
        _eventTrigger = gameObject.AddComponent <ObservableEventTrigger>();
        _mspresenter  = GameObject.Find("MainScenePresenter").GetComponent <MainScenePresenter>();
        _spriteGlow   = GetComponent <SpriteGlowEffect>();

        _sprites = Resources.LoadAll <Sprite>("number");
    }
Exemple #5
0
 private void Awake()
 {
     _animator = GetComponent <Animator>();
     _light    = transform.Find("Weapen block").Find("Light").GetComponent <SpriteRenderer>();
     _glow     = transform.Find("Weapen block").Find("Light").GetComponent <SpriteGlowEffect>();
     _boxTip   = transform.Find("Box_tip").GetComponent <Animator>();
     BroadcastMessage("GetWeaponInfo", transform, SendMessageOptions.DontRequireReceiver);
 }
Exemple #6
0
    void Start()
    {
        spriteRenderer    = gameObject.GetComponent <SpriteRenderer>();
        glowScript        = gameObject.GetComponent <SpriteGlowEffect>();
        originalColour    = spriteRenderer.material.color;
        highlightedColour = Color.white;

        LightUp(false, originalColour);
    }
Exemple #7
0
 void Awake()
 {
     spriteRenderer = gameObject.GetComponent <SpriteRenderer>();
     destinationPos = new Vector3(0f, transform.position.y, 0f);
     glowScript     = gameObject.GetComponent <SpriteGlowEffect>();
     startScale     = new Vector3(0f, 0f, 0f);
     trail          = gameObject.GetComponent <TrailRenderer>();
     isVisible      = gameObject.GetComponent <ScaleObject>().finishedScaling;
 }
    public void SetPuzzlePieceGlow(bool outlinesEnabled)
    {
        int width = outlinesEnabled ? maxGlowWidth : 0;
        SpriteGlowEffect glowEffect = GetComponent <SpriteGlowEffect>();

        glowEffect.OutlineWidth   = width;
        glowEffect.GlowBrightness = 1;
        glowEffect.GlowColor      = Color.red;
    }
Exemple #9
0
 private void Awake()
 {
     spriteRenderer   = GetComponent <SpriteRenderer>();
     defaultMaterial  = new Material(Shader.Find("Sprites/Default"));
     rimLightMaterial = Resources.Load <Material>("Material/RimLight");
     spriteGlow       = GetComponent <SpriteGlowEffect>();
     ResetMaterial();
     subMapManager = GetComponent <SubMapManager>();
 }
Exemple #10
0
 protected virtual void Awake()
 {
     m_spriteRenderer       = GetComponentInChildren <SpriteRenderer>();
     m_glowEffect           = GetComponentInChildren <SpriteGlowEffect>();
     m_collider             = GetComponentInChildren <BoxCollider2D>();
     IsCostAP               = true;
     IsDeath                = false;
     SkillHashes            = new List <int>();
     OnSortingOrderChanged += OnSortingOrderChangedEvent;
 }
Exemple #11
0
    private void Awake()
    {
        renderer   = GetComponent <SpriteRenderer>();
        glowEffect = GetComponent <SpriteGlowEffect>();

        tooltipSprite = tooltipPivot.sprite;

        SetState(PlacementState.Hidden);
        glowEffect.OutlineWidth = 0;
    }
Exemple #12
0
 // Use this for initialization
 void Start()
 {
     _spotLight           = GetComponent <SpriteGlowEffect>();
     _spotLight.GlowColor = Color.cyan;
     _current             = 0;
     _colors[0]           = Color.magenta;
     _colors[1]           = Color.cyan;
     _colors[2]           = Color.red;
     _colors[3]           = Color.green;
     _outline             = _title.GetComponent <Outline>();
 }
Exemple #13
0
 static void changeColor(SpriteGlowEffect comp, Player owner)
 {
     if (owner == PlayersManager.Empty)
     {
         comp.GlowColor = Color.white;
     }
     else if (PlayersManager.GetMyPlayer() != owner)
     {
         comp.GlowColor = Color.red;
     }
     else
     {
         comp.GlowColor = Color.green;
     }
 }
Exemple #14
0
    private void Awake()
    {
        _mainCamera  = GameObject.Find("Main Camera").transform;
        _memorizer   = GameObject.Find("Memorizer").GetComponent <Memorizer>();
        _fade        = GameObject.Find("Fade").GetComponent <CanvasGroup>();
        _block       = GameObject.Find("Block").GetComponent <SpriteGlowEffect>();
        _light       = GameObject.Find("Light").GetComponent <SpriteGlowEffect>();
        _leftInfo    = GameObject.Find("LeftInfo").transform.GetComponent <RectTransform>();
        _rightInfo   = GameObject.Find("RightInfo").transform.GetComponent <RectTransform>();
        _start       = GameObject.Find("Start").transform.GetComponent <RectTransform>();
        _last        = GameObject.Find("Last").transform.GetComponent <RectTransform>();
        _next        = GameObject.Find("Next").transform.GetComponent <RectTransform>();
        _startG      = _start.GetComponent <CanvasGroup>();
        _lastG       = _last.GetComponent <CanvasGroup>();
        _nextG       = _next.GetComponent <CanvasGroup>();
        _dialog      = GameObject.Find("Dialog Tip Box").transform;
        _dialogGroup = _dialog.GetComponent <CanvasGroup>();
        _name        = GameObject.Find("Name").transform.Find("NameText").transform.GetComponent <SpriteRenderer>();
        //_border = GameObject.Find("Border").GetComponent<Image>();
        _fade.alpha = 1;
        var player = GameObject.FindGameObjectWithTag("Player");

        player.GetComponent <PlayerMove>().enabled = false;
        _actor      = player.GetComponent <SpriteRenderer>();
        _weaponMain = GameObject.FindGameObjectWithTag("Weapon").transform.Find("Weapon Main")
                      .GetComponent <SpriteRenderer>();
        player.GetComponent <PlayerInfo>().UseWeapon = false;
        var color = new Color(1, 1, 1, 0f);

        _actor.color      = color;
        _weaponMain.color = color;
        //_border.color = color;
        _name.color                   = color;
        _start.anchoredPosition       = new Vector2(_start.anchoredPosition.x, _start.anchoredPosition.y - ButtonMove);
        _last.anchoredPosition        = new Vector2(_last.anchoredPosition.x, _last.anchoredPosition.y - ButtonMove);
        _next.anchoredPosition        = new Vector2(_next.anchoredPosition.x, _next.anchoredPosition.y - ButtonMove);
        _startG.blocksRaycasts        = false;
        _lastG.blocksRaycasts         = false;
        _nextG.blocksRaycasts         = false;
        _leftInfo.anchoredPosition3D  = new Vector2(_leftInfo.anchoredPosition.x - InfoMove, _leftInfo.anchoredPosition.y);
        _rightInfo.anchoredPosition3D = new Vector2(_rightInfo.anchoredPosition.x + InfoMove, _rightInfo.anchoredPosition.y);
        _memorizer.Selete             = true;
    }
Exemple #15
0
    public static Material GetSharedFor(SpriteGlowEffect spriteGlow)
    {
        for (int i = 0; i < sharedMaterials.Count; i++)
        {
            if (sharedMaterials[i].SpriteTexture == spriteGlow.Renderer.sprite.texture &&
                sharedMaterials[i].DrawOutside == spriteGlow.DrawOutside &&
                sharedMaterials[i].InstancingEnabled == spriteGlow.EnableInstancing)
            {
                return(sharedMaterials[i]);
            }
        }

        var material = new SpriteGlowMaterial(spriteGlow.Renderer.sprite.texture, spriteGlow.DrawOutside, spriteGlow.EnableInstancing);

        material.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor | HideFlags.NotEditable;
        sharedMaterials.Add(material);

        return(material);
    }
    public bool isHand             = false; // trueなら手札のカード

    // Use this for initialization
    void Start()
    {
        _eventTrigger = gameObject.AddComponent <ObservableEventTrigger>();
        _spriteGlow   = GetComponent <SpriteGlowEffect>();
        // _spriteRenderer = GetComponent<SpriteRenderer>();

        //handControl.addClickObserver(this);
        //handControl.addDealObserver(this);

        // typeとcolorElementに合わせて見た目を変える
        _typeSprite = transform.Find("Type").gameObject;
        _typeSprite.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Type/" + Type.ToString());

        _colorElementSprite = transform.Find("ColorElement").gameObject;
        _colorElementSprite.GetComponent <SpriteGlowEffect>().GlowColor = meatColors[(int)Color];

        if (isBack)
        {
            ShowBack();
        }
    }
Exemple #17
0
 private void Awake()
 {
     _glow = transform.Find("Light").GetComponent <SpriteGlowEffect>();
     BroadcastMessage("GetWeaponInfo", transform, SendMessageOptions.DontRequireReceiver);
 }
 // Use this for initialization
 void Start()
 {
     _brakeLight = GetComponent <SpriteGlowEffect>();
     _brakeLight.GlowBrightness = 1.54f;
     _descend = false;
 }
    void Start()
    {
        glowing = GetComponent <SpriteGlowEffect>();

        glowing.enabled = false;
    }
 private void Awake()
 {
     spriteGlow = GetComponent <SpriteGlowEffect>();
 }
Exemple #21
0
 // Start is called before the first frame update
 void Awake()
 {
     sr = GetComponent <SpriteRenderer>();
     spriteGlowScript = gameObject.GetComponent <SpriteGlowEffect>();
     sr.color         = new Color(sr.color.r, sr.color.g, sr.color.b, 0);
 }
    private void BuilCell(Vector2 randomCellPosition, Quaternion rotation, int index, float i, float j, Vector2 pivot, Rect rec, int maxGlowWidth)
    {
        //Cordinates for cell
        float xCordinate = (pixel * i) + (pixel / 2f);
        float yCordinate = (pixel * j) + (pixel / 2f);

        Debug.Log("index: " + index.ToString());
        Debug.Log("truePosition: " + new Vector2(xCordinate, yCordinate).ToString());
        Debug.Log("randomPosition: " + randomCellPosition.ToString());
        Debug.Log("rotation: " + rotation.ToString());

        //Creating cells
        GameObject cell = new GameObject();

        //Bounding with script
        cell.AddComponent <TouchSwapCell>();
        //---------------------

        RectTransform rectTransform = cell.AddComponent <RectTransform>() as RectTransform;
        BoxCollider2D box2D         = cell.AddComponent <BoxCollider2D>() as BoxCollider2D;

        //Creating with z: +90 position, because default z position is -180 and we want it to be 0
        if (isRotateEnabled)
        {
            cell.transform.SetPositionAndRotation(randomCellPosition,
                                                  rotation);
        }
        else
        {
            cell.transform.SetPositionAndRotation(randomCellPosition,
                                                  Quaternion.Euler(0, 0, 0));
        }


        //Naming Cell and Setting his parent
        cell.name        = "cell_" + xCordinate.ToString() + "x" + yCordinate.ToString();
        cellsParent.name = "Parent_Of_Cells\\" + pieceCount.ToString() + "-Children";
        cell.transform.SetParent(cellsParent.transform);
        //Scalling
        rectTransform.sizeDelta = new Vector2(pixel, pixel);
        box2D.size = new Vector2(pixel, pixel);
        cell.transform.localScale = new Vector3(1, 1, 1);
        //Positioning; anchorMin and anchorMax are for starting position bottom left corner of parent.
        rectTransform.anchorMin        = new Vector2(0f, 0f);
        rectTransform.anchorMax        = new Vector2(0f, 0f);
        rectTransform.anchoredPosition = new Vector3(x: randomCellPosition.x, y: randomCellPosition.y);
        //Creating Sprite Texture---------------------------------------------------------------------
        Texture2D spriteTexture = new Texture2D((int)(pixel * 100f), (int)(pixel * 100f));
        var       pixels        = painting.texture.GetPixels((int)((pixel * 100) * i), (int)((pixel * 100) * j), (int)(pixel * 100f), (int)(pixel * 100f));

        spriteTexture.SetPixels(pixels);
        spriteTexture.Apply();
        //------------------------------------------------------------------------------------
        //Setting sprite to Cell
        SpriteRenderer spriteRenderer = cell.AddComponent <SpriteRenderer>() as SpriteRenderer;

        spriteRenderer.sprite           = Sprite.Create(spriteTexture, rec, pivot);
        spriteRenderer.sortingLayerName = "Cells";
        spriteRenderer.material.shader  = glowShader;
        //GlowEffect----------------
        SpriteGlowEffect glowEffect = cell.AddComponent <SpriteGlowEffect>();

        glowEffect.OutlineWidth   = 0;
        glowEffect.AlphaThreshold = 0.01f;
        //-------------------------
        //-----SwapCell Values---------
        SwapCell swapCell = cell.AddComponent <SwapCell>();

        swapCell.SetTruePosition(new Vector2(xCordinate, yCordinate));
        swapCell.SetIsPositionTrue(swapCell.GetTruePosition().Equals(randomCellPosition));
        swapCell.SetMaxGlowWidth(maxGlowWidth);
        swapCell.SetForward(null);
        swapCell.SetBackward(null);
        swapCell.SetLeft(null);
        swapCell.SetRight(null);
        //-----------------------
        //Finally, adding our cell to the list.
        cells.SetValue(cell, index);
    }
Exemple #23
0
 // Use this for initialization
 void Start()
 {
     _neonLight = GetComponent <SpriteGlowEffect>();
     _neonLight.GlowBrightness = 1.2f;
     _descend = false;
 }