Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (gameObject.GetComponent <HP>().Health <= 0)
     {
         if (gameObject.GetComponent <CellObject>().moveAble == true)
         {
             Messagebox.MessageBox(IntPtr.Zero, "你被干掉了!", "嘻嘻", 0);
             Destroy(gameObject);
             SceneManager.LoadScene("Over");
         }
         else
         {
             Messagebox.MessageBox(IntPtr.Zero, "恭喜胜利!", "嘻嘻", 0);
             Destroy(gameObject);
         }
     }
 }
Ejemplo n.º 2
0
    public void OnPointerClick(PointerEventData eventData)
    {
        if (eventData.pointerPress.name == "Button_AddPicPath")
        {
            GameObject   path         = GameObject.Find("Input_StdActionPath");
            OpenFileName openFileName = new OpenFileName();

            openFileName.structSize = Marshal.SizeOf(openFileName);
            //openFileName.filter = "文件(*." + type + ")\0*." + type + "";
            openFileName.filter       = "文件(*.png;*.jpg)\0*.png;*.jpg";
            openFileName.file         = new string(new char[256]);
            openFileName.maxFile      = openFileName.file.Length;
            openFileName.fileTitle    = new string(new char[64]);
            openFileName.maxFileTitle = openFileName.fileTitle.Length;
            openFileName.initialDir   = Application.streamingAssetsPath.Replace('/', '\\');//默认路径
            openFileName.title        = "选择文件";
            openFileName.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;

            if (FileLocalDialog.GetSaveFileName(openFileName))//点击系统对话框框保存按钮
            {
                //TODO
                //Debug.Log(openFileName.file);
                path.GetComponent <InputField>().text = openFileName.file;
                Debug.Log("动作路径: " + actionPicPath.text.ToString());
                //Debug.Log(openFileName.fileTitle);
            }
        }
        if (eventData.pointerPress.name == "Button_Add")
        {
            Debug.Log("动作名: " + actionNameInput.text.ToString());
            Debug.Log("动作图片路径" + actionPicPath.text.ToString());
            StandardActionLibrary stdlibrary = new StandardActionLibrary();
            stdlibrary.addStandardAction(patient_id, actionNameInput.text.ToString(), actionPicPath.text.ToString());

            Messagebox.MessageBox(IntPtr.Zero, "添加标准动作成功!", "成功", 0);
        }
    }
    public void AtCollision(CellObject cellObject)
    {
        if (cellObject.gameObject.tag == "Surprise")
        {
            Messagebox.MessageBox(IntPtr.Zero, "走着走着,你感觉到有什么肮脏的东西正盯着你", "随机事件", 0);
            Messagebox.MessageBox(IntPtr.Zero, "古神的诅咒:生命值-50", "随机事件", 0);
            gameObject.GetComponent <HP>().Health -= 50;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
            Destroy(cellObject.gameObject);
        }

        if (cellObject.gameObject.tag == "Surprise3")
        {
            Messagebox.MessageBox(IntPtr.Zero, "你看见一个衣衫褴褛的老头向你走来,手里拿着一本圣经", "随机事件", 0);
            Messagebox.MessageBox(IntPtr.Zero, "友善的牧师:生命值+60", "随机事件", 0);
            gameObject.GetComponent <HP>().Health += 60;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
            Destroy(cellObject.gameObject);
        }

        if (cellObject.gameObject.tag == "Surprise1")
        {
            Messagebox.MessageBox(IntPtr.Zero, "你路过了一个传说中的祭坛,要献血开门吗?", "随机事件", 1);
            Messagebox.MessageBox(IntPtr.Zero, "血神祭坛:生命值-20 攻击力+30", "随机事件", 0);
            gameObject.GetComponent <HP>().Health -= 20;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
            gameObject.GetComponent <ATK>().Attack += 30;
            AttackNum.text = gameObject.GetComponent <ATK>().Attack.ToString();
            Destroy(cellObject.gameObject);
        }

        if (cellObject.gameObject.tag == "Surprise2")
        {
            Messagebox.MessageBox(IntPtr.Zero, "一把宝剑插在不明生物的排泄物里,你要拔出它吗?", "随机事件", 1);
            Messagebox.MessageBox(IntPtr.Zero, "屎中剑:攻击力+20", "随机事件", 1);
            gameObject.GetComponent <ATK>().Attack += 20;
            AttackNum.text = gameObject.GetComponent <ATK>().Attack.ToString();
            Destroy(cellObject.gameObject);
        }

        if (cellObject.gameObject.tag == "Chest")
        {
            Messagebox.MessageBox(IntPtr.Zero, "恭喜你获得 渴望盾+2", "不知名的宝箱", 0);
            gameObject.GetComponent <DFC>().Defence += 25;
            DefenceNum.text = gameObject.GetComponent <DFC>().Defence.ToString();

            Destroy(cellObject.gameObject);
        }

        if (cellObject.gameObject.tag == "Shop")
        {
            Messagebox.MessageBox(IntPtr.Zero, "变形药水$100 (会涨价哦)", "欢迎来到商店!", 0);
            if (gameObject.GetComponent <MOY>().Money >= 100)
            {
                Messagebox.MessageBox(IntPtr.Zero, "欢迎下次光临!", "商店老板", 0);
                gameObject.GetComponent <MOY>().Money -= 100;
                MoneyNum.text = gameObject.GetComponent <MOY>().Money.ToString();
                gameObject.GetComponent <BTT>().Bottle += 1;
                BottleNum.text = gameObject.GetComponent <BTT>().Bottle.ToString();
            }
            else
            {
                Messagebox.MessageBox(IntPtr.Zero, "没钱快滚!", "商店老板", 0);
            }
        }

        if (cellObject.gameObject.tag == "Drink")
        {
            Messagebox.MessageBox(IntPtr.Zero, "恭喜你获得 生命值+50", "生命药水", 0);
            gameObject.GetComponent <HP>().Health += 50;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
            Destroy(cellObject.gameObject);
        }

        if (cellObject.gameObject.tag == "ShellEnemy")
        {
            int ak  = gameObject.GetComponent <ATK>().Attack;
            int akk = cellObject.GetComponent <ATK>().Attack;
            gameObject.GetComponent <HP>().Health -= akk;
            cellObject.GetComponent <HP>().Health -= ak;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
        }

        if (cellObject.gameObject.tag == "SwordEnemy")
        {
            int ak  = gameObject.GetComponent <ATK>().Attack;
            int akk = cellObject.GetComponent <ATK>().Attack;
            gameObject.GetComponent <HP>().Health -= akk;
            cellObject.GetComponent <HP>().Health -= ak;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
        }

        if (cellObject.gameObject.tag == "KnightEnemy")
        {
            int ak  = gameObject.GetComponent <ATK>().Attack;
            int akk = cellObject.GetComponent <ATK>().Attack;
            gameObject.GetComponent <HP>().Health -= akk;
            cellObject.GetComponent <HP>().Health -= ak;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
        }

        if (cellObject.gameObject.tag == "GongEnemy")
        {
            int ak  = gameObject.GetComponent <ATK>().Attack;
            int akk = cellObject.GetComponent <ATK>().Attack;
            gameObject.GetComponent <HP>().Health -= akk;
            cellObject.GetComponent <HP>().Health -= ak;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
        }

        if (cellObject.gameObject.tag == "Devil")
        {
            int ak  = gameObject.GetComponent <ATK>().Attack;
            int akk = cellObject.GetComponent <ATK>().Attack;
            gameObject.GetComponent <HP>().Health -= akk;
            cellObject.GetComponent <HP>().Health -= ak;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
        }

        if (cellObject.gameObject.tag == "ArrowEnemy")
        {
            int ak  = gameObject.GetComponent <ATK>().Attack;
            int akk = cellObject.GetComponent <ATK>().Attack;
            gameObject.GetComponent <HP>().Health -= akk;
            cellObject.GetComponent <HP>().Health -= ak;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
        }

        if (cellObject.gameObject.tag == "Octupus")
        {
            int ak  = gameObject.GetComponent <ATK>().Attack;
            int akk = cellObject.GetComponent <ATK>().Attack;
            gameObject.GetComponent <HP>().Health -= akk;
            cellObject.GetComponent <HP>().Health -= ak;
            HealthNum.text = gameObject.GetComponent <HP>().Health.ToString();
        }

        if (cellObject.gameObject.tag == "Flag")
        {
            WinGame();
            Destroy(cellObject.gameObject);
        }
    }