Beispiel #1
0
    public Eye(
        MutableMeshVertex topLeftEyeLid,
        MutableMeshVertex topRightEyeLid,
        MutableMeshVertex bottomLeftEyeLid,
        MutableMeshVertex bottomRightEyeLid,
        MutableMeshVertex leftCorner,
        MutableMeshVertex rightCorner
        )
    {
        center = new Vector3(
            leftCorner.Pos.x + (rightCorner.Pos.x - leftCorner.Pos.x) / 2.0f,
            bottomLeftEyeLid.Pos.y + (topLeftEyeLid.Pos.y - bottomLeftEyeLid.Pos.y) / 2.0f,
            0.0f
            );

        this.topLeftEyeLid     = CreateEyeLidVertex(topLeftEyeLid, center);
        this.topRightEyeLid    = CreateEyeLidVertex(topRightEyeLid, center);
        this.bottomLeftEyeLid  = CreateEyeLidVertex(bottomLeftEyeLid, center);
        this.bottomRightEyeLid = CreateEyeLidVertex(bottomRightEyeLid, center);
        this.leftCorner        = leftCorner;
        this.rightCorner       = rightCorner;

        this.leftCorner.Color  = Color.white;
        this.rightCorner.Color = Color.white;
    }
Beispiel #2
0
    static EyeLidVertex CreateEyeLidVertex(MutableMeshVertex vertex, Vector3 center)
    {
        var openPosition   = vertex.Pos;
        var closedPosition = new Vector3(vertex.Pos.x, center.y, 0.0f);

        return(new EyeLidVertex(vertex, openPosition, closedPosition));
    }
Beispiel #3
0
    public EyeLidVertex(MutableMeshVertex vertex, Vector3 openPosition, Vector3 closedPosition)
    {
        this.vertex         = vertex;
        this.closedPosition = closedPosition;
        this.vertex.Color   = Color.white;

        var openPositionOffset = openPosition - closedPosition;

        openDirection = openPositionOffset.normalized;
        openDistance  = openPositionOffset.magnitude;
    }
Beispiel #4
0
 public AnimatedVertex(MutableMeshVertex vertex, float speed, Action completion)
 {
     if (vertex == null)
     {
         throw new ArgumentNullException("vertex cannot be null");
     }
     this.vertex     = vertex;
     this.speed      = speed;
     initialPosition = vertex.Pos;
     this.completion = completion;
 }
Beispiel #5
0
    public AnimatedBorderVertex(Vector3 posInside, Vector3 posOutside, MutableMeshVertex vertex)
    {
        if (vertex == null)
        {
            throw new ArgumentException("vertex cannot be null");
        }

        if (posInside != vertex.Pos)
        {
            throw new ArgumentException(string.Format("Vertex.Pos {0} should be equal to posInside {1}", vertex.Pos, posInside));
        }

        this.posInside        = posInside;
        this.directionOutside = (posOutside - posInside);
        this.vertex           = vertex;
        ratio = 0.0f;
    }