コード例 #1
0
    public static void UpdateByFrame(string id)
    {
        var       ttl       = ReduceTTL(id);
        Target    target    = MultiplayerStatic.GetTargetById(id);
        Transform transform = MultiplayerStatic.GetTransformById(id);

        if (ttl == 0)
        {
            RemovePlayer(id, transform);
        }
        if (target == null || transform == null)
        {
            return;
        }
        MultiplayerStatic.Animate(transform, target);
        MultiplayerStatic.UpdateTextPosition(transform);
        var   updatedPosition = Vector3.SmoothDamp(transform.position, target.position, ref target.velocity, smoothTime);
        float updatedYAngle   = Mathf.SmoothDampAngle(transform.eulerAngles.y, target.yAngle, ref target.angularVelocity, smoothTime);

        transform.rotation = Quaternion.Euler(0, updatedYAngle, 0);
        transform.position = updatedPosition;
    }