private void CreateBoss() { GameObject boss = GameObject.Instantiate(SystemValues.LoadResources <GameObject>("Boss/Boss1")); boss.transform.position = SystemValues.thePlayer.transform.position + SystemValues.thePlayer.transform.forward.normalized * 5f; boss.GetComponent <monsterBoss> ().StartBoss(); //Debug.Log("create boss"); }
/// <summary> /// 开启选项进行选择. /// </summary> /// <param name="use">Use.</param> private void makeSelect(DialogFrame use) { theInformationText.text = "怎么选择呢?"; theNameText.text = ""; use.picture = "noOne"; Texture2D theTextureIn = SystemValues.LoadResources <Texture2D> ("TalkPicture/" + use.picture); UIController.GetInstance().ShowUI <UITalkSelect> (use.information); }
/// <summary> /// 正常的对话. /// </summary> /// <param name="use">Use.</param> private void makeTalk(DialogFrame use) { theNameText.text = use.name; theInformationText.text = use.information; use.picture = !string.IsNullOrEmpty(use.picture) ? use.picture : "noOne"; Texture2D theTextureIn = SystemValues.LoadResources <Texture2D> ("TalkPicture/" + use.picture); //Resources.Load <Texture2D> ("TalkPicture/" + use.picture); Sprite theSprite = Sprite.Create(theTextureIn, new Rect(0, 0, theTextureIn.width, theTextureIn.height), new Vector2(0, 0)); theTalkHeadPicture.sprite = theSprite; }
/// <summary> ///额外方法,创建头顶血条 /// </summary> public virtual void MakeHpSlider() { GameObject theSlider = GameObject.Instantiate(SystemValues.LoadResources <GameObject>("UI/PlayerBloodCanvas")); theSlider.transform.position = this.transform.position + new Vector3(0f, 1.5f, 0f); theSlider.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); theSlider.transform.SetParent(this.transform); PlayerBloodCanvas theShowCanvas = theSlider.GetComponent <PlayerBloodCanvas> (); theShowCanvas.MakeFkash(this); this.theBloodSlider = theShowCanvas; }
public static BloodChangeTextCanvas GetText() { bloodtexts.RemoveAll(X => X == null); if (bloodtexts.Count > 0) { BloodChangeTextCanvas aTextCanvas = bloodtexts [0]; bloodtexts.Remove(aTextCanvas); return(aTextCanvas); } BloodChangeTextCanvas newOne = Instantiate(SystemValues.LoadResources <GameObject>("UI/BloodChangeTextCanvas")).GetComponent <BloodChangeTextCanvas>(); return(newOne); }
//最开始的设定 //设定完成之后自动销毁 void Start() { GameObject playerData = SystemValues.LoadResources <GameObject>("Player/ThePlayer"); thePlayer = (GameObject)GameObject.Instantiate(playerData); SystemValues.thePlayer = thePlayer; if (SystemValues.theSaveData == null) { thePlayer.transform.position = theStartPosition.position; } Invoke("makeStart", 0.05f); }
public void CloseUI <T> () where T : UIBasic { string UIName = typeof(T).ToString(); GameObject theUI; if (!UIBook.TryGetValue(UIName, out theUI)) { theUI = SystemValues.LoadResources <GameObject>("UI/" + UIName); theUI = Instantiate(theUI); theUI.name = UIName; UIBook.Add(UIName, theUI); } if (theUI) { theUI.GetComponent <T> ().OnEndShow(); theUI.SetActive(false); } }
public T GetUI <T>() where T : UIBasic { string UIName = typeof(T).ToString(); GameObject theUI; if (!UIBook.TryGetValue(UIName, out theUI)) { theUI = SystemValues.LoadResources <GameObject>("UI/" + UIName); theUI = Instantiate(theUI); theUI.name = UIName; UIBook.Add(UIName, theUI); } if (theUI) { return(theUI.GetComponent <T>()); } return(null); }
private void LoadTexts(string value) { //print ("value =" +value); theFrames = new Queue <DialogFrame> (); TextAsset textAsset = SystemValues.LoadResources <TextAsset>("XML/" + value); xml.LoadXml(textAsset.text); theXmlList = xml.SelectNodes("Root/Dialog"); foreach (XmlNode node in theXmlList) { DialogFrame aFrame = new DialogFrame(); //print (node.SelectSingleNode("Name").InnerText); //print (node.SelectSingleNode("Picture").InnerText); //print (node.SelectSingleNode("Information").InnerText); aFrame.name = node.SelectSingleNode("Name").InnerText; aFrame.picture = node.SelectSingleNode("Picture").InnerText; aFrame.information = node.SelectSingleNode("Information").InnerText; theFrames.Enqueue(aFrame); } }
/// <summary> /// 第一次生成UI,之后开/关UI /// </summary> public void ChangeUIState <T> ( ) where T : UIBasic { string UIName = typeof(T).ToString(); GameObject theUI; if (!UIBook.TryGetValue(UIName, out theUI)) { theUI = SystemValues.LoadResources <GameObject>("UI/" + UIName); theUI = Instantiate(theUI); theUI.name = UIName; UIBook.Add(UIName, theUI); if (theUI) { theUI.SetActive(false); } } if (theUI) { theUI.SetActive(!theUI.gameObject.activeInHierarchy); } }
private void MakeBossWall() { theBossWall = GameObject.Instantiate(SystemValues.LoadResources <GameObject>("Boss/BossWall")); theBossWall.transform.position = this.transform.position; }