Пример #1
0
 public void Activate()
 {
     if (!active)
     {
         thisObj.SetActive(true);
         if (app.ActivePlayer.playerData.isInBattle)
         {
             bool found = false;
             foreach (Battle battleInstance in app.Game.battles)
             {
                 foreach (int userId in battleInstance.players)
                 {
                     if (app.ActivePlayer.id == userId)
                     {
                         battleInstance.home = app.ActivePlayer;
                         battleInstance.away = battleInstance.monster;
                         battle.Activate(battleInstance);
                         found = true;
                         break;
                     }
                 }
                 if (found)
                 {
                     break;
                 }
             }
         }
         else
         {
             GetSpaceEvent(testMap.GetSpace(app.ActivePlayer.playerData.space));
         }
         active = true;
     }
 }
Пример #2
0
    void InitPlayers()
    {
        playerModels = new PlayerModel[Game.players.Length];
        int i = 0;

        foreach (Player player in Game.players)
        {
            GameObject  newPlayer   = Instantiate(playerPrefab) as GameObject;
            PlayerModel playerModel = newPlayer.GetComponent <PlayerModel>();
            string      spaceId     = player.playerData.space;
            Space       space;
            if (spaceId != null && spaceId != "")
            {
                space = testMap.GetSpace(spaceId);
            }
            else
            {
                space = testMap.GetStart();
            }
            playerModel.Init(space, player.playerData);
            player.PlayerModel = playerModel;
            playerModels[i++]  = playerModel;
        }
    }