Exemplo n.º 1
0
    void OnCommand(object data)
    {
        if (menuAnim.IsPlaying())
        {
            return;
        }

        int idx = (int)data;

        switch (idx)
        {
        case 0:
            warCtrl.SetFrontArmyRun(WarSceneController.WhichSide.Right);
            break;

        case 1:
            warCtrl.SetFrontArmyBack(WarSceneController.WhichSide.Right);
            break;

        case 2:
            warCtrl.SetArmyDisperse();
            break;

        case 3:
            warCtrl.SetArmyFallIn();
            break;

        case 4:
            warCtrl.SetArmyIdle();
            break;

        case 5:
            isAssaultFlag = true;
            warCtrl.SetArmyAssault(WarSceneController.WhichSide.Right);
            break;

        case 6:
            magic.SetActive(true);
            menuAnim.SetAnim(MenuDisplayAnim.AnimType.OutToRight);
            return;

        //break;
        case 7:
            warCtrl.SetGeneralAssault(WarSceneController.WhichSide.Right);
            break;

        case 8:
            warCtrl.SetArmyEscape(WarSceneController.WhichSide.Right);

            for (int i = 0; i < commands.Length; i++)
            {
                commands[i].SetButtonEnable(false);
            }
            break;
        }

        OnReturn();
    }
Exemplo n.º 2
0
    void OnIdleHandle()
    {
        if (!head.IsPlaying("Idle"))
        {
            head.Play("Idle");
            body.Play("Idle");
            horse.Play("Idle");
        }

        if (WarSceneController.state == WarSceneController.State.Running)
        {
            if (side == WarSceneController.WhichSide.Left)
            {
                timeTick += Time.deltaTime;
                if (timeTick >= leftGeneralIdleTime)
                {
                    timeTick = 0;
                    if (!armyAssaultFlag)
                    {
                        armyAssaultFlag = true;

                        GeneralInfo rGCtrl = Informations.Instance.GetGeneralInfo(WarSceneController.rightGeneralIdx);
                        if (gInfo.healthCur < 20 && gInfo.soldierCur + gInfo.knightCur < 10 &&
                            (rGCtrl.healthCur > 50 ||
                             rGCtrl.soldierCur + rGCtrl.knightCur > 10) &&
                            warCtrl.rightGeneral.GetState() != State.Escape)
                        {
                            warCtrl.SetArmyEscape(WarSceneController.WhichSide.Left);
                            return;
                        }

                        leftGeneralIdleTime = Random.Range(2, 10);
                        if (gInfo.soldierCur + gInfo.knightCur > 0)
                        {
                            warCtrl.SetArmyAssault(WarSceneController.WhichSide.Left);
                        }
                    }
                    else
                    {
                        SetRun();
                    }
                }
            }
        }
    }