Exemplo n.º 1
0
    private void Update()
    {
        if (isMoving)
        {
            moveLerp           = 1f - (targetObject.GetPos() - (zone.GetAreaUpperLimit() + moveEndpointOffset)) / targetStartGoalDist;
            transform.position = Vector3.Lerp(moveStart, moveEnd, moveLerp);
            lr.SetPositions(new Vector3[] { transform.position, targetObject.transform.position });
            textureScroll += Vector2.right * textureScrollSpeed * Time.deltaTime;
            lr.material.SetTextureOffset("_MainTex", textureScroll);

            if (moveLerp >= 1f)
            {
                isMoving = false;
                op.ReturnItem(gameObject);
            }
        }
    }
Exemplo n.º 2
0
    public void Play(Vector3 start, TargetObject target)
    {
        if (!isInitilaized)
        {
            Initialize();
        }

        for (int i = 0; i < gm.zones.Length; i++)
        {
            if (gm.zones[i].id == target.id)
            {
                zone = gm.zones[i];
                targetStartGoalDist = target.GetPos() - (zone.GetAreaUpperLimit() + moveEndpointOffset);
            }
        }

        targetObject = target;
        isMoving     = true;
        moveStart    = start;
        moveEnd      = (zone.GetAreaUpperLimit() + moveEndpointOffset) * tm.spawnDistance * target.transform.position.normalized;
    }