コード例 #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();
        }
    }
コード例 #3
0
ファイル: ObjectController.cs プロジェクト: etxasu/swv_source
    // Colorize the objects on the screen.
    public void Colorize()
    {
        if (!ColorToggle)
        {
            for (int i = 0; i < gameObject.transform.childCount; i++)
            {
                GameObject MiddleChild = gameObject.transform.GetChild(i).gameObject;

                for (int j = 0; j < MiddleChild.transform.childCount; j++)
                {
                    OrbitalMovement Go = MiddleChild.transform.GetChild(j).gameObject.GetComponent <OrbitalMovement>();

                    Go.UpdateMaterial(ObjectMaterials[(int)Go.MyObjectType]);
                }
            }
        }
        else
        {
            for (int i = 0; i < gameObject.transform.childCount; i++)
            {
                GameObject MiddleChild = gameObject.transform.GetChild(i).gameObject;

                for (int j = 0; j < MiddleChild.transform.childCount; j++)
                {
                    OrbitalMovement Go = MiddleChild.transform.GetChild(j).gameObject.GetComponent <OrbitalMovement>();

                    Go.UpdateMaterial(ObjectMaterials[0]);
                }
            }
        }

        ColorToggle = !ColorToggle;
    }
コード例 #4
0
    public void AddComet()
    {
        GameObject newobj = Instantiate(comet, transform.position, Quaternion.identity);


        planets.Add(new Planets(index, newobj, 8, 8, 3e-07f, 200, star, "Name"));

        OrbitalMovement orb = newobj.GetComponent <OrbitalMovement>();

        orb.index  = index;
        orb.focus1 = star;

        orb.G = 2;//3e-07f;
        int m = 1;

        orb.M    = 0.05f;
        getIndex = index;
        orb.a    = 30 + (index * 100);
        orb.b    = 30 + (index * 100);
    }
コード例 #5
0
    public void AddPlanet()
    {
        GameObject newobj = Instantiate(planet, transform.position, Quaternion.identity);


        planets.Add(new Planets(index, newobj, 8, 8, 3e-07f, 200, star, "Name"));

        OrbitalMovement orb = newobj.GetComponent <OrbitalMovement>();

        orb.index  = index;
        orb.focus1 = star;

        orb.G = 2;//3e-07f;
        int m = 1;

        orb.M    = m * Mathf.Pow(5, -index);
        getIndex = index;
        orb.a    = 250 + (index * 150);
        orb.b    = 249 + (index * 150);
        index++;
    }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     _MyTestObjectOrbitInfo = MyTestObject.GetComponent <OrbitalMovement>();
 }