예제 #1
0
    public IEnumerator Destroy()
    {
        status = Status.Destroy;
        if (home != null)
        {
            home.RemoveResident(this);
        }
        if (job != null)
        {
            job.RemoveWorker(this);
        }
        float t = 0f;

        while (t < 1f)
        {
            t += Time.deltaTime * 5f;
            float v = Mathf.Sin(Mathf.PI * t / 2f);
            transform.localScale = Vector3.one * Mathf.Lerp(1f, 1.25f, v);
            yield return(null);
        }
        t = 0f;
        while (t < 1f)
        {
            t += Time.deltaTime * 3f;
            float v = Mathf.Sin(Mathf.PI * (1 - t) / 2f);
            transform.localScale = Vector3.one * Mathf.Lerp(0f, 1.25f, v);
            yield return(null);
        }
        Destroy(this.gameObject);
    }
예제 #2
0
 protected void MoveOut()
 {
     Home.RemoveResident(this);
 }