Exemplo n.º 1
0
        protected override void AddKeyFrame(float time)
        {
            //position
            if (useLocalCoordinates)
            {
                positionKey.AddKeyframe(transform.localPosition, time);
            }
            else
            {
                positionKey.AddKeyframe(transform.position, time);
            }

            //rotation
            if (useLocalCoordinates)
            {
                rotationKey.AddKeyframe(transform.localRotation, time);
            }
            else
            {
                rotationKey.AddKeyframe(transform.rotation, time);
            }
        }
Exemplo n.º 2
0
	IEnumerator WriteCurves()
	{
		float time = 0;

		//reset variables
		positionKey = new KeyframeVector3();
		rotationKey = new KeyframeQuaternion();
		scaleKey = new KeyframeVector3();

		float removeTime = 0;
		while( recording == true )
		{
			time = RePlayTimeline.SELF.CurrentTime();

			//remove keyframes that are not within timeframe
			removeTime += keyframeInterval;
			if( removeTime > 1 )
			{
				CheckMaxTime(time);
				removeTime = 0;
			}

			//position
			if( recordPosition == true )
			{
				positionKey.AddKeyframe( transform.position, time );
			}

			//rotation
			if( recordRotation == true )
			{
				rotationKey.AddKeyframe( transform.rotation, time );
			}

			//scale
			if( recordScale == true )
			{
				scaleKey.AddKeyframe( transform.localScale, time );
			}

			yield return new WaitForSeconds( keyframeInterval );
		}

		//remove keyframes that are not within timeframe
		CheckMaxTime(RePlayTimeline.SELF.CurrentTime());

		//when recording stops, write to curves
		if( recordPosition == true )
		{
			positionKey.SetCurves();
		}
		if( recordRotation == true )
		{
			rotationKey.SetCurves();
		}
		if( recordScale == true )
		{
			scaleKey.SetCurves();
		}

		yield return null;
	}