コード例 #1
0
ファイル: MainMission_4.cs プロジェクト: BXZR/StudentFinal
    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");
    }
コード例 #2
0
ファイル: TalkCanvas.cs プロジェクト: BXZR/StudentFinal
    /// <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);
    }
コード例 #3
0
ファイル: TalkCanvas.cs プロジェクト: BXZR/StudentFinal
    /// <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;
    }
コード例 #4
0
    /// <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;
    }
コード例 #5
0
    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);
    }
コード例 #6
0
    //最开始的设定
    //设定完成之后自动销毁
    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);
    }
コード例 #7
0
    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);
        }
    }
コード例 #8
0
    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);
    }
コード例 #9
0
ファイル: TalkCanvas.cs プロジェクト: BXZR/StudentFinal
    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);
        }
    }
コード例 #10
0
    /// <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);
        }
    }
コード例 #11
0
ファイル: monsterBoss.cs プロジェクト: BXZR/StudentFinal
 private void MakeBossWall()
 {
     theBossWall = GameObject.Instantiate(SystemValues.LoadResources <GameObject>("Boss/BossWall"));
     theBossWall.transform.position = this.transform.position;
 }