Example #1
0
 public void Create(int letter, int color, Vector2 position, float size, GameObject folder)
 {
     obj = (GameObject)Instantiate(_font.prefab, new Vector3(position.x, 1, position.y), Quaternion.identity);
     obj.transform.parent     = folder.transform;
     obj.transform.localScale = new Vector3(size, 1, size);
     UVFunctions.SetUVByPixelSizes(new Vector2(_letter, color), _font.size, false, obj.GetComponent <MeshFilter>().mesh, obj.GetComponent <MeshRenderer>().sharedMaterial.mainTexture);
 }
Example #2
0
 // Starts timer and set current frame to 1, allowing the animation to start (or to loop) from it's first frame.
 private void ResetAnimation()
 {
     animationTimer = currentAnimation.frameDuration;
     currentFrame   = 0;
     UVFunctions.SetUVByPixelSizes(new Vector2((currentAnimation.startingHorizontalCell), currentAnimation.startingVerticalCell), new Vector2(cellHorizontalSize, cellVerticalSize), mirroredImage, mesh, GetComponent <MeshRenderer>().sharedMaterial.mainTexture);
     //Debug.Log("" + gameObject.name + " started <" + currentAnimation.name + "> as current animation");
 }
Example #3
0
            public void ChangeColor()
            {
                _color++;
                if (_color > 7)
                {
                    _color -= 8;
                }
                int tmpColor = _color;

                if (DrawableObject.colorblindMode)
                {
                    tmpColor += 8;
                }
                UVFunctions.SetUVByPixelSizes(new Vector2(_letter, tmpColor), _font.size, false, obj.GetComponent <MeshFilter>().mesh, obj.GetComponent <MeshRenderer>().sharedMaterial.mainTexture);
            }
    public GameObject LineCreate(float startingX, float startingY, float endingX, float endingY, GameObject lineParent, string lineName)
    {
        GameObject tmp_line = (GameObject)Instantiate(linePrefab, new Vector3(startingX, lineParent.transform.position.y + 0.05f, startingY), linePrefab.transform.rotation);

        tmp_line.name = lineName;
        UVFunctions.SetUVByPixelSizes(getUVColorPosition(color), Vector2.one * 8, false, tmp_line.GetComponent <MeshFilter>().mesh, tmp_line.GetComponent <MeshRenderer>().sharedMaterial.mainTexture);
        Vector2 delta = new Vector2(endingX - startingX, endingY - startingY);
        float   angle = (float)System.Math.Atan2(delta.x, delta.y) * 180 / ((float)System.Math.PI);

        if (angle < 0)
        {
            angle += 360;
        }
        tmp_line.transform.Rotate(0, angle, 0);
        float distance = Vector2.Distance(new Vector2(startingX, startingY), new Vector2(endingX, endingY));

        tmp_line.transform.localScale = new Vector3(5 * lineSize, 5 * lineSize, distance + lineSize);
        tmp_line.transform.parent     = lineParent.transform;
        lines.Add(tmp_line);
        return(tmp_line);
    }
 public void LineChangeColor(GameObject lineToColor, byte newColor)
 {
     UVFunctions.SetUVByPixelSizes(getUVColorPosition(newColor), Vector2.one * 8, false, lineToColor.GetComponent <MeshFilter>().mesh, lineToColor.GetComponent <MeshRenderer>().sharedMaterial.mainTexture);
 }
Example #6
0
 // Called during animation play to set current image index.
 private void SetFramedImage()
 {
     UVFunctions.SetUVByPixelSizes(new Vector2((currentAnimation.startingHorizontalCell + currentFrame), currentAnimation.startingVerticalCell), new Vector2(cellHorizontalSize, cellVerticalSize), mirroredImage, mesh, GetComponent <MeshRenderer>().sharedMaterial.mainTexture);
     //Debug.Log("" + gameObject.name + " set frame " + (currentFrame+1).ToString() + " in <" + currentAnimation.name + "> as current image");
 }
Example #7
0
 // Sets a single image by indicating its cells
 public void SetSingleImage(int horCell, int verCell)
 {
     UVFunctions.SetUVByPixelSizes(new Vector2(horCell, verCell), new Vector2(cellHorizontalSize, cellVerticalSize), mirroredImage, mesh, GetComponent <MeshRenderer>().sharedMaterial.mainTexture);
     currentAnimation = null;
 }