예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        ListAstre ListeAstreDontDestroyOnLoad = GameObject.Find("DontDestroyOnLoad").GetComponent <ListAstre>();

        ListeAstreDontDestroyOnLoad.RemoveAstre(other.gameObject);

        // if (other.transform.parent)
        //     Destroy(other.transform.parent.gameObject);
        // else
        //     Destroy(other.gameObject);
    }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        if (!_errorText)
        {
            throw new Exception("You must define an error message text !");
        }

        _errorText.enabled = false;

        _IsOrbit = true;
        if (!ListeAstreDontDestroyOnLoad)
        {
            ListeAstreDontDestroyOnLoad = GameObject.Find("DontDestroyOnLoad").GetComponent <ListAstre>();
        }
        for (int i = 0; i < transform.childCount; i++)
        {
            if (transform.GetChild(i).name == "PanelPlanetSetting")
            {
                _PanelPlanetSetting = transform.GetChild(i);
            }
            if (transform.GetChild(i).name == "PanelListAstreInSolarSystem")
            {
                _PanelListAstreInSolarSystem = transform.GetChild(i);
            }
        }
        for (int i = 0; i < _PanelPlanetSetting.childCount; i++)
        {
            if (_PanelPlanetSetting.GetChild(i).name == "Name")
            {
                _NameInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "Resolution")
            {
                _ResolutionInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "Radius")
            {
                _RadiusInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "Impulsion")
            {
                _ImpulsionInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "Distance")
            {
                _DistInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "AddAstre")
            {
                _AddAstre = _PanelPlanetSetting.GetChild(i).GetComponent <Button>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "ShapeSetting")
            {
                _ShapeSettingDropDown = _PanelPlanetSetting.GetChild(i).GetComponent <Dropdown>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "ColourSetting")
            {
                _ColorSettingDropDown = _PanelPlanetSetting.GetChild(i).GetComponent <Dropdown>();
            }
        }

        for (int i = 0; i < _PanelListAstreInSolarSystem.childCount; i++)
        {
            if (_PanelListAstreInSolarSystem.GetChild(i).name == "ListeOfAstres")
            {
                _ListeOfAstreText = _PanelListAstreInSolarSystem.GetChild(i).GetComponent <Text>();
            }
        }

        _NameInputField.onEndEdit.AddListener(delegate { setName(); });
        _ResolutionInputField.onEndEdit.AddListener(delegate { setResolution(); });
        _RadiusInputField.onEndEdit.AddListener(delegate { setRadius(); });
        _ImpulsionInputField.onEndEdit.AddListener(delegate { setImpulsion(); });
        _DistInputField.onEndEdit.AddListener(delegate { setDistance(); });
        _AddAstre.onClick.AddListener(delegate { AddAstre(); });

        List <string> namesshapes = new List <string>();

        namesshapes.Add("EarthShape");
        namesshapes.Add("MarsShape");
        namesshapes.Add("VenusShape");
        _ShapeSettingDropDown.options.Clear();
        _ShapeSettingDropDown.AddOptions(namesshapes);
        _ShapeSetting = Resources.Load("Script/Shapes/" + _ShapeSettingDropDown.options[_ShapeSettingDropDown.value].text, typeof(ShapeSettings)) as ShapeSettings;
        _ShapeSettingDropDown.onValueChanged.AddListener(delegate { setShape(); });

        List <string> namescolors = new List <string>();

        namescolors.Add("EarthColor");
        namescolors.Add("MarsColor");
        namescolors.Add("VenusColor");
        _ColorSettingDropDown.options.Clear();
        _ColorSettingDropDown.AddOptions(namescolors);
        _ColorSetting = Resources.Load("Script/Colors/" + _ColorSettingDropDown.options[_ColorSettingDropDown.value].text, typeof(ColourSettings)) as ColourSettings;
        _ColorSettingDropDown.onValueChanged.AddListener(delegate { setColor(); });
    }