예제 #1
0
    protected Vector3 GetPoint(PlacementSpace space, Vector3 input)
    {
        switch (space)
        {
        case PlacementSpace.World:
        {
            Vector3?nullable = CameraFX.World2Screen(input);
            input = Target.camera.ScreenToWorldPoint(!nullable.HasValue ? Vector3.zero : nullable.Value);
            return(input);
        }

        case PlacementSpace.Screen:
            input = Target.camera.ScreenToWorldPoint(input);
            return(input);

        case PlacementSpace.Viewport:
            input = Target.camera.ViewportToWorldPoint(input);
            return(input);

        case PlacementSpace.Anchor:
            input = this.anchor.transform.TransformPoint(input);
            return(input);
        }
        return(input);
    }
예제 #2
0
    protected static HUDIndicator InstantiateIndicator(ScratchTarget target, HUDIndicator prefab, PlacementSpace space, Vector3 position, float rotation)
    {
        ScratchTarget target2 = target;

        if (target2 == ScratchTarget.CenteredAuto)
        {
            return(InstantiateIndicator(ref CenterAuto, prefab, space, position, rotation));
        }
        if (target2 != ScratchTarget.CenteredFixed3000Tall)
        {
            throw new ArgumentOutOfRangeException("target");
        }
        return(InstantiateIndicator(ref CenterFixed3000Tall, prefab, space, position, rotation));
    }
예제 #3
0
    private static HUDIndicator InstantiateIndicator(ref Target target, HUDIndicator prefab, PlacementSpace space, Vector3 position, float rotation)
    {
        UIAnchor   anchor     = target.anchor;
        Quaternion quaternion = Quaternion.AngleAxis(rotation, Vector3.back);

        switch (space)
        {
        case PlacementSpace.World:
        {
            Vector3?nullable = CameraFX.World2Screen(position);
            position = Target.camera.ScreenToWorldPoint(!nullable.HasValue ? Vector3.zero : nullable.Value);
            break;
        }

        case PlacementSpace.Screen:
            position = Target.camera.ScreenToWorldPoint(position);
            break;

        case PlacementSpace.Viewport:
            position = Target.camera.ViewportToWorldPoint(position);
            break;

        case PlacementSpace.Anchor:
            position   = anchor.transform.TransformPoint(position);
            quaternion = anchor.transform.rotation * quaternion;
            break;
        }
        position.z = anchor.transform.position.z;
        HUDIndicator indicator = (HUDIndicator)Object.Instantiate(prefab, position, quaternion);

        indicator.transform.parent     = anchor.transform;
        indicator.transform.localScale = Vector3.one;
        indicator.anchor = target.anchor;
        return(indicator);
    }
예제 #4
0
 protected static HUDIndicator InstantiateIndicator(ScratchTarget target, HUDIndicator prefab, PlacementSpace space, Vector3 position)
 {
     return(InstantiateIndicator(target, prefab, space, position, 0f));
 }