// Use this for initialization void Start() { //инициализация nMain = GameObject.FindObjectOfType(typeof(main)) as main; nB_GUI = GameObject.FindObjectOfType(typeof(ButtonGUI)) as ButtonGUI; nSObj = GameObject.FindObjectOfType(typeof(Static_obj)) as Static_obj; }
// Use this for initialization void Start() { //инициализация nB_GUI = GameObject.FindObjectOfType(typeof(ButtonGUI)) as ButtonGUI; nCam = GameObject.FindObjectOfType(typeof(cam)) as cam; nMain = GameObject.FindObjectOfType(typeof(main)) as main; }
// Use this for initialization void Start() { //инициализация nMain = GameObject.FindObjectOfType(typeof(main)) as main; nB_GUI = GameObject.FindObjectOfType(typeof(ButtonGUI)) as ButtonGUI; nSPH = GameObject.FindObjectOfType(typeof(SPH)) as SPH; }
private void MakeSkill(Texture2D sprite, string description, Vector2 pos, Skill skill) { GameObject go = new GameObject(); SpriteRenderer sr = new SpriteRenderer(sprite); sr.LayerDepth = 0.05f; ButtonGUI btn = new ButtonGUI(sr, sprite, sprite, Color.White, Color.Green); go.AddComponent <SpriteRenderer>(sr); go.AddComponent <ButtonGUI>(btn); go.Transform.Position = pos; myScene.Instantiate(go); TextGUI text = SkillRank(pos + new Vector2(0, 50), skill); btn.OnClick = () => { skill.Level += 1; text.Text = skill.Level.ToString(); }; }
public void SaveHeroButton() { GameObject go = new GameObject(); SpriteRenderer sr = new SpriteRenderer("Pixel"); ButtonGUI btn = new ButtonGUI(sr); go.Transform.Scale = new Vector2(240, 50); go.Transform.Position = new Vector2(GraphicsSetting.Instance.ScreenSize.X / 4, GraphicsSetting.Instance.ScreenSize.Y - 50); sr.LayerDepth = 0.05f; sr.OriginPositionEnum = OriginPositionEnum.Mid; btn.Color = Color.BlueViolet; btn.Text = "Save Hero"; btn.OnClick = () => { UserData.Instance.currentHero.SaveHero(); }; go.AddComponent <SpriteRenderer>(sr); go.AddComponent <ButtonGUI>(btn); myScene.Instantiate(go); }
public ButtonGUI MakeStatsButton(int Xpos, int Ypos, string name, int statsNumber) { MakeText(Xpos - 100, Ypos, name); TextGUI text = MakeShowStats(Xpos, Ypos, statsNumber.ToString()); GameObject go = new GameObject(); SpriteRenderer sr = new SpriteRenderer("Pixel"); ButtonGUI btn = new ButtonGUI(sr); go.Transform.Scale = new Vector2(30, 30); go.Transform.Position = new Vector2(Xpos + 120, Ypos * 50 + 20); sr.LayerDepth = 0.01f; btn.Color = Color.Red; btn.Text = "+"; btn.OnClick = () => { text.Text = (statsNumber += 1).ToString(); }; go.AddComponent <SpriteRenderer>(sr); go.AddComponent <ButtonGUI>(btn); myScene.Instantiate(go); return(btn); }
// Use this for initialization void Start() { //инициализация nB_GUI = GameObject.FindObjectOfType(typeof(ButtonGUI)) as ButtonGUI; }