Exemple #1
0
    public void PickupGuest()
    {
        Debug.Log("PickupTarget");
        CurrentTarget.ToggleKinematic(true);

        carrier = new GameObject("carrier");
        carrier.transform.parent   = transform;
        carrier.transform.position = CurrentTarget.transform.position;

        CurrentTarget.transform.parent = carrier.transform;

        Vector3[] tempPath = new Vector3[pickupPath.path.Length + 1];
        tempPath[0] = carrier.transform.localPosition;
        for (int i = 1; i < tempPath.Length; i++)
        {
            tempPath[i] = pickupPath.path[i - 1];
        }

        System.Action next = this.FinishPickup;

        iTween.RotateTo(CurrentTarget.transform.gameObject, iTween.Hash("islocal", true, "rotation", new Vector3(0f, 0f, 90f), "time", pickupAnimationTime));

        iTween.MoveTo(carrier, iTween.Hash("movetopath", false, "path", tempPath,
                                           "position", gameObject.transform.position + Vector3.up * 5f,
                                           "time", pickupAnimationTime, "easetype", iTween.EaseType.easeInExpo,
                                           "oncomplete", next.Method.Name, "islocal", true,
                                           "oncompletetarget", this.gameObject));
    }