コード例 #1
0
    public void RepositionENVObjects()
    {
        if (_icons.Count != 0)
        {
            DragSurfaceRect = DragSurface.GetComponent <RectTransform>().rect;

            foreach (GameObject _GO in _icons)
            {
                //Debug.Log(Input.mousePosition);

                Vector3 PointerPosition = MinimapCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, MinimapCamera.transform.position.y));

                //Debug.Log(PointerPosition);

                PointerPosition.y = 0.0f;

                ENVTestObjectPrefab.transform.position = PointerPosition;

                OrbitalMovement OrbitalData = ENVTestObjectPrefab.GetComponent <OrbitalMovement>();
                OrbitalData.GetWorldSpeed();
                OrbitalData.InstantiateOrbitalPeriod();
                OrbitalData.UpdateCapi();

                if (AutoFlashZone)
                {
                    SortZoneBoundaries();
                }
            }
            CleanUpIcons();
            _icons.Clear();
        }
    }
コード例 #2
0
    public void RepositionENVObjects()
    {
        if (_icons.Count != 0)
        {
            float frustumHalfLength = (float)((Mathf.Tan(MinimapCamera.fieldOfView / 2) * MinimapCamera.transform.position.y) / -11.41);
            //Debug.Log(frustumHalfLength);
            DragSurfaceRect = DragSurface.GetComponent <RectTransform>().rect;

            foreach (GameObject _GO in _icons)
            {
                Vector3 RealPos = new Vector3((_GO.GetComponent <RectTransform>().localPosition.x / (DragSurfaceRect.width / 2)) * frustumHalfLength, 0.0f, (_GO.GetComponent <RectTransform>().localPosition.y / (DragSurfaceRect.height / 2)) * frustumHalfLength);
                //Debug.Log(RealPos.ToString());
                ENVTestObjectPrefab.transform.position = RealPos;
                OrbitalMovement OrbitalData = ENVTestObjectPrefab.GetComponent <OrbitalMovement>();
                OrbitalData.GetWorldSpeed();
                OrbitalData.InstantiateOrbitalPeriod();
                //ENVTestObjectPrefab.GetComponent<OrbitalMovement>().rotationSpeed = 20.0f / (5.57f * ENVTestObjectPrefab.GetComponent<OrbitalMovement>().radius);
                //Debug.Log(ENVTestObjectPrefab.GetComponent<OrbitalMovement>().rotationSpeed);
                OrbitalData.UpdateCapi();

                if (AutoFlashZone)
                {
                    SortZoneBoundaries();
                }
            }
            CleanUpIcons();
            _icons.Clear();
        }
    }