public static void DrawDoubleCircle(Vector3 origin, Quaternion rotation, float radius1, float radius2, int pieceCount, Color color) { if (3 > pieceCount) { return; } if (0 >= radius1 || 0 >= radius2) { return; } float pieceAngle = 360.0f / pieceCount; Vector3 p0_1 = origin + rotation * Vector3.forward * radius1; Vector3 p0_2 = origin + rotation * Vector3.forward * radius2; Vector3 p1_1 = p0_1; Vector3 p1_2 = p0_2; for (int i = 0; i < pieceCount-1; ++i) { var r = Quaternion.Euler(0, pieceAngle*(i+1), 0); Vector3 p2_1 = origin + rotation * (r * Vector3.forward * radius1); Vector3 p2_2 = origin + rotation * (r * Vector3.forward * radius2); Debug.DrawLine(p1_1, p2_1, color); Debug.DrawLine(p1_2, p2_2, color); Debug.DrawLine(p2_1, p2_2, color); p1_1 = p2_1; p1_2 = p2_2; } Debug.DrawLine(p0_1, p1_1, color); Debug.DrawLine(p0_1, p0_2, color); }
/// <summary> /// Implementation of Besenham's line algorithm: /// http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm#Simplification /// </summary> public void DrawLine(Vector2 p1, Vector2 p2, Color color) { int dx = Mathf.Abs((int) (p1.x - p2.x)); int dy = Mathf.Abs((int) (p1.y - p2.y)); int sx = (p1.x < p2.x) ? 1 : -1; int sy = (p1.y < p2.y) ? 1 : -1; int err = dx - dy; int err2; while (true) { content.SetPixel((int) p1.x, (int) p1.y, color); if (p1.x == p2.x && p1.y == p2.y) break; err2 = err << 1; if (err2 > -dy) { err -= dy; p1.x += sx; } if (err2 < dx) { err += dx; p1.y += sy; } } }
public static void DrawCircle(Vector3 origin, Quaternion rotation, float radius, int pieceCount, Color color) { if (3 > pieceCount) { return; } if (0 >= radius) { return; } float pieceAngle = 360.0f / pieceCount; Vector3 p0 = origin + rotation * Vector3.forward * radius; Vector3 p1 = p0; for (int i = 0; i < pieceCount-1; ++i) { var r = Quaternion.Euler(0, pieceAngle*(i+1), 0); Vector3 p2 = origin + rotation * (r * Vector3.forward * radius); Debug.DrawLine(p1, p2, color); p1 = p2; } Debug.DrawLine(p0, p1, color); }
public void DoDrawTextureCircle(Texture2D tex, int cx, int cy, int r, Color col) { //Color32 _col = (Color32)col; int x, y, px, nx, py, ny, d; // Color32[] tempArray = tex.GetPixels32(); for (x = 0; x <= r; x++) { d = (int)Mathf.Ceil(Mathf.Sqrt(r * r - x * x)); for (y = 0; y <= d; y++) { px = cx + x; nx = cx - x; py = cy + y; ny = cy - y; tex.SetPixel(px, py, col); tex.SetPixel(nx, py, col); tex.SetPixel(px, ny, col); tex.SetPixel(nx, ny, col); // tempArray[py*1024 + px] = _col; // tempArray[py*1024 + nx] = _col; // tempArray[ny*1024 + px] = _col; // tempArray[ny*1024 + nx] = _col; } } // tex.SetPixels32(tempArray); tex.Apply (); }
public DebugArrow(Color color, bool seeThrough = false) { gameObject = new GameObject("DebugArrow"); gameObject.layer = 15; // Change layer. Not reentry effect that way (TODO : try 22) haft = CreateCone(1f, 0.05f, 0.05f, 0f, 20); haft.transform.parent = gameObject.transform; haft.transform.localRotation = Quaternion.Euler(90, 0, 0); haft.layer = 15; cone = CreateCone(coneLength, 0.15f, 0f, 0f, 20); cone.transform.parent = gameObject.transform; cone.transform.localRotation = Quaternion.Euler(90, 0, 0); cone.layer = 15; SetLength(4); _haftMeshRenderer = haft.AddComponent<MeshRenderer>(); _coneMeshRenderer = cone.AddComponent<MeshRenderer>(); _haftMeshRenderer.material.color = color; _haftMeshRenderer.castShadows = false; _haftMeshRenderer.receiveShadows = false; _coneMeshRenderer.material.color = color; _coneMeshRenderer.castShadows = false; _coneMeshRenderer.receiveShadows = false; SeeThrough(seeThrough); }
public static void Write(this BinaryWriter writer, Color input) { writer.Write(input.r); writer.Write(input.g); writer.Write(input.b); writer.Write(input.a); }
void Start() { baseColour = Color.clear; //m_flagAlpha = flagRenderer != null ? flagRenderer.material.color.a : 1.0f; myFaction = gameObject.GetComponent<FactionIndentifier>(); }
public override Color Transform(Color input, float randomValue) { return input .ToHSL() .WithHue(GLRandom.RandomOffset(hue, range)) .Color; }
private Texture2D DownSample(Texture2D src) { int width = 1024, height = 512; Texture2D dst = new Texture2D(width, height, TextureFormat.ARGB32, false); Color[] cs = new Color[width * height]; for (int x = 0; x < width; ++x) for (int y = 0; y < height; ++y) { int dstIndex = x + y * width; Color dstColor = Color.black; for (int subX = 0; subX < 4; ++subX) for (int subY = 0; subY < 4; ++subY) { Color srcColor = src.GetPixel(x * 4 + subX, y * 4 + subY); dstColor += srcColor; } dstColor /= 16.0f; dstColor.a = 1.0f; cs[dstIndex] = dstColor; } dst.SetPixels(cs); dst.Apply(); return dst; }
public static void DrawNodeCurve(Rect start, Vector3 endPos) { var startPos = new Vector3(start.x + start.width, start.y + start.height / 2, 0); var startTan = startPos + Vector3.right * 50; var endTan = endPos + Vector3.left * 50; var shadowCol = new Color(0, 0, 0, 0.06f); for (int i = 0; i < 3; i++) {// Draw a shadow Handles.DrawBezier(startPos, endPos, startTan, endTan, shadowCol, null, (i + 1) * 5); } Handles.DrawBezier(startPos, endPos, startTan, endTan, Color.black, null, 1); var oldColor = Handles.color; Handles.color = new Color(.3f, 0.1f, 0.1f); Handles.DrawSolidDisc( (startPos + endPos) / 2, Vector3.forward, 5); Handles.color = Color.black; Handles.DrawWireDisc( (startPos + endPos) / 2, Vector3.forward, 5); Handles.color = oldColor; }
/// <summary> /// cut mesh by plane /// </summary> /// <param name="mesh">mesh to cut</param> /// <param name="meshTransform">transformation of the mesh</param> /// <param name="plane">cutting plane</param> /// <param name="triangulateHoles">flag for triangulation of holes</param> /// <param name="crossSectionVertexColor">this color will be assigned to cross section, valid only for vertex color shaders</param> /// <param name="crossUV">uv mapping area for cross section</param> /// <param name="allowOpenMesh">allow cutting of open mesh</param> /// <returns>processing time</returns> public float Cut(Mesh mesh, Transform meshTransform, Math.Plane plane, bool triangulateHoles, bool allowOpenMesh, ref List<CutterMesh> meshes, Color crossSectionVertexColor, Vector4 crossUV) { this.crossSectionVertexColour = crossSectionVertexColor; this.crossSectionUV = crossUV; return Cut(mesh, meshTransform, plane, triangulateHoles, allowOpenMesh, ref meshes); }
public static void Line(float yOrigin, Color color) { var rect = new Rect(0, yOrigin, Screen.width, 1); GUI.color = color; GUI.DrawTexture(rect, Drawing.Pixel); Colors.ResetUIColor(); }
void Start() { myColor = GetComponent<Renderer>().material.color; myCollider = GetComponent<Collider>(); //myMenu = GetComponent<Transform>().parent.gameObject.GetComponent<MenuController>(); -> voir ligne 43 / 44 transform.TransformPoint(1, 0, 0); }
Texture2D CreateColorTexture(Color color) { var texture = new Texture2D(1, 1); texture.SetPixel(1, 1, color); texture.Apply(); return texture; }
public static void LoadLevel(int aLevelIndex, float aFadeOutTime, float aFadeInTime, Color aColor) { if (Fading) return; Instance.m_LevelName = ""; Instance.m_LevelIndex = aLevelIndex; Instance.StartFade(aFadeOutTime, aFadeInTime, aColor); }
public static void DrawText(Vector3 position, string text, Color color) { #if UNITY_EDITOR UnityEditor.Handles.color = color; UnityEditor.Handles.Label(position, text); #endif }
private static Color ColorLerpUnclamped(Color c1, Color c2, float value) { return new Color(c1.r + (c2.r - c1.r)*value, c1.g + (c2.g - c1.g)*value, c1.b + (c2.b - c1.b)*value, c1.a + (c2.a - c1.a)*value); }
public void setup(char text, Color font, Color bg) { _text = text; _fontColor = font; _bgColor = bg; rebuilt (); }
private static void DrawPanel(Rect rect, Color color, PanelStyleOption option) { GUI.color = color; GUI.Box(rect, "", PanelStyle(option)); Colors.ResetUIColor(); }
public static void DrawRect(Vector3 left, Vector3 right, Vector3 leftEnd, Vector3 rightEnd, Color color) { Debug.DrawLine(left, right, color); Debug.DrawLine(left, leftEnd, color); Debug.DrawLine(right, rightEnd, color); Debug.DrawLine(leftEnd, rightEnd, color); }
public static int GetHueFromColor(Color color) { float r, g, b; int h = 0; r = color.r; g = color.g; b = color.b; if(r >= g && g >= b) { h = (int)(60 * GetFraction(r,g,b)); } else if(g > r && r >= b) { h = (int)(60 * (2-GetFraction(g,r,b))); } else if(g >= b && b > r) { h = (int)(60 * (2+GetFraction(g,b,r))); } else if(b > g && g > r) { h = (int)(60 * (4-GetFraction(b,g,r))); } else if(b > r && r >= g) { h = (int)(60 * (4+GetFraction(b,r,g))); } else if(r >= b && b > g) { h = (int)(60 * (6-GetFraction(r,b,g))); } return h; }
public static void DrawBounds(Bounds bounds, Color color) { var size = bounds.size; var points = new Vector3[8]; points[0] = bounds.center-bounds.extents; points[1] = points[0]+new Vector3(size.x, 0, 0); points[2] = points[0]+new Vector3(0, size.y, 0); points[3] = points[0]+new Vector3(0, 0, size.z); points[4] = bounds.center+bounds.extents; points[5] = points[4]-new Vector3(size.x, 0, 0); points[6] = points[4]-new Vector3(0, size.y, 0); points[7] = points[4]-new Vector3(0, 0, size.z); Debug.DrawLine(points[0], points[1], color); Debug.DrawLine(points[0], points[2], color); Debug.DrawLine(points[0], points[3], color); Debug.DrawLine(points[4], points[5], color); Debug.DrawLine(points[4], points[6], color); Debug.DrawLine(points[4], points[7], color); Debug.DrawLine(points[1], points[6], color); Debug.DrawLine(points[1], points[7], color); Debug.DrawLine(points[2], points[5], color); Debug.DrawLine(points[2], points[7], color); Debug.DrawLine(points[3], points[5], color); Debug.DrawLine(points[3], points[6], color); }
void OnDrawGizmos() { if (target != null) // show prey / predator indicators { var color = ch.Color; var arrowLenght = 0.4f; var direction = target.transform.position - transform.position; var clampDir = Vector3.ClampMagnitude(direction * arrowLenght, 40f); var start = getPointAtEdge(clampDir); if (WhatToWatch == WatchType.PREY) { DrawArrow.GizmoArrow(start, clampDir, color); } if (WhatToWatch == WatchType.PREDATOR) { DrawArrow.GizmoBlock(start, clampDir, color); } } if (!GizmoEnabled) return; // show sensor raycasts var colorBright = GetComponentInParent<SpriteRenderer>().color; var colorDark = new Color(colorBright.r, colorBright.g, colorBright.b, 0.1f); DrawSensors.Draw(getPointAtEdge(leftRayDirection), leftRayDirection * rayRange, colorDark); DrawSensors.Draw(getPointAtEdge(rightRayDirection), rightRayDirection * rayRange, colorDark); DrawSensors.Draw(getPointAtEdge(sensorRayDirection), sensorRayDirection * rayRange, colorBright); }
public void DrawEllipse(Color fillColor) { _type = 2; _optimizeNotTouchable = false; _fillColor = fillColor; _requireUpdateMesh = true; }
public static void ResampleColors(ref List<Color> aColorList, int aNewWidth, int aNewHeight, Color[] aPrevColors, int aStartIndex, int aOldWidth, int aOldHeight) { for (int y = 0; y < aNewHeight; ++y) { for (int x = 0; x < aNewWidth; ++x) { aColorList.Add(Sample(aPrevColors, aStartIndex, aOldWidth, aOldHeight, (float)x/(aOldWidth-1), (float)y/(aOldHeight-1))); } } }
public override void OnUpdate(float realTimeDelta, float simulationTimeDelta) { if (!ToolModule.ActiveOptions.IsFlagSet(ToolModule.ModOptions.RoadZoneModifier)) { return; } if (ToolsModifierControl.toolController == null) { return; } var isUpgradeNetToolActive = GetIsUpgradeNetToolActive(); // Keys Down -------------------------------------------------------------------------- if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift)) { if (isUpgradeNetToolActive && !_isActive) { _isActive = true; ZoneBlocksOffset.Mode = ZoneBlocksOffsetMode.HalfCell; // 0 181 255 255 _originalColor = ToolsModifierControl.toolController.m_validColor; // change tool overlay color so user can see that the modifier is enabled ToolsModifierControl.toolController.m_validColor = new Color(60f / 255f, 0f, 1f, 1f); } } if (Input.GetKeyDown(KeyCode.LeftControl) || Input.GetKeyDown(KeyCode.RightControl)) { if (isUpgradeNetToolActive && _isActive) { ZoneBlocksOffset.Mode = ZoneBlocksOffsetMode.ForcedDefault; } } // Keys Up ---------------------------------------------------------------------------- if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift)) { if (_isActive) { _isActive = false; ZoneBlocksOffset.Mode = ZoneBlocksOffsetMode.Default; ToolsModifierControl.toolController.m_validColor = _originalColor; } } if (Input.GetKeyUp(KeyCode.LeftControl) || Input.GetKeyUp(KeyCode.RightControl)) { if (isUpgradeNetToolActive && _isActive) { ZoneBlocksOffset.Mode = ZoneBlocksOffsetMode.HalfCell; } } }
public static Texture2D MakeOutline(this Texture2D texture, int width) { Color[] c = texture.GetPixels(); Color[] nc = new Color[c.Length]; for (int y = 0; y < texture.height; y++) for (int x = 0; x < texture.width; x++) { Color cc = c[x + y * texture.width]; if (cc.a < 0.1) { float a = 0; for (int cy = Mathf.Max(y - width, 0); cy <= Mathf.Min(y + width, texture.height - 1); cy++) for (int cx = Mathf.Max(x - width, 0); cx <= Mathf.Min(x + width, texture.width - 1); cx++) a = Mathf.Max(c[cx + cy * texture.width].a, a); if (a > 0.1) { nc[x + y * texture.width] = Color.black.Alpha(a); goto skip; } } if (cc.a > 0) { cc = cc.Alpha(1.0f); } nc[x + y * texture.width] = cc; skip:; } texture.SetPixels(nc, 0); texture.Apply(); return texture; }
// =================================================================================== // GUIStyle EXTENSIONS --------------------------------------------------------------- /// <summary> /// Sets the color of the given style's font. /// </summary> public static void SetFontColor(this GUIStyle guiStyle, Color color, bool setTurnedOnState = true, bool setTurnedOffState = true) { if (setTurnedOffState) guiStyle.normal.textColor = guiStyle.hover.textColor = guiStyle.active.textColor = guiStyle.focused.textColor = color; if (setTurnedOnState) guiStyle.onNormal.textColor = guiStyle.onHover.textColor = guiStyle.onActive.textColor = guiStyle.onFocused.textColor = color; }
public static Color LoadColor(JsonTextReader reader) { if (reader == null) return new Color(0, 0, 0, 0); Color color = new Color(0, 0, 0, 0); string currVal = ""; while (reader.Read()) { if (reader.Value != null) { if (reader.TokenType == JsonToken.PropertyName) currVal = (string)reader.Value; else { switch (currVal) { case "r": color.r = (float)(double)reader.Value; break; case "g": color.g = (float)(double)reader.Value; break; case "b": color.b = (float)(double)reader.Value; break; case "a": color.a = (float)(double)reader.Value; break; default: break; } } } else if (reader.TokenType == JsonToken.EndObject) return color; } return color; }
public ColorKey AddColorKey(float t, Color color) { ColorKey k = new ColorKey(t, color); Colors.Add(k); Colors.Sort(); return k; }
static int CrossFadeColor(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 5) { UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject <UnityEngine.UI.Graphic>(L, 1); UnityEngine.Color arg0 = ToLua.ToColor(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); bool arg2 = LuaDLL.luaL_checkboolean(L, 4); bool arg3 = LuaDLL.luaL_checkboolean(L, 5); obj.CrossFadeColor(arg0, arg1, arg2, arg3); return(0); } else if (count == 6) { UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject <UnityEngine.UI.Graphic>(L, 1); UnityEngine.Color arg0 = ToLua.ToColor(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); bool arg2 = LuaDLL.luaL_checkboolean(L, 4); bool arg3 = LuaDLL.luaL_checkboolean(L, 5); bool arg4 = LuaDLL.luaL_checkboolean(L, 6); obj.CrossFadeColor(arg0, arg1, arg2, arg3, arg4); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.UI.Graphic.CrossFadeColor")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CrossFadeColor(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 5 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.UI.Graphic), typeof(UnityEngine.Color), typeof(float), typeof(bool), typeof(bool))) { UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.ToObject(L, 1); UnityEngine.Color arg0 = (UnityEngine.Color)ToLua.ToObject(L, 2); float arg1 = (float)LuaDLL.lua_tonumber(L, 3); bool arg2 = LuaDLL.lua_toboolean(L, 4); bool arg3 = LuaDLL.lua_toboolean(L, 5); obj.CrossFadeColor(arg0, arg1, arg2, arg3); return(0); } else if (count == 6 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.UI.Graphic), typeof(UnityEngine.Color), typeof(float), typeof(bool), typeof(bool), typeof(bool))) { UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.ToObject(L, 1); UnityEngine.Color arg0 = (UnityEngine.Color)ToLua.ToObject(L, 2); float arg1 = (float)LuaDLL.lua_tonumber(L, 3); bool arg2 = LuaDLL.lua_toboolean(L, 4); bool arg3 = LuaDLL.lua_toboolean(L, 5); bool arg4 = LuaDLL.lua_toboolean(L, 6); obj.CrossFadeColor(arg0, arg1, arg2, arg3, arg4); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.UI.Graphic.CrossFadeColor")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void DrawRectangle(int posX, int posY, int width, int height, Color color) { if (posX + width > this.width) { width = this.width - posX; } if (posY + height > this.height) { height = this.height - posY; } var pixels = new UnityEngine.Color[width * height]; for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { pixels[y * width + x] = color; } } ((UnityTexture)this.texture).GetUnityTexture2D().SetPixels(posX, posY, width, height, pixels); }
// Use this for initialization void Start() { Transform t = GetComponent <Transform>(); Vector3 scale = t.localScale; var entity_manager = World.Active.GetOrCreateManager <EntityManager>(); player_archetype = entity_manager.CreateArchetype( typeof(Position), typeof(Velocity), typeof(Force), typeof(BondID), typeof(InteractionType)); float xscale = 1.1f * scale.x / 2f; float yscale = scale.y / 2f; float zscale = 1.1f * scale.z / 2f; positions = new float3[] { new float3(-xscale, -yscale, -zscale), new float3(-xscale, -yscale, 0f), new float3(-xscale, -yscale, zscale), new float3(0f, -yscale, -zscale), new float3(xscale, -yscale, -zscale), new float3(0f, -yscale, zscale), new float3(xscale, -yscale, 0f), new float3(xscale, -yscale, zscale), new float3(0f, -yscale, 0f), new float3(-xscale, yscale, -zscale), new float3(-xscale, yscale, 0f), new float3(-xscale, yscale, zscale), new float3(0f, yscale, -zscale), new float3(xscale, yscale, -zscale), new float3(0f, yscale, zscale), new float3(xscale, yscale, 0f), new float3(xscale, yscale, zscale), new float3(0f, yscale, 0f), }; if (debug_prototype) { debug_objects = new GameObject[positions.Length]; for (int i = 0; i < positions.Length; i++) { debug_objects[i] = Instantiate(debug_prototype); } } physical = new Entity[positions.Length]; for (int i = 0; i < positions.Length; i++) { physical[i] = entity_manager.CreateEntity(player_archetype); entity_manager.SetComponentData(physical[i], new Position { Value = positions[i] + center }); entity_manager.SetComponentData(physical[i], new Velocity { Value = new float3(0f, 0f, 0f) }); entity_manager.SetComponentData(physical[i], new Force { Value = new float3(0f, 0f, 0f) }); entity_manager.SetComponentData(physical[i], new BondID { Value = i }); entity_manager.SetComponentData(physical[i], new InteractionType { Value = Interaction.Object }); } SimulateFrame.particle_count += positions.Length; bonds = new NativeHashMap <int, BondDistance>( positions.Length * positions.Length, Allocator.Persistent); for (int i = 0; i < positions.Length; i++) { for (int j = 0; j < positions.Length; j++) { if (i != j) { int hash = i * hash_constant + j; Vector3 dr = positions[i] - positions[j]; if (!bonds.TryAdd(hash, new BondDistance { Value = Vector3.Magnitude(dr) })) { Debug.Log("Warning! Could not add bond to bonds list."); } } } } engines_work = true; water_leaking = 0; wave_magnitude = 1.4f; finished_tutorial = false; press_key_displayed = false; key_pressed = false; has_lost = false; UnityEngine.Color c = press_key_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; press_key_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_1_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_1_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_2_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_2_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_3_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_3_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_4_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_4_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_4_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_4_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_5_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_5_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_6_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_6_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_7_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_7_object.GetComponent <TMPro.TMP_Text>().color = c; c = story_8_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; story_8_object.GetComponent <TMPro.TMP_Text>().color = c; c = goal_1_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; goal_1_object.GetComponent <TMPro.TMP_Text>().color = c; c = goal_2_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; goal_2_object.GetComponent <TMPro.TMP_Text>().color = c; c = victory_1_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; victory_1_object.GetComponent <TMPro.TMP_Text>().color = c; c = victory_2_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; victory_2_object.GetComponent <TMPro.TMP_Text>().color = c; c = uh_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; uh_object.GetComponent <TMPro.TMP_Text>().color = c; c = oh_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; oh_object.GetComponent <TMPro.TMP_Text>().color = c; submerged_object.GetComponent <MeshRenderer>().enabled = false; c = submerged_text_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; submerged_text_object.GetComponent <TMPro.TMP_Text>().color = c; c = lost_text_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; lost_text_object.GetComponent <TMPro.TMP_Text>().color = c; c = restart_text_object.GetComponent <TMPro.TMP_Text>().color; c.a = 0f; restart_text_object.GetComponent <TMPro.TMP_Text>().color = c; start_time = Time.time; water_per_pour = 2; tmp_blah = false; }
public void DrawLine(int fromX, int fromY, int toX, int toY, UnityEngine.Color color) { this.SubPattern.Pattern.Editor.CurrentBrush.DrawLine(this, fromX, fromY, toX, toY, color); }
static int To(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3 && TypeChecker.CheckTypes <UnityEngine.Vector4, UnityEngine.Vector4, float>(L, 1)) { UnityEngine.Vector4 arg0 = ToLua.ToVector4(L, 1); UnityEngine.Vector4 arg1 = ToLua.ToVector4(L, 2); float arg2 = (float)LuaDLL.lua_tonumber(L, 3); FairyGUI.GTweener o = FairyGUI.GTween.To(arg0, arg1, arg2); ToLua.PushObject(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes <UnityEngine.Color, UnityEngine.Color, float>(L, 1)) { UnityEngine.Color arg0 = ToLua.ToColor(L, 1); UnityEngine.Color arg1 = ToLua.ToColor(L, 2); float arg2 = (float)LuaDLL.lua_tonumber(L, 3); FairyGUI.GTweener o = FairyGUI.GTween.To(arg0, arg1, arg2); ToLua.PushObject(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes <UnityEngine.Vector3, UnityEngine.Vector3, float>(L, 1)) { UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); float arg2 = (float)LuaDLL.lua_tonumber(L, 3); FairyGUI.GTweener o = FairyGUI.GTween.To(arg0, arg1, arg2); ToLua.PushObject(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes <float, float, float>(L, 1)) { float arg0 = (float)LuaDLL.lua_tonumber(L, 1); float arg1 = (float)LuaDLL.lua_tonumber(L, 2); float arg2 = (float)LuaDLL.lua_tonumber(L, 3); FairyGUI.GTweener o = FairyGUI.GTween.To(arg0, arg1, arg2); ToLua.PushObject(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes <UnityEngine.Vector2, UnityEngine.Vector2, float>(L, 1)) { UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 1); UnityEngine.Vector2 arg1 = ToLua.ToVector2(L, 2); float arg2 = (float)LuaDLL.lua_tonumber(L, 3); FairyGUI.GTweener o = FairyGUI.GTween.To(arg0, arg1, arg2); ToLua.PushObject(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GTween.To")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void SetLabelTextColor(UnityEngine.Color textColor) => SetTextColor("label", textColor);
public static System.Numerics.Vector4 ToImGui(this UnityEngine.Color c) { return(new System.Numerics.Vector4(c.r, c.g, c.b, c.a)); }
static public int get_linear(IntPtr l) { UnityEngine.Color o = (UnityEngine.Color)checkSelf(l); pushValue(l, o.linear); return(1); }
private void SetTileVisuals(Node <Tile> node, TileInstance tileInstance, SpriteRenderer spriteRenderer, Color colour) { if (node.Data != startTile && node.Data != goalTile) { spriteRenderer.color = colour; } tileInstance.Node = node; }
public void UF_SetRenderColor(UnityEngine.Color value) { UIColorTools.UF_SetRenderColor(this.gameObject, value); }
static public int constructor(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); UnityEngine.Color o; if (argc == 5) { System.Single a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); System.Single a3; checkType(l, 4, out a3); System.Single a4; checkType(l, 5, out a4); o = new UnityEngine.Color(a1, a2, a3, a4); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 4) { System.Single a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); System.Single a3; checkType(l, 4, out a3); o = new UnityEngine.Color(a1, a2, a3); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 0) { o = new UnityEngine.Color(); pushValue(l, true); pushObject(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public void setColor32(UnityEngine.Color color) { Element.SetAttribute <Color, UnityEngine.Color>(color); }
public static void DrawRay(UnityEngine.Vector3 start, UnityEngine.Vector3 dir, UnityEngine.Color color, float duration = 0.0f, bool depthTest = true) { UnityEngine.Debug.DrawRay(start, dir, color, duration, depthTest); }
public GameSymbol(string text, UnityEngine.Color color) { Text = text; Color = color; }
static int GetRecord(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); SingleField o = obj.GetRecord(arg0); ToLua.PushObject(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(UnityEngine.Vector2))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Vector2 arg1 = (UnityEngine.Vector2)ToLua.ToObject(L, 3); UnityEngine.Vector2 o = obj.GetRecord(arg0, arg1); ToLua.Push(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(UnityEngine.Vector3))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Vector3 arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 3); UnityEngine.Vector3 o = obj.GetRecord(arg0, arg1); ToLua.Push(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(UnityEngine.Color))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Color arg1 = (UnityEngine.Color)ToLua.ToObject(L, 3); UnityEngine.Color o = obj.GetRecord(arg0, arg1); ToLua.Push(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(string))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); string arg1 = ToLua.ToString(L, 3); string o = obj.GetRecord(arg0, arg1); LuaDLL.lua_pushstring(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(bool))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); bool arg1 = LuaDLL.lua_toboolean(L, 3); bool o = obj.GetRecord(arg0, arg1); LuaDLL.lua_pushboolean(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(RecordTable), typeof(string), typeof(float))) { RecordTable obj = (RecordTable)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); float arg1 = (float)LuaDLL.lua_tonumber(L, 3); float o = obj.GetRecord(arg0, arg1); LuaDLL.lua_pushnumber(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: RecordTable.GetRecord")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void SetColor(UnityEngine.Color color) { this.Color = color; }
public bool Equals(UnityColor other) { return(Equals((HSVColor)other)); }
public Color(UnityEngine.Color color, ColorMode mode) { this.color = color; this.mode = mode; }
public ColorRGBA(UnityEngine.Color c) : this((byte)(c.r * 255), (byte)(c.g * 255), (byte)(c.b * 255), (byte)(c.a * 255)) { }
public static Texture2D get(long code, GameTextureType type, Texture2D nullReturnValue = null) { try { PictureResource r; if (loadedList.TryGetValue(hashPic(code, type), out r)) { Texture2D re = null; if (r.u_data != null) { if (r.u_data == myBack) { return(nullReturnValue); } else { return(r.u_data); } } if (r.data != null) { re = new Texture2D(400, 600); re.LoadImage(r.data); r.u_data = re; return(re); } if (r.hashed_data != null) { int width = r.hashed_data.GetLength(0); int height = r.hashed_data.GetLength(1); UnityEngine.Color[] cols = new UnityEngine.Color[width * height]; re = new Texture2D(width, height); for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { cols[h * width + w] = new UnityEngine.Color(r.hashed_data[w, h, 0], r.hashed_data[w, h, 1], r.hashed_data[w, h, 2], r.hashed_data[w, h, 3]); } } re.SetPixels(0, 0, width, height, cols); re.Apply(); r.u_data = re; return(re); } } else { if (!addedMap.ContainsKey(hashPic(code, type))) { PictureResource a = new PictureResource(type, code, nullReturnValue); bLock = true; waitLoadStack.Push(a); bLock = false; addedMap.Add((UInt64)type << 32 | (UInt64)code, true); } } } catch (Exception e) { Debug.Log("BIGERROR1:" + e.ToString()); } return(null); }
public TextContext(Factory f, GameObject p, Data data, int objectId) { factory = f; parent = p; Format.Text text = data.texts[objectId]; Format.TextProperty textProperty = data.textProperties[text.textPropertyId]; Format.Font fontProperty = data.fonts[textProperty.fontId]; color = factory.ConvertColor(data.colors[text.colorId]); string fontName = data.strings[fontProperty.stringId]; string fontPath = factory.fontPrefix + fontName; float fontHeight = (float)textProperty.fontHeight; float width = (float)text.width; float height = (float)text.height; float lineSpacing = 1.0f + (float)textProperty.leading / fontHeight; float letterSpacing = fontProperty.letterspacing; float tabSpacing = 4.0f; float leftMargin = textProperty.leftMargin / fontHeight; float rightMargin = textProperty.rightMargin / fontHeight; if (fontName.StartsWith("_")) { ISystemFontRenderer.Style style; if (fontName == "_bold") { style = ISystemFontRenderer.Style.BOLD; } else if (fontName == "_italic") { style = ISystemFontRenderer.Style.ITALIC; } else if (fontName == "_bold_italic") { style = ISystemFontRenderer.Style.BOLD_ITALIC; } else { style = ISystemFontRenderer.Style.NORMAL; } ISystemFontRenderer.Align align; int a = textProperty.align & (int)Align.ALIGN_MASK; switch (a) { default: case (int)Align.LEFT: align = ISystemFontRenderer.Align.LEFT; break; case (int)Align.RIGHT: align = ISystemFontRenderer.Align.RIGHT; break; case (int)Align.CENTER: align = ISystemFontRenderer.Align.CENTER; break; } ISystemFontRenderer.VerticalAlign valign; int va = textProperty.align & (int)Align.VERTICAL_MASK; switch (va) { default: valign = ISystemFontRenderer.VerticalAlign.TOP; break; case (int)Align.VERTICAL_BOTTOM: valign = ISystemFontRenderer.VerticalAlign.BOTTOM; break; case (int)Align.VERTICAL_MIDDLE: valign = ISystemFontRenderer.VerticalAlign.MIDDLE; break; } systemFontRendererParameter = new ISystemFontRenderer.Parameter( fontHeight, width, height, style, align, valign, lineSpacing, letterSpacing, leftMargin, rightMargin); systemFontRenderer = ISystemFontRenderer.Construct(); } else { BitmapFont.Renderer.Align align; int a = textProperty.align & (int)Align.ALIGN_MASK; switch (a) { default: case (int)Align.LEFT: align = BitmapFont.Renderer.Align.LEFT; break; case (int)Align.RIGHT: align = BitmapFont.Renderer.Align.RIGHT; break; case (int)Align.CENTER: align = BitmapFont.Renderer.Align.CENTER; break; } BitmapFont.Renderer.VerticalAlign valign; int va = textProperty.align & (int)Align.VERTICAL_MASK; switch (va) { default: valign = BitmapFont.Renderer.VerticalAlign.TOP; break; case (int)Align.VERTICAL_BOTTOM: valign = BitmapFont.Renderer.VerticalAlign.BOTTOM; break; case (int)Align.VERTICAL_MIDDLE: valign = BitmapFont.Renderer.VerticalAlign.MIDDLE; break; } bitmapFontRenderer = new BitmapFont.Renderer(fontPath, fontHeight, width, height, align, valign, 0.25f, lineSpacing, letterSpacing, tabSpacing, leftMargin, rightMargin); } }
static public int get_gamma(IntPtr l) { UnityEngine.Color o = (UnityEngine.Color)checkSelf(l); pushValue(l, o.gamma); return(1); }
Void UnityEngine.Rendering.SphericalHarmonicsL2::AddAmbientLightInternal(UnityEngine.Color,UnityEngine.Rendering.SphericalHarmonicsL2&)
public static string ValueHandleToUssString(StyleSheet sheet, UssExportOptions options, string propertyName, StyleValueHandle handle) { string str = ""; switch (handle.valueType) { case StyleValueType.Keyword: str = sheet.ReadKeyword(handle).ToString().ToLower(); break; case StyleValueType.Float: { var num = sheet.ReadFloat(handle); if (num == 0) { str = "0"; } else { str = num.ToString(CultureInfo.InvariantCulture.NumberFormat); if (IsLength(propertyName)) { str += "px"; } } } break; case StyleValueType.Dimension: var dim = sheet.ReadDimension(handle); if (dim.value == 0 && !dim.unit.IsTimeUnit()) { str = "0"; } else { str = dim.ToString(); } break; case StyleValueType.Color: UnityEngine.Color color = sheet.ReadColor(handle); str = ToUssString(color, options.useColorCode); break; case StyleValueType.ResourcePath: str = $"resource('{sheet.ReadResourcePath(handle)}')"; break; case StyleValueType.Enum: str = sheet.ReadEnum(handle); break; case StyleValueType.String: str = $"\"{sheet.ReadString(handle)}\""; break; case StyleValueType.MissingAssetReference: str = $"url('{sheet.ReadMissingAssetReferenceUrl(handle)}')"; break; case StyleValueType.AssetReference: var assetRef = sheet.ReadAssetReference(handle); str = GetPathValueFromAssetRef(assetRef); break; case StyleValueType.Variable: str = sheet.ReadVariable(handle); break; case StyleValueType.ScalableImage: var image = sheet.ReadScalableImage(handle); var normalImage = image.normalImage; str = GetPathValueFromAssetRef(normalImage); break; default: throw new ArgumentException("Unhandled type " + handle.valueType); } return(str); }
private void DrawLine(Texture2D a_Texture, Vector2 ptStart, Vector2 ptEnd, UnityEngine.Color a_Color) { KinectInterop.DrawLine(a_Texture, (int)ptStart.x, (int)ptStart.y, (int)ptEnd.x, (int)ptEnd.y, a_Color); }
public void SetTextColor(string styleName, UnityEngine.Color textColor) { skin.GetStyle(styleName).normal.textColor = textColor; }
// Start is called before the first frame update void Start() { preColor = GameObject.FindGameObjectWithTag("Box").GetComponent <MeshRenderer>().material.color; }
public static void DrawLine(UnityEngine.Vector3 start, UnityEngine.Vector3 end, UnityEngine.Color color, float duration = 0.0f, bool depthTest = true) { UnityEngine.Debug.DrawLine(start, end, color, duration, depthTest); }
public void DrawBrush(int brushX, int brushY, UnityEngine.Color color) { this.SubPattern.Pattern.Editor.CurrentBrush.Draw(this, brushX, brushY, color); }