public void Init(FContainer container, uint color, bool shouldUpdateColliders) { _container = container; _container.AddChild(_drawHolder = new FContainer()); _color = RXColor.GetColorFromHex(color); this.shouldUpdateColliders = shouldUpdateColliders; Collider[] colliders = gameObject.GetComponents <Collider>(); int colliderCount = colliders.Length; for (int c = 0; c < colliderCount; c++) { Collider collider = colliders[c]; FNode newNode = null; if (collider is BoxCollider) { FSprite sprite = new FSprite("Debug/Square"); sprite.color = _color; newNode = sprite; } else if (collider is SphereCollider) { FSprite sprite = new FSprite("Debug/Circle"); sprite.color = _color; newNode = sprite; } if (newNode != null) { _drawHolder.AddChild(newNode); _nodes.Add(newNode); } } FPPolygonalCollider mesh2D = gameObject.GetComponent <FPPolygonalCollider>(); if (mesh2D != null) { FPDebugPolygonColliderView debugView = new FPDebugPolygonColliderView("Debug/Triangle", mesh2D); debugView.color = _color; _drawHolder.AddChild(debugView); _nodes.Add(debugView); } Update(); if (!shouldUpdateColliders) { UpdateColliders(); //always update the colliders the first time } }
public Color GetDesaturatedColor() { RXColorHSL hsl = RXColor.HSLFromColor(_upColor); hsl.s = 0.25f; hsl.l = 0.6f; return(RXColor.ColorFromHSL(hsl)); }
public PlayerColor(string name, uint hex, int soundIndex) { this.name = name; this.hex = hex; this.color = RXColor.GetColorFromHex(hex); this.soundNormalName = "Musical/Note" + soundIndex + "_normal"; this.soundBassName = "Musical/Note" + soundIndex + "_bass"; }
override public void PopulateRenderLayer() { if(_isOnStage && _firstFacetIndex != -1) { _isMeshDirty = false; Vector3[] vertices = _renderLayer.vertices; Vector2[] uvs = _renderLayer.uvs; Color[] colors = _renderLayer.colors; List<Vector2[]> vertexPolygons = _mesh2D.polygonalData.vertexPolygons; List<int[]> trianglePolygons = _mesh2D.polygonalData.trianglePolygons; int polyCount = trianglePolygons.Count; int nextTriangleIndex = _firstFacetIndex; for(int p = 0; p<polyCount; p++) { Vector2[] polyVertices = vertexPolygons[p]; int[] polyTriangleIndices = trianglePolygons[p]; int polyTriangleCount = polyTriangleIndices.Length /3; Color drawColor = RXColor.ColorFromHSL(0.8f+RXRandom.Float(p) * 0.3f,1f,0.5f); for(int t = 0; t < polyTriangleCount; t++) { int vertexIndex0 = nextTriangleIndex*3; int vertexIndex1 = vertexIndex0 + 1; int vertexIndex2 = vertexIndex0 + 2; int threeT = t*3; _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex0], polyVertices[polyTriangleIndices[threeT]],0); _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex1], polyVertices[polyTriangleIndices[threeT+1]],0); _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex2], polyVertices[polyTriangleIndices[threeT+2]],0); uvs[vertexIndex0] = _uvBottomLeft; uvs[vertexIndex1] = _uvTopLeft; uvs[vertexIndex2] = _uvBottomRight; colors[vertexIndex0] = drawColor; colors[vertexIndex1] = drawColor; colors[vertexIndex2] = drawColor; // colors[vertexIndex0] = _alphaColor; // colors[vertexIndex1] = _alphaColor; // colors[vertexIndex2] = _alphaColor; nextTriangleIndex++; } } _renderLayer.HandleVertsChange(); } }
override public void Start() { FSprite sprite = new FSprite("WhiteBox"); sprite.color = RXColor.GetColorFromHex(0xffff00); sprite.scale = 10.0f; AddChild(sprite); FLabel lbl = new FLabel("CubanoInnerShadow", "HELLO WORLD"); lbl.color = Color.black; AddChild(lbl); }
// Use this for initialization void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; bool landscape = true; bool portrait = false; bool isIPad = SystemInfo.deviceModel.Contains("iPad"); bool shouldSupportPortraitUpsideDown = isIPad && portrait; //only support portrait upside-down on iPad FutileParams fparams = new FutileParams(landscape, landscape, portrait, shouldSupportPortraitUpsideDown); fparams.backgroundColor = RXColor.GetColorFromHex(0xff00ff); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1"); //iPhone fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1024.0f, 2.0f, 2.0f, "_Scale2"); //iPad fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4"); //iPad Retina fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/UIFonts"); Futile.atlasManager.LoadAtlas("Atlases/GameAtlas"); FTextParams textParams; textParams = new FTextParams(); textParams.lineHeightOffset = -8.0f; Futile.atlasManager.LoadFont("Franchise", "FranchiseFont" + Futile.resourceSuffix, "Atlases/FranchiseFont" + Futile.resourceSuffix, -2.0f, -5.0f, textParams); textParams = new FTextParams(); textParams.kerningOffset = -0.5f; textParams.lineHeightOffset = -8.0f; Futile.atlasManager.LoadFont("CubanoInnerShadow", "Cubano_InnerShadow" + Futile.resourceSuffix, "Atlases/CubanoInnerShadow" + Futile.resourceSuffix, 0.0f, 2.0f, textParams); GoToPage(PageType.MainPage); }
public static Color ColorHSL(float sat = 1f, float lum = 0.5f, float alpha = 1f) { return(RXColor.ColorFromHSL(RXRandom.Float(), sat, lum, alpha)); }
public PlayerColor(string name, uint hex) { this.name = name; this.color = RXColor.GetColorFromHex(hex); }