using System.Collections;
using UnityEngine;
public class MoveObject : MonoBehaviour
{
public delegate void MoveObjectDelegate();
protected MoveObjectDelegate callback;
public float speed = 500f;
public virtual void move(Vector3 targetPosition)
{
StartCoroutine(SmoothMovement(targetPosition));
}
public virtual void move(Vector3 targetPosition, MoveObjectDelegate moveObjectDelegate)
{
callback = moveObjectDelegate;
StartCoroutine(SmoothMovement(targetPosition));
}
protected IEnumerator SmoothMovement(Vector3 targetPosition)
{
//Calculate the remaining distance to move based on the square magnitude of the difference between current position and end parameter.
//Square magnitude is used instead of magnitude because it's computationally cheaper.
float sqrRemainingDistance = (transform.localPosition - targetPosition).sqrMagnitude;
//While that distance is greater than a very small amount (Epsilon, almost zero):
while (sqrRemainingDistance > float.Epsilon)
{
//Find a new position proportionally closer to the end, based on the moveTime
Vector3 newPostion = Vector3.MoveTowards(transform.localPosition, targetPosition, speed * Time.deltaTime);
//Call MovePosition on attached Rigidbody2D and move it to the calculated position.
transform.localPosition = newPostion;
//rb2D.MovePosition(newPostion);
//Recalculate the remaining distance after moving.
sqrRemainingDistance = (transform.localPosition - targetPosition).sqrMagnitude;
//Return and loop until sqrRemainingDistance is close enough to zero to end the function
yield return null;
}
OnMoveDone();
}
protected virtual void OnMoveDone()
{
if (callback != null)
callback();
}
}
I don’t know the purpose of music, music purpose to listen and we suppose to… maybe… our emotion suppose to be touched.
Maybe because what your story is, you make us felt it because you felt it. You’re feeling music much more than any body else just singing.
This next song is call “Smile” and I want to tell you just a tiny litte story about why it’s important to me.
When I was losing hearing when I was music school I got really distress as you probably could image. And I just stop doing music. I didn’t feel the need any more, I didn’t want to any more, just didn’t feel right.
But every day I sat at my room by myself and I sang the song over and over and over again. And the meaning behind it’s… I guest it suppose to be happy but not for me, It’s more like… I’m not in that good place yet, I’m not there, but I can see it in the future and I know that I need to smile to through this, I need to make it OK.
So this song for me was what pull me out of that hole. And I just want to encourage you guys there are so many things you challenge in your life that you feel it can get over, and this is your moment, you can’t just let it go because it difficult. If you have a dream you do it. If it’s different, if it changed, then go around, find a different route but find the finish line, smile through it, it’s gonna be OK.
So this is my song for you. And it was title track of my album because I need to do for myself. So I hope you enjoy it.