示例#1
0
    IEnumerator DeadYou()
    {
        if (instance.test == SM.S)
        {
            deadselect = true;
            if (BattleMain3.GetYou() != null)
            {
                if (BattleMain3.GetYou().Name != "")
                {
                    BattleMain3.Player1().moninv.RemoveMonster(BattleMain3.GetYou());
                }
            }
            BattleMain3.SetYou(new Monster.SubMonster());
            SaveLoad.Save(SaveCallBack);
            while (true)
            {
                cont = false;
                UpMenu.SetMenu(UpMenu.curMenu.mon);
                if (BattleMain3.GetYou().Name != "")
                {
                    break;
                }
                yield return(new WaitForEndOfFrame());
            }

            UpMenu.SetMenu(UpMenu.curMenu.none);
            cont = true;
            yield return(new WaitForSeconds(.01f));
        }
        else
        {
            deadselect = true;
            while (true)
            {
                cont = false;
                if (BMMulti.GetYou(1).Name == "" && BMMulti.GetYou(2).Name == "")
                {
                    BMMulti.MPlayerPick(1).transform.FindChild("MenuMother").gameObject.GetComponent <MUpMenu>().SetMenu(MUpMenu.curMenu.mon);
                    BMMulti.MPlayerPick(2).transform.FindChild("MenuMother").gameObject.GetComponent <MUpMenu>().SetMenu(MUpMenu.curMenu.mon);
                    //if (BMMulti.GetYou(1).Name != "" && BMMulti.GetYou(2).Name!="") break;
                    yield return(new WaitForEndOfFrame());
                }
                else if (BMMulti.GetYou(1).Name == "")
                {
                    BMMulti.MPlayerPick(2).transform.FindChild("MenuMother").gameObject.GetComponent <MUpMenu>().SetMenu(MUpMenu.curMenu.none);
                    BMMulti.MPlayerPick(1).transform.FindChild("MenuMother").gameObject.GetComponent <MUpMenu>().SetMenu(MUpMenu.curMenu.mon);
                    if (BMMulti.GetYou(1).Name != "")
                    {
                        break;
                    }
                    yield return(new WaitForEndOfFrame());
                }
                else if (BMMulti.GetYou(2).Name == "")
                {
                    BMMulti.MPlayerPick(1).transform.FindChild("MenuMother").gameObject.GetComponent <MUpMenu>().SetMenu(MUpMenu.curMenu.none);
                    BMMulti.MPlayerPick(2).transform.FindChild("MenuMother").gameObject.GetComponent <MUpMenu>().SetMenu(MUpMenu.curMenu.mon);
                    if (BMMulti.GetYou(2).Name != "")
                    {
                        break;
                    }
                    yield return(new WaitForEndOfFrame());
                }
            }
            BMMulti.MPlayerPick(1).transform.FindChild("MenuMother").gameObject.GetComponent <MUpMenu>().SetMenu(MUpMenu.curMenu.none);
            BMMulti.MPlayerPick(2).transform.FindChild("MenuMother").gameObject.GetComponent <MUpMenu>().SetMenu(MUpMenu.curMenu.none);
            cont = true;
            yield return(new WaitForSeconds(.01f));
        }
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        buttons.SetActive(BattleMain3.TurnGet());

        if (Input.GetKeyDown(KeyCode.Space))
        {
            UpMenu.SetMenu(UpMenu.curMenu.item);
        }


        if (BattleMain3.TurnGet() || UpMenu.upnow != UpMenu.curMenu.none)
        {
            if (Input.touchCount == 1 && onehit)
            {
                // touch on screen
                if (Input.GetTouch(0).phase == TouchPhase.Began)
                {
                    Ray        ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
                    RaycastHit hit = new RaycastHit();
                    moving = Physics.Raycast(ray, out hit);
                    if (moving)
                    {
                        go = hit.transform.gameObject;
                    }
                    else
                    {
                        onehit = false;
                    }
                }


                // release touch/dragging
                if ((Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(0).phase == TouchPhase.Canceled || Input.touchCount != 1) && go != null && onehit)
                {
                    Ray        ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
                    RaycastHit hit = new RaycastHit();
                    moving = Physics.Raycast(ray, out hit);
                    if (moving)
                    {
                        go2 = hit.transform.gameObject;
                    }
                    moving = false;
                    //Debug.Log("Touch Released from : " + go.name);
                    if (go == atk && go == go2)
                    {
                        //atk menu appears
                        UpMenu.SetMenu(UpMenu.curMenu.atk);
                    }
                    else if (go == chng && go == go2)
                    {
                        //active player1.moninvmenu appears
                        UpMenu.SetMenu(UpMenu.curMenu.mon);
                    }
                    else if (go == itm && go == go2)
                    {
                        //iteminvmenu appears
                        UpMenu.SetMenu(UpMenu.curMenu.item);
                    }
                    else if (go == esc && go == go2)
                    {
                        //50/50 shot at escaping
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        //StartCoroutine("CoDoTurn", TurnType.esc);
                        BattleMain3.InitTurn(BattleMain3.TurnType.esc);
                    }

                    if (go == movebuttons[0] && go2 == go)
                    {
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        BattleMain3.SetMove(BattleMain3.GetYou().moves[0]);
                        BattleMain3.InitTurn(BattleMain3.TurnType.attack);
                    }
                    else if (go == movebuttons[1] && go2 == go)
                    {
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        BattleMain3.SetMove(BattleMain3.GetYou().moves[1]);
                        BattleMain3.InitTurn(BattleMain3.TurnType.attack);
                    }
                    else if (go == movebuttons[2] && go2 == go)
                    {
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        BattleMain3.SetMove(BattleMain3.GetYou().moves[2]);
                        BattleMain3.InitTurn(BattleMain3.TurnType.attack);
                    }

                    if (go == monbuttons[0] && go2 == go)
                    {
                        BattleMain3.SetNewMon(monbuttons[0].GetComponent <InvSlot>().curMonster);
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        if (!TheQueue.deadselect)
                        {
                            BattleMain3.InitTurn(BattleMain3.TurnType.change);
                        }
                        else
                        {
                            BattleMain3.SetYou(monbuttons[0].GetComponent <InvSlot>().curMonster);
                            BattleMain3.SetNewMon(new Monster.SubMonster());
                            BattleMain3.UpHealth();
                            TheQueue.AddQueue("You've changed to " + BattleMain3.GetYou().Name + "!");
                            TheQueue.deadselect = false;
                            TheQueue.curdead    = false;
                        }
                    }
                    else if (go == monbuttons[1] && go2 == go)
                    {
                        BattleMain3.SetNewMon(monbuttons[1].GetComponent <InvSlot>().curMonster);
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        if (!TheQueue.deadselect)
                        {
                            BattleMain3.InitTurn(BattleMain3.TurnType.change);
                        }
                        else
                        {
                            BattleMain3.SetYou(monbuttons[1].GetComponent <InvSlot>().curMonster);
                            BattleMain3.SetNewMon(new Monster.SubMonster());
                            BattleMain3.UpHealth();
                            TheQueue.AddQueue("You've changed to " + BattleMain3.GetYou().Name + "!");
                            TheQueue.deadselect = false;
                            TheQueue.curdead    = false;
                        }
                    }
                    else if (go == monbuttons[2] && go2 == go)
                    {
                        BattleMain3.SetNewMon(monbuttons[2].GetComponent <InvSlot>().curMonster);
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        if (!TheQueue.deadselect)
                        {
                            BattleMain3.InitTurn(BattleMain3.TurnType.change);
                        }
                        else
                        {
                            BattleMain3.SetYou(monbuttons[2].GetComponent <InvSlot>().curMonster);
                            BattleMain3.SetNewMon(new Monster.SubMonster());
                            BattleMain3.UpHealth();
                            TheQueue.AddQueue("You've changed to " + BattleMain3.GetYou().Name + "!");
                            TheQueue.deadselect = false;
                            TheQueue.curdead    = false;
                        }
                    }


                    if (go == itembuttons[0] && go2 == go)
                    {
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        BattleMain3.SetItem(itembuttons[0].GetComponent <InvSlot>().curItem);
                        BattleMain3.Player1().iteminv.RemoveFromStack(itembuttons[0].GetComponent <InvSlot>().curItem);
                        BattleMain3.InitTurn(BattleMain3.TurnType.item);
                    }
                    else if (go == itembuttons[1] && go2 == go)
                    {
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        BattleMain3.SetItem(itembuttons[1].GetComponent <InvSlot>().curItem);
                        BattleMain3.Player1().iteminv.RemoveFromStack(itembuttons[1].GetComponent <InvSlot>().curItem);
                        BattleMain3.InitTurn(BattleMain3.TurnType.item);
                    }
                    else if (go == itembuttons[2] && go2 == go)
                    {
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        BattleMain3.SetItem(itembuttons[2].GetComponent <InvSlot>().curItem);
                        BattleMain3.Player1().iteminv.RemoveFromStack(itembuttons[2].GetComponent <InvSlot>().curItem);
                        BattleMain3.InitTurn(BattleMain3.TurnType.item);
                    }
                    else if (go == itembuttons[3] && go2 == go)
                    {
                        UpMenu.SetMenu(UpMenu.curMenu.none);
                        BattleMain3.SetItem(itembuttons[3].GetComponent <InvSlot>().curItem);
                        BattleMain3.Player1().iteminv.RemoveFromStack(itembuttons[3].GetComponent <InvSlot>().curItem);
                        BattleMain3.InitTurn(BattleMain3.TurnType.item);
                    }
                }
            }
            else
            {
                go     = null;
                go2    = null;
                onehit = true;
            }
        }
        else
        {
            go     = null;
            go2    = null;
            onehit = true;
        }
    }