Пример #1
0
    /// <summary>
    /// 在切换到战斗场景时调用
    /// </summary>
    /// <param name="names">战斗的角色名列表,Player1在前,Player2在后,人机对战只需要玩家的角色名</param>
    /// 作者:胡皓然
    public void StartFightScene(List <string> playerLeftHeroes, List <string> playerRightHeroes)
    {
        _playerLeft = new Player(1);
        _playerLeft.SetHeroAttr(XmlOperate.GetHeroInformation(playerLeftHeroes[0]), XmlOperate.GetHeroInformation(playerLeftHeroes[1]), XmlOperate.GetHeroInformation(playerLeftHeroes[2]));

        _playerRight = new Player(2);
        _playerRight.SetHeroAttr(XmlOperate.GetHeroInformation(playerRightHeroes[0]), XmlOperate.GetHeroInformation(playerRightHeroes[1]), XmlOperate.GetHeroInformation(playerRightHeroes[2]));

        ChangeScene("BattleScene-boat");
    }
Пример #2
0
 /// <summary>
 /// 根据角色数量随机设置角色
 /// </summary>
 public void SetRandHero()
 {
     if (_heroNum == 1)
     {
         _heroes[0] = XmlOperate.GetHeroInformation("JiXiaoke");
     }
     else if (_heroNum == 3)
     {
         _heroes[0] = XmlOperate.GetHeroInformation("JiXiaoke");
         _heroes[1] = XmlOperate.GetHeroInformation("JiXiaoke");
         _heroes[2] = XmlOperate.GetHeroInformation("JiXiaoke");
     }
 }
Пример #3
0
    public void OnClick()
    {
        // change the scene

        //return the chosed heroes' name
        List <string> list = sel.ReturnList();

        if (GameManager.GetInstance()._nowMode == GameManager.mode.computer)
        {
            Player player = new Player(1);
            player.SetHeroNum(GameManager.GetInstance()._heroesNum);
            if (GameManager.GetInstance()._heroesNum == 1)
            {
                player.SetHeroAttr(XmlOperate.GetHeroInformation(list[0]));
            }
            else if (GameManager.GetInstance()._heroesNum == 3)
            {
                player.SetHeroAttr(XmlOperate.GetHeroInformation(list[0]), XmlOperate.GetHeroInformation(list[1]), XmlOperate.GetHeroInformation(list[2]));
            }
            Player computer = new Player(2);
            computer.SetHeroNum(GameManager.GetInstance()._heroesNum);
            computer.SetRandHero();
            GameManager.GetInstance().SetPlayers(player, computer);
            GameManager.GetInstance()._controlPlayer = 1;
            GameManager.GetInstance().ChangeScene("UserSetScene");
        }
        else if (GameManager.GetInstance()._nowMode == GameManager.mode.player)
        {
            Player player = new Player(GameManager.GetInstance()._controlPlayer);
            player.SetHeroNum(GameManager.GetInstance()._heroesNum);
            if (GameManager.GetInstance()._heroesNum == 1)
            {
                player.SetHeroAttr(XmlOperate.GetHeroInformation(list[0]));
                //通知联网部分英雄选择
            }
            else if (GameManager.GetInstance()._heroesNum == 3)
            {
                player.SetHeroAttr(XmlOperate.GetHeroInformation(list[0]), XmlOperate.GetHeroInformation(list[1]), XmlOperate.GetHeroInformation(list[2]));
                //通知联网部分英雄选择
            }
            GameManager.GetInstance().ChangeScene("WaitScene");
        }
    }
Пример #4
0
 void Awake()
 {
     GetComponent <Hero>()._attr = XmlOperate.GetHeroInformation("JiXiaoke");
 }