void Awake() { if (Get_instance()) { DestroyImmediate(this.gameObject); return; } managerinstance = this; }
public int HP = 3; // Hit point, variable utilisable sur un autre objet private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(gameObject); } }
void Awake () { if(_instance == null) { _instance = this; DontDestroyOnLoad(this); } else { if(this != _instance) { Destroy(this.gameObject); } } }
private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(this.gameObject); } data = gameObject.GetComponent <DataManager>(); unlocks = gameObject.GetComponent <UnlockManager>(); }
void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(this); } else { if (this != _instance) { Destroy(this.gameObject); } } }
private void button1_Click(object sender, EventArgs e) { model = new ZakazModel() { Service = serviceComboBox.Text, Material = materialComboBox.Text, DateOfIssue = date.Value, CirculationTerm = Int32.Parse(SrokTextBox.Text), Width = Int32.Parse(widthTextBox.Text), Height = Int32.Parse(HeightTextBox.Text), kol = Int32.Parse(KolTextBox.Text), Id_manager = ManagerSingleton.Instance().Id, Id_client = clientModel.Id, Id_material = zakazLogic.Materiales.FirstOrDefault(m => m.Material1.Equals(materialComboBox.Text)).Id, Id_service = zakazLogic.Services.FirstOrDefault(s => s.Service.Equals(serviceComboBox.Text)).Id, }; zakazLogic.Add(model); }
void Start() { MGR = new ManagerSingleton(); UI = new UISingleton(); List <Dictionary <string, object> > data = CSVReaderScript.Read("potion_table"); if (itemblock_parents) { for (var i = 0; i < data.Count; i++) { if (data[i]["Name"] != null) { input_temp = Instantiate(itemblock_prefeb, itemblock_parents.transform); input_temp.transform.GetChild(1).GetComponent <Text>().text = data[i]["Name"].ToString() + "\n 가치 :" + data[i]["Value"].ToString(); input_temp.transform.GetChild(2).GetComponent <Text>().text = "종류: " + data[i]["Kind"].ToString() + "\n" + "회복량: " + data[i]["Increase"].ToString(); if (data[i]["Kind"].ToString() == "HP") { input_temp.transform.GetChild(0).GetComponent <Image>().sprite = HPIMAGE; kind = 3; value = int.Parse(data[i]["Value"].ToString()); increase = float.Parse(data[i]["Increase"].ToString()); desc = data[i]["Description"].ToString(); Item temp = new Item(HPIMAGE, true, kind, "HP포션", value, increase, 0, 0, 1, desc); ItemList.Add(temp); } else if (data[i]["Kind"].ToString() == "MP") { input_temp.transform.GetChild(0).GetComponent <Image>().sprite = MPIMAGE; kind = 4; value = int.Parse(data[i]["Value"].ToString()); increase = float.Parse(data[i]["Increase"].ToString()); desc = data[i]["Description"].ToString(); Item temp = new Item(HPIMAGE, true, kind, "MP포션", value, increase, 0, 0, 1, desc); ItemList.Add(temp); } } } } }
public static ManagerSingleton instance = null; //Static instance of GameManager which allows it to be accessed by any other script. void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); }
private void Autoriz() { try { using (var db = new Model1()) { Manager manager = db.Manager.FirstOrDefault(IsCurrentUser); if (manager == null) { throw new Exception("NYET!!!>_<"); } ManagerSingleton.Instance(manager); this.Hide(); new Information().ShowDialog(); this.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// Start is called before the first frame update void Start() { MGR = new ManagerSingleton(); FC = new FollowCamera(); UI = new UISingleton(); bb = UI.Get_Instance().transform.GetChild(3).gameObject; ReturnOldScene d_s = new GameManagerScript().Get_OldScene; ReturnOldPosition d_p = new PlayerManagerScripts().Get_OldPosition; if (d_s() != null) { if (d_s() != null) { if (d_s() != SceneManager.GetActiveScene().ToString() || d_s() != null) { this.transform.position = d_p(); } } } Vector3 angles = this.transform.eulerAngles; Rotate = this.transform.forward.x; Anim = this.GetComponent <Animator>(); if (Target_Frame != null) { Target_Frame.SetActive(false); } MoveFlag = false; if (this.gameObject.transform.name == "Pirate") // 나중에 다른 캐릭터 추가되면 리소스로드로 Sprite 바꾸는거 추가... 19.08.15 { } }
// Use this for initialization void Start() { //// Singleton //if (Instance != this) Destroy(this); //mm = ManagerSingleton.Instance; mm = FindObjectOfType <ManagerSingleton>(); // Weapon type buttons currentType = WeaponTypes.斧鉞; chooseWeaponBtnPrefab = Resources.Load <Button>("Prefabs/ChooseWeaponButton"); chooseWeaponBtns = new List <Button>(); foreach (WeaponTypes item in Enum.GetValues(typeof(WeaponTypes))) { Button newBtn = Instantiate(chooseWeaponBtnPrefab, chooseWeaponPanel.transform); newBtn.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -50 - (int)item * 70); newBtn.GetComponentInChildren <Text>().text = item.ToString(); newBtn.onClick.AddListener(delegate { ChangeCurrentWeaponType(item); }); chooseWeaponBtns.Add(newBtn); } // Parameters initialization parametersSetup = new Dictionary <string, List <object> >() { { "showLineIsOn", new List <object>() { false, false, true, "顯示L-system" } }, { "circleSubdivision", new List <object>() { 50, 10, 100, "細緻度" } }, { "pommelSubdivision", new List <object>() { 50, 10, 100, "pommelSubdivision" } }, { "pommelOuterDiameter", new List <object>() { 1.5f, 0.0f, 3.0f, "pommelOuterDiameter" } }, { "pommelInnerDiameter", new List <object>() { 0.5f, 0.0f, 3.0f, "pommelInnerDiameter" } }, { "pommelLength", new List <object>() { 0.5f, 0.0f, 1.0f, "pommel長" } }, { "pommelWidth", new List <object>() { 0.3f, 0.0f, 0.5f, "pommel寬" } }, { "gripSubdivision", new List <object>() { 50, 10, 100, "gripSubdivision" } }, { "gripLength", new List <object>() { 1.2f, 0.0f, 2.0f, "柄長" } }, { "gripWidth", new List <object>() { 0.1f, 0.0f, 0.1f, "柄徑" } }, { "guardSubdivision", new List <object>() { 50, 10, 100, "guardSubdivision" } }, { "guardLength", new List <object>() { 0.1f, 0.0f, 0.3f, "護手長" } }, { "guardWidth", new List <object>() { 0.3f, 0.0f, 0.5f, "護手寬" } }, { "bladeSubdivision", new List <object>() { 50, 10, 100, "bladeSubdivision" } }, { "bladeLengthGrow", new List <object>() { 0.2f, 0.0f, 0.5f, "刃長" } }, { "bladeLengthGrowFactor", new List <object>() { 0.0f, 0.0f, 2.0f, "刃長係數A" } }, { "bladeWidth", new List <object>() { 0.2f, 0.0f, 0.3f, "刃寬" } }, { "bladeWidthFactorA", new List <object>() { 0.0f, 0.0f, 0.02f, "刃寬係數A" } }, { "bladeWidthFactorB", new List <object>() { 1.0f, 0.0f, 1.0f, "刃寬係數B" } }, { "bladeThick", new List <object>() { 0.0f, 0.0f, 0.1f, "刃厚" } }, { "bladeWaveFreq", new List <object>() { 0.0f, 0.0f, 5.0f, "刀刃蛇形頻率" } }, { "bladeWaveAmp", new List <object>() { 0.0f, 0.0f, 5.0f, "刀刃蛇形振幅" } }, { "bladeCurv", new List <object>() { 2.5f, -3.0f, 3.0f, "刃彎" } }, { "edgeRatio", new List <object>() { 0.15f, 0.0f, 1.0f, "刃鋒比例" } }, { "maxIter", new List <object>() { 47, 10, 80, "迭代次數" } }, { "spearGripWidth", new List <object>() { 0.6f, 0.0f, 3.0f, "spearGripWidth" } }, { "spearGripLength", new List <object>() { 5.0f, 0.0f, 10.0f, "spearGripLength" } }, { "crescentL", new List <object>() { 0.75f, 0.0f, 1.5f, "特殊刃長" } }, { "crescentW", new List <object>() { 0.3f, 0.0f, 1.0f, "特殊刃寬" } }, { "crescentD", new List <object>() { 0.6f, 0.0f, 0.999f, "特殊刃凹" } }, { "crescentT", new List <object>() { 0.3f, 0.0f, 1.0f, "特殊刃厚" } } }; // slider setup parameterNamePrefab = Resources.Load <Text>("Prefabs/Text"); parameterSliderPrefab = Resources.Load <Slider>("Prefabs/ParameterSlider"); parameters = new Dictionary <string, Selectable>(); for (int i = 0; i < parametersSetup.Count; i++) { KeyValuePair <string, List <object> > pair = parametersSetup.ElementAt(i); Type pType = pair.Value[0].GetType(); Slider newSlider = Instantiate(parameterSliderPrefab, parameterPanel.transform); newSlider.name = pair.Key; if (pType == typeof(float)) { newSlider.maxValue = (float)(pair.Value[2]); newSlider.minValue = (float)pair.Value[1]; newSlider.value = (float)pair.Value[0]; } else if (pType == typeof(int)) { newSlider.maxValue = (int)(pair.Value[2]); newSlider.minValue = (int)pair.Value[1]; newSlider.value = (int)pair.Value[0]; newSlider.wholeNumbers = true; } newSlider.onValueChanged.AddListener(delegate { mm.MakeWeapon(); }); newSlider.gameObject.SetActive(false); Text newText = Instantiate(parameterNamePrefab, newSlider.transform); newText.GetComponent <RectTransform>().anchoredPosition = new Vector2(-170, 0); newText.text = (string)pair.Value[3]; newText.alignment = TextAnchor.MiddleLeft; parameters.Add(pair.Key, newSlider); } // Show line showLine.onValueChanged.AddListener(delegate { ShowLSystemLine(showLine); }); edgeCurve = AnimationCurve.EaseInOut(0.0f, 1.0f, 1.0f, 0.0f); }
// Start is called before the first frame update void Start() { MGR = new ManagerSingleton(); }
int count = 6; // 가방에 남은 공간 void Start() { MGR = new ManagerSingleton(); GoldSet(); temp = Block[0].GetComponent <Image>().sprite; }