Exemplo n.º 1
0
        protected override void OnUpdate()
        {
            Entities.ForEach((Button button) => {
                var entity = GetPrimaryEntity(button);

                var colorBlock = button.colors;
                DstEntityManager.AddComponentData(entity, ClickState.Default());
                DstEntityManager.AddComponentData(entity, ButtonVisual.Default());
                DstEntityManager.AddComponentData(entity, ColorStates.FromColorBlock(colorBlock));

                if (!button.interactable)
                {
                    DstEntityManager.AddComponentData(entity, new NonInteractableButtontag {
                    });
                    DstEntityManager.SetComponentData(entity, new AppliedColor {
                        Value = colorBlock.disabledColor
                    });
                }
                else
                {
                    DstEntityManager.AddComponentData(entity, new AppliedColor {
                        Value = colorBlock.normalColor
                    });
                }
            });
        }
    public void AutomateEnter(string color)
    {
        #region Resets
        Time.timeScale = 1;
        if (playerUIManager.circleBar != null)
        {
            playerUIManager.circleBar.fillAmount = 1;
        }
        #endregion

        #region Initialisation
        Debug.Log(color + ": Enter");
        colorState = (ColorStates)System.Enum.Parse(typeof(ColorStates), color);
        if (colorCycler != null)
        {
            colorCycler.ProcessColorString(color);
        }

        #region Enabling
        colorScripts.redMovement.enabled    = (color == "Red") ? true : false;
        colorScripts.yellowMovement.enabled = (color == "Yellow") ? true : false;
        colorScripts.greenMovement.enabled  = (color == "Green") ? true : false;
        colorScripts.blueMovement.enabled   = (color == "Blue") ? true : false;
        colorScripts.purpleMovement.enabled = (color == "Purple") ? true : false;
        #endregion
        #endregion
    }
Exemplo n.º 3
0
    private static void drawRectangle(BoxCollider2D box)
    {
        var corners = box.GetWorldCorners();

        for (int i = 0; i < corners.Length; i++)
        {
            int ii = (i + 1) % corners.Length;

            ColorStates state       = ColorStates.IDLE;
            Color       lineColor   = ColorPalletReader.GetLineColor(state);
            Color       vertexColor = ColorPalletReader.GetLineColor(state);
            if (_assignedColors.TryGetValue(box, out state))
            {
                lineColor   = ColorPalletReader.GetLineColor(state);
                vertexColor = ColorPalletReader.GetVertexColor(state);
            }
            else
            {
                state       = Utilities.DetermineColorState(box);
                lineColor   = ColorPalletReader.GetLineColor(state);
                vertexColor = ColorPalletReader.GetVertexColor(state);
                _assignedColors.Add(box, state);
            }
            if (i == _selectedEdge && Selection.activeGameObject == box.gameObject)
            {
                lineColor = ColorPalletReader.GetLineColor(ColorStates.SELECTED);
            }

            // Draw edges
            Gizmos.color = lineColor;
            Gizmos.DrawLine(corners[i], corners[ii]);

            // Draw corners
            if (Selection.activeGameObject == box.gameObject)
            {
                if (i == _selectedCorner)
                {
                    vertexColor = ColorPalletReader.GetVertexColor(ColorStates.SELECTED);
                }

                Gizmos.color = vertexColor;
                Gizmos.DrawSphere(corners[i], BrushSettingsWindow.VertexSize);
                if (BrushSettingsWindow.ShowVertexInfo == true)
                {
                    Handles.Label(corners[i] + new Vector2(0.1f, 0.4f), (corners[i] - new Vector2(box.transform.position.x, box.transform.position.y)).ToString());
                }
            }
        }
    }
Exemplo n.º 4
0
    void Start()
    {
        //pSystem = GetComponentInChildren<ParticleSystem>();
        //abilities = GetComponentInParent<Abilities>();
        //pSystem.gameObject.SetActive(false);
        player      = GameObject.Find("Player");
        pColor      = GetComponent <ParticleSystemRenderer>();
        colorStates = GameObject.Find("Player").GetComponent <ColorStates>();

        //SetColor();

        if (dissapearingParticle)
        {
            SetColor();
        }
    }
Exemplo n.º 5
0
    // STATIC HELPER FUNCTIONS
    //
    private static void drawPolygon(PolygonCollider2D polygon, Color lineColor)
    {
        Vector2[] vertices = polygon.GetWorldPoints();
        if (vertices == null)
        {
            return;
        }

        for (int i = 0; i < vertices.Length; i++)
        {
            int ii = (i + 1) % vertices.Length;
            // Draw edge
            Gizmos.color = lineColor;
            Gizmos.DrawLine(vertices[i], vertices[ii]);

            // Draw vertex
            if (Selection.activeGameObject == polygon.gameObject)
            {
                ColorStates state = ColorStates.IDLE;
                if (_assignedColors.TryGetValue(polygon, out state))
                {
                    Gizmos.color = ColorPalletReader.GetVertexColor(state);
                }
                else
                {
                    state        = Utilities.DetermineColorState(polygon);
                    Gizmos.color = ColorPalletReader.GetVertexColor(state);
                    _assignedColors.Add(polygon, state);
                }

                if (i == _selectedVertex)
                {
                    Gizmos.color = ColorPalletReader.GetVertexColor(ColorStates.SELECTED);
                }
                Gizmos.DrawSphere(vertices[i], BrushSettingsWindow.VertexSize);
                if (BrushSettingsWindow.ShowVertexInfo == true)
                {
                    Handles.Label(vertices[i] + new Vector2(0.1f, 0.4f), (vertices[i] - new Vector2(polygon.transform.position.x, polygon.transform.position.y)).ToString());
                }
            }
        }
        Handles.color = lineColor;
    }
Exemplo n.º 6
0
//	void Colorize()
//	{
//
//		switch(colors)
//		{
//		case Colors.blue:
//			_color = Blue;
//			break;
//		case Colors.black:
//			_color = Black;
//			break;
//		case Colors.green:
//			_color = Green;
//			break;
//		case Colors.white:
//			_color = White;
//			break;
//		case Colors.red:
//			_color = Red;
//			break;
//		}
//		t += FadeLerp;
//		ResultingColor = Color.Lerp(Sprite.color,Color.black,10 * Time.deltaTime);
//		//Debug.Log(t);
//		Sprite.color = ResultingColor;
//		if(Sprite.color == _color || t >= FadeCutoff)
//		{
//
//			t = 0;
//			//Debug.Log("Finished Coloring");
//			ColorStateMethod = new ColorStates(ToTransparent);
//
//		}
//
//	}

    public bool ToTransparent()
    {
        //t+=FadeLerp * 200;
        //Debug.Log("ToTransparent " + t + Sprite.color.ToString());
        //Sprite.color = Color.white;
        ResultingColor = Color.Lerp(Sprite.color, Color.clear, 1.2f * Time.deltaTime);
        Sprite.color   = ResultingColor;
        //Debug.Log(ResultingColor);
        if (ResultingColor.a <= 1)
        {
            Debug.Log("Finished fading");
            t = 0;
            ColorStateMethod = new ColorStates(NullState);
            Sprite.color     = new Color(0, 0, 0, 0);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 7
0
    static void DrawPolgonColliders2D(PolygonCollider2D polygon, GizmoType gizmoType)
    {
        BrushSettingsWindow.Initialize();
        var lineColor = ColorPalletReader.GetLineColor(ColorStates.SELECTED);

        if (gizmoType == GizmoType.NotSelected)
        {
            ColorStates state = ColorStates.IDLE;
            if (_assignedColors.TryGetValue(polygon, out state))
            {
                lineColor = ColorPalletReader.GetLineColor(state);
            }
            else
            {
                state     = Utilities.DetermineColorState(polygon);
                lineColor = ColorPalletReader.GetLineColor(state);
                _assignedColors.Add(polygon, state);    // Cache it because GetComponent is slow.
            }
        }

        drawPolygon(polygon, lineColor);
    }
Exemplo n.º 8
0
    void Start()
    {
        pSystemConstant = gameObject.transform.FindChild("FX_ParticleBall").GetComponent <ParticleSystem>();
        pSystemExplode1 = gameObject.transform.FindChild("FX_ParticleExplode1").GetComponent <ParticleSystem>();
        pSystemExplode2 = gameObject.transform.FindChild("FX_ParticleExplode2").GetComponent <ParticleSystem>();

        pRenderConstant = pSystemConstant.GetComponent <ParticleSystemRenderer>();
        pRenderExplode1 = pSystemExplode1.GetComponent <ParticleSystemRenderer>();
        pRenderExplode2 = pSystemExplode2.GetComponent <ParticleSystemRenderer>();

        colorStates = GameObject.Find("Player").GetComponent <ColorStates>();
        myCollider  = gameObject.GetComponent <CircleCollider2D>();

        SetColor(pRenderConstant, orbColor);
        SetColor(pRenderExplode1, orbColor);
        SetColor(pRenderExplode2, orbColor);

        pSystemExplode1.Stop();
        pSystemExplode2.Stop();
        pSystemConstant.Play();

        source = GetComponent <AudioSource>();
    }
Exemplo n.º 9
0
    private static void drawCircle(CircleCollider2D circle)
    {
        var         lineColor = ColorPalletReader.GetLineColor(ColorStates.IDLE);
        ColorStates state     = ColorStates.IDLE;

        if (_assignedColors.TryGetValue(circle, out state))
        {
            lineColor = ColorPalletReader.GetLineColor(state);
        }
        else
        {
            state     = Utilities.DetermineColorState(circle);
            lineColor = ColorPalletReader.GetLineColor(state);
            _assignedColors.Add(circle, state);
        }

        if (circle.gameObject == Selection.activeGameObject && _isAdjusting)
        {
            lineColor = ColorPalletReader.GetLineColor(ColorStates.SELECTED);
        }

        Gizmos.color = lineColor;
        Gizmos.DrawWireSphere(circle.GetWorldCenter(), circle.radius);
    }
Exemplo n.º 10
0
 public void Start()
 {
     //Sprite = gameObject.GetComponent<UISlicedSprite>();
     ColorStateMethod = new ColorStates(NullState);
 }
Exemplo n.º 11
0
 public void setTargetColor(ColorStates state)
 {
     targetColorState = state;
 }
Exemplo n.º 12
0
 public void setCursorColor(ColorStates state)
 {
     cursorColorState = state;
 }
Exemplo n.º 13
0
 public static Color GetVertexColor(ColorStates state)
 {
     return(_vertexColors[(int)state]);
 }
Exemplo n.º 14
0
 public static Color GetLineColor(ColorStates state)
 {
     return(_lineColors[(int)state]);
 }
Exemplo n.º 15
0
 public static Color GetFillColor(ColorStates state)
 {
     return(_fillColors[(int)state]);
 }
Exemplo n.º 16
0
 public void Start()
 {
     //Sprite = gameObject.GetComponent<UISlicedSprite>();
     ColorStateMethod = new ColorStates(NullState);
 }
Exemplo n.º 17
0
 public void FadeWhite()
 {
     //Sprite.color = Color.white;
     //colors = Colors.white;
     ColorStateMethod = new ColorStates(FadeIn);
 }
Exemplo n.º 18
0
 //    void Colorize()
 //    {
 //        
 //        switch(colors)
 //        {
 //        case Colors.blue:
 //            _color = Blue;
 //            break;
 //        case Colors.black:
 //            _color = Black;
 //            break;
 //        case Colors.green:
 //            _color = Green;
 //            break;
 //        case Colors.white:
 //            _color = White;
 //            break;
 //        case Colors.red:
 //            _color = Red;
 //            break;
 //        }
 //        t += FadeLerp;
 //        ResultingColor = Color.Lerp(Sprite.color,Color.black,10 * Time.deltaTime);
 //        //Debug.Log(t);
 //        Sprite.color = ResultingColor;
 //        if(Sprite.color == _color || t >= FadeCutoff)
 //        {
 //            
 //            t = 0;
 //            //Debug.Log("Finished Coloring");
 //            ColorStateMethod = new ColorStates(ToTransparent);
 //            
 //        }
 //        
 //    }
 public bool ToTransparent()
 {
     //t+=FadeLerp * 200;
     //Debug.Log("ToTransparent " + t + Sprite.color.ToString());
     //Sprite.color = Color.white;
     ResultingColor = Color.Lerp(Sprite.color,Color.clear, 1.2f * Time.deltaTime);
     Sprite.color = ResultingColor;
     //Debug.Log(ResultingColor);
     if(ResultingColor.a <= 1)
     {
         Debug.Log("Finished fading");
         t = 0;
         ColorStateMethod = new ColorStates(NullState);
         Sprite.color = new Color(0,0,0,0);
         return true;
     }
     else return false;
 }
Exemplo n.º 19
0
 public void FadeWhite()
 {
     //Sprite.color = Color.white;
     //colors = Colors.white;
     ColorStateMethod = new ColorStates(FadeIn);
 }