Beispiel #1
0
    public RealRotationMarker CreateRotationMarker(Transform targetMarker)
    {
        Vector3            position  = targetMarker.position;
        RealRotationMarker newMarker = (GameObject.Instantiate(rotationMarkerPrefab) as GameObject).GetComponent <RealRotationMarker>();

        rotationMarkerMapping[newMarker] = targetMarker;
        var markerTransform = newMarker.GetComponent <RectTransform>();

        markerTransform.SetParent(this.transform);
        markerTransform.localRotation = Quaternion.identity;
        markerTransform.localScale    = Vector3.one;
        markerTransform.localPosition = Vector3.zero;

        var     translatedPoint = shipGameplayCamera.WorldToScreenPoint(position);
        Vector2 uiPosition      = new Vector2(translatedPoint.x / canvas.scaleFactor,
                                              translatedPoint.y / canvas.scaleFactor);

        markerTransform.anchoredPosition = uiPosition;
        return(newMarker);
    }
Beispiel #2
0
 void Start()
 {
     rotationMarker = RotationMarkerManager.Instance.CreateRotationMarker(transform);
 }
Beispiel #3
0
 void Start()
 {
     rotationMarker = RotationMarkerManager.Instance.CreateRotationMarker(transform);
 }