Esempio n. 1
0
        /// <summary>
        /// Server only: initialize SyncList length with team size once.
        /// Also verifies the team fill for each team in case of host migration.
        /// </summary>
        public override void OnStartServer()
        {
            //should execute only on the initial master
            if (size.Count != teams.Length)
            {
                for (int i = 0; i < teams.Length; i++)
                {
                    size.Add(0);
                    score.Add(0);
                    killCount.Add(0);
                    deathCount.Add(0);
                    ItemCount.Add(0);
                    names.Add("Bot");
                }
            }

            //update team fill in UI
            StartCoroutine(OnHostMigration());
            StartCoroutine(RespawnCoroutine());
        }
Esempio n. 2
0
    // Sets all inventory slots to -1 (as 0 is an item).
    void Start()
    {
        _weapon           = -1;
        _ability          = -1;
        _armour           = -1;
        _ring             = -1;
        _weapon           = new StaffTest().GetId();
        _ability          = new ScrollTest().GetId();
        _database         = GameObject.FindGameObjectWithTag("ItemDatabase").GetComponent <ItemDatabase>();
        _inventoryHandler = GetComponent <InventoryHandler>();
        for (int i = 0; i < _inventorySize; i++)
        {
            _inventory.Add(-1);
        }

        _inventory [0] = new ArmourTest().GetId();
        _inventory [1] = new SwordTest().GetId();
        _inventory [2] = new PotionTest().GetId();
        _inventory [3] = new ScrollTest().GetId();
    }
Esempio n. 3
0
    private IEnumerator GetQuestionNrAsync()
    {
        var countTask = ParseObject.GetQuery("Quiz").CountAsync();

        while (!countTask.IsCompleted)
        {
            yield return(null);
        }
        int anz = countTask.Result;

        int [] questions = new int[anz < 15 ? anz : 15];
        FillWithRandomUniqueNumbers(questions, anz);

        if (questionsSynced.Count > 0)
        {
            questionsSynced.Clear();
        }
        for (int i = 0; i < questions.Length; i++)
        {
            questionsSynced.Add(questions[i]);
        }
    }
    private float[] randSum(int n, int m, string type)
    {
        float sum = 0;

        float[] randNums = new float[n];

        for (int i = 0; (i < randNums.Length); i++)
        {
            //limit generated number to a 10% value from total cell sum
            randNums[i] = Utilities.RandomFloat(Mathf.RoundToInt((float)m / 10), m);
            sum        += randNums[i];
        }

        for (int i = 0; (i < randNums.Length); i++)
        {
            randNums[i] = randNums[i] / sum * m;
            int value = Mathf.RoundToInt(randNums[i]);
            //Debug.Log(randNums[i] + " " + randNums[i] / sum + " " + sum);

            switch (type)
            {
            case Vars.Player2:
                SocialRates.Add(value);
                CurrentSocialGlobal += value;
                break;

            case Vars.Player3:
                EnvironmentRates.Add(value);
                CurrentEnvironmentGlobal += value;
                break;

            case Vars.Player1:
                FinanceRates.Add(value);
                CurrentFinanceGlobal += value;
                break;
            }
        }
        return(randNums);
    }
Esempio n. 5
0
    public Texture2D black;     //黑棋子



    void Start()
    {
        for (int i = 0; i < 225; i++)
        {
            cs.Add(0);
        }

        LeftTop     = GameObject.Find("Main Camera/Plane/LeftTop");
        RightTop    = GameObject.Find("Main Camera/Plane/RightTop");
        LeftBottom  = GameObject.Find("Main Camera/Plane/LeftBottom");
        RightBottom = GameObject.Find("Main Camera/Plane/RightBottom");
        cam         = GameObject.Find("Main Camera").GetComponent <Camera>();

        //计算锚点位置
        LTPos = cam.WorldToScreenPoint(LeftTop.transform.position);
        RTPos = cam.WorldToScreenPoint(RightTop.transform.position);
        LBPos = cam.WorldToScreenPoint(LeftBottom.transform.position);
        RBPos = cam.WorldToScreenPoint(RightBottom.transform.position);

        chessPos   = new Vector2[15, 15];
        chessState = new int[15, 15];
        chessTurn  = turn.black;

        //计算网格宽度
        gridWidth  = (RTPos.x - LTPos.x) / 14;
        gridHeight = (LTPos.y - LBPos.y) / 14;
        minGridDis = gridWidth < gridHeight ? gridWidth : gridHeight;

        //计算落子点位置
        for (int i = 0; i < 15; i++)
        {
            for (int j = 0; j < 15; j++)
            {
                chessPos[i, j] = new Vector2(LBPos.x + gridWidth * i, LBPos.y + gridHeight * j);
            }
        }
    }
Esempio n. 6
0
    /// <summary>
    /// plays the ingredient card at the given index in the players hand.
    /// </summary>
    /// <param name="ind">Index of the ingredient card to play. </param>
    public void playIngrCard(int ind)
    {
        //Debug.Log (ind);
        //Debug.Log (ingCrds[ind]);
        //Debug.Log (GameObject.Find("Canvas/Panel Player HUD/Panel Ingredients/Button CRD1").GetComponent<Button> ().onClick.GetPersistentEventCount ());
        //check if selected card exists or that adding the card won't exceed the ingredient limit
        if (ingCrds.Count <= ind || (sandwich.Count + 1) >= maxIngredientsAllowed)
        {
            return;
        }

        sandwich.Add(ingCrds[ind]);
        ingCrds.RemoveAt(ind);

        string tmp = "";

        foreach (int i in sandwich)
        {
            tmp += i.ToString() + "|";
        }

        tmp = tmp.Substring(0, tmp.Length - 1);
        CmdPlayIngredient(tmp, UID);
    }
Esempio n. 7
0
    /// <summary>
    /// Finds nearby water tile to set as spawn tile and initializes port market
    /// </summary>
    public void InitializePort()
    {
        foreach (HexCoordinate hc in GetComponentInParent <HexTile>().Directions)
        {
            HexTile neighbor = GetComponentInParent <HexTile>().GetNeighbor(hc);

            if (neighbor && neighbor.IsWater)
            {
                SpawnTile = GetComponentInParent <HexTile>().GetNeighbor(hc);
                break;
            }
        }

        Market = new Cargo(Random.Range(0, 500), Random.Range(0, 500), Random.Range(0, 500), Random.Range(0, 500), Random.Range(0, 500));

        PortGold = Random.Range(5000, 20000);

        PortPrices.Clear();

        for (var i = 0; i < 5; i++)
        {
            PortPrices.Add(DefaultPortPrices[i] + Random.Range(-PortPriceMods[i], PortPriceMods[i]));
        }
    }
Esempio n. 8
0
    /// <summary>
    /// Generates a person with a normal distribution of traits.
    /// </summary>
    protected virtual void generatePerson()
    {
        int[] array        = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };  // indices of all traits
        int[] managerArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };          // indices of all restaurant manager traits
        int[] factoryArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };              // indices of all factory manager traits

        array        = scrambleArray(array);
        managerArray = scrambleArray(managerArray);
        factoryArray = scrambleArray(factoryArray);

        string[] names = System.IO.File.ReadAllLines(@"Assets\names\residentialSmallFirst.txt");
        residentName = names [rng.Next(names.Length - 1)]; // choose random name from file for the resident

        traits.Add(array[0]);                              // assign traits from the scrambled array of traits
        traits.Add(array [1]);
        traits.Add(array [2]);

        bossTraits.Add(managerArray [0]);          // assign manager traits
        bossTraits.Add(managerArray [1]);
        bossTraits.Add(managerArray [2]);

        factoryBossTraits.Add(factoryArray [0]);
        factoryBossTraits.Add(factoryArray [1]);
        factoryBossTraits.Add(factoryArray [2]);

        if (traits.Contains(2))           // 2 is the elderly trait. If they have it, use the old-looking portraits
        {
            int[] oldguys = { 4, 8, 13 };
            portrait = oldguys [(int)Random.Range(0, oldguys.Length)];
        }
        else             // use a young-looking portrait
        {
            int[] youngGuys = { 0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19 };
            portrait = youngGuys[(int)Random.Range(0, youngGuys.Length)];
        }
    }
Esempio n. 9
0
 public void addActivePlayer(int player)
 {
     activePlayers.Add(player);
     numActive += 1;
 }
Esempio n. 10
0
    void Awake()
    {
        _voiceManger = VoiceManager.Instance;
        foreach (var channel in _voiceManger.ActiveChannels)
        {
            if (channel.Channel.Name == _voiceManger.channelName)
            {
                _gameChannel = channel;
                break;
            }
        }
        RoomManager = GameObject.Find("NetworkRoomManager").GetComponent <NetworkRoomManagerWBTB>();

        hUD = GameObject.Find("NetworkRoomManager").GetComponent <NetworkManagerHUDWBTB>();
        int tmp = 0;

        foreach (string s in hUD.PlayerNameList_)
        {
            playerNameList[tmp] = s;
            tmp++;
        }
        //NetworkRoomPlayerWBTB[] _roomPlayer = new NetworkRoomPlayerWBTB[6];
        //int tmp = 0;
        //foreach (var p in GameObject.FindGameObjectsWithTag("PlayerList"))
        //{
        //    _roomPlayer[tmp] = p.GetComponent<NetworkRoomPlayerWBTB>();
        //    tmp++;
        //}
        //tmp = 0;
        //foreach (var p in _roomPlayer)
        //{
        //    playerNameList[tmp] = _roomPlayer[tmp].playerNameList[_roomPlayer[tmp].index];
        //    tmp++;
        //}

        MaxLandNum = 20;
        Turn       = 1;
        //if (isServer)
        //    RpcLog("--------------1턴------------");
        //    _voiceManger.SendTextMessage("--------------1턴------------", _gameChannel.Key);
        MilitaryPower = 0;
        LandNum       = 0;
        WhoTurn       = 0;

        Buildings = new BuildingStatus[MaxLandNum];

        for (int i = 0; i < Buildings.Length; i++)
        {
            Buildings[i] = GameObject.Find("Building (" + (i + 1).ToString() + ")").GetComponent <BuildingStatus>();
        }

        CP = GetComponent <ControlPanel>();
        MilitaryText.GetComponent <Text>().text  = MilitaryPower.ToString();
        TurnPointText.GetComponent <Text>().text = Turn.ToString();

        for (int i = 0; i < 6; i++)
        {
            vote.Add(6); // 0~5: Player1~6, 6: 투표기본, 7: Skip, 8: 투표안함
            invest.Add(0);
            waiting.Add(false);
            AlienDistribution.Add(false);
            ColorDistribution.Add(-1);
            TurnOrderDistribution.Add(-1);
        }

        DistributionAlien();
        DistributionColor();
        DistributionTurnOrder();

        hUD.alienDisList = AlienDistribution;
        hUD.colorDisList = ColorDistribution;
    }
Esempio n. 11
0
 public void CmdAddNewCatCard()
 {
     catCrds.Add(new Card(CardType.Category).ID);
     RpcAddNewCatCard();
 }
Esempio n. 12
0
 public void RegisterPlayerToScoreList()
 {
     scoreList.Add(0);
 }
 public void testlistCB(SyncListInt.Operation op, int idx)
 {
     testlist.Add(-1);
     print(testlist.Count);
 }
Esempio n. 14
0
    void CmdAddNumberToList(int number)
    {
        someList.Add(number);
//        RpcUpdateC();
    }
Esempio n. 15
0
    // Use this for initialization
    void Start()
    {
        if (isServer)
        {
            SyncData.worldSize = 1;
            size = SyncData.worldSize;
        }
        info = Resources.LoadAll("Biomes", typeof(Biome));
        foreach (UnityEngine.Object fileInfo in info)
        {
            Biome biome = (Biome)fileInfo;
            Biomes.Add(new BiomeList {
                BiomeItem = biome, BiomeIndex = biome.BiomeIndex
            });
        }
        Biomes.Sort();
        BiomesIndexes = Biomes;
        if (isServer)
        {
            foreach (UnityEngine.Object fileInfo in info)
            {
                Biome biome = (Biome)fileInfo;
                Biomes.Add(new BiomeList {
                    BiomeItem = biome, BiomeIndex = biome.BiomeIndex
                });
            }
            for (int i = 0; i < Biomes.Count; i++)
            {
                BiomesCompare[i] = Biomes[i].BiomeItem;
            }
            RandomizeBiome(BiomesCompare);
            for (int i = 0; i < BiomesCompare.Length; i++)
            {
                BiomesIndex.Add(BiomesCompare[i].BiomeIndex);
            }
        }
        if (isClient)
        {
            for (int i = 0; i < BiomesIndex.Count; i++)
            {
                BiomesCompare[i] = Biomes[BiomesIndex[i]].BiomeItem;
            }
        }
        if (isServer)
        {
            if (!SyncData.isCampaign)
            {
                bool hasActivated = false;
                for (int i = 0; i < SyncData.maps.Length; i++)
                {
                    if (SyncData.maps[i] == true)
                    {
                        hasActivated = true;
                    }
                }
                if (hasActivated)
                {
                    for (int i = 0; i < SyncData.maps.Length; i++)
                    {
                        if (SyncData.maps[i])
                        {
                            chunksEdit.Add(chunks[i]);
                        }
                    }
                }
            }
            else
            {
                chunksEdit.Clear();
                chunksEdit.Add(chunks[SyncData.chunkID]);
            }

            chunksFinal = chunksEdit.ToArray();

            if (chunksFinal.Length > 1)
            {
                RandomizeArray(chunksFinal);
            }

            if (size > chunksFinal.Length)
            {
                int inital = chunksFinal.Length - 1;
                Array.Resize(ref chunksFinal, size);
                int p = 0;
                int x = 0;
                for (int i = inital; i < chunksFinal.Length; i++)
                {
                    while (p == x)
                    {
                        x = UnityEngine.Random.Range(0, inital);
                    }
                    chunksFinal[i] = chunksFinal[x];
                    p = x;
                }
            }
            else if (chunksFinal.Length != size)
            {
                Array.Resize(ref chunksFinal, size);
            }

            for (int i = 0; i < chunksFinal.Length; i++)
            {
                currentPosition -= chunksFinal[i].GetComponent <ChunkData>().width;
            }
            startPos        = currentPosition;
            currentPosition = currentPosition / 2;

            for (int i = 0; i < chunksFinal.Length; i++)
            {
                GameObject chunk = Instantiate(chunksFinal[i], new Vector3(currentPosition, 0, 0), Quaternion.identity);
                currentPosition += chunk.GetComponent <ChunkData>().width;
                NetworkServer.Spawn(chunk);
            }
        }
        done = true;
    }
Esempio n. 16
0
    IEnumerator StartGame()
    {
        yield return(new WaitWhile(() => !IsPlayerReady()));

        /* AUTO 시 주석 해제
         * if (LobbyManager.s_Singleton.numPlayers == 1)
         * {
         *  for (int i = 0; i < 5; i++)
         *  {
         *      int j;
         *      if ((j = playerReady.IndexOf(i)) != -1)
         *      {
         *          players[i].GetComponent<PlayerControl>().enabled = false;
         *          foreach (Renderer r in players[i].GetComponentsInChildren<Renderer>()) r.enabled = false;
         *          foreach (Text t in players[i].GetComponentsInChildren<Text>()) t.enabled = false;
         *          bm.players[i] = null;
         *          playerReady[j] = -1;
         *      }
         *  }
         * }
         */

        // add AI players.
        if (playerReady.IndexOf(0) == -1)
        {
            var p1 = Instantiate(player, new Vector3(0f, 0f, 0f), Quaternion.identity);
            p1.GetComponent <PlayerControl>().SetAI(true);
            p1.GetComponent <PlayerControl>().playerName             = "Psychia";
            p1.GetComponent <PlayerControl>().color                  = new Color(0.816f, 0.216f, 0.059f);
            p1.GetComponent <NetworkIdentity>().localPlayerAuthority = false;
            NetworkServer.Spawn(p1);
            p1.GetComponent <PlayerControl>().RpcSetAI(true);
        }
        if (playerReady.IndexOf(1) == -1)
        {
            var p2 = Instantiate(player, new Vector3(3.236f, 0f, 2.351f), Quaternion.Euler(0f, -72f, 0f));
            p2.GetComponent <PlayerControl>().SetAI(true);
            p2.GetComponent <PlayerControl>().playerName             = "Xianzhe";
            p2.GetComponent <PlayerControl>().color                  = new Color(0.875f, 0.867f, 0.529f);
            p2.GetComponent <NetworkIdentity>().localPlayerAuthority = false;
            NetworkServer.Spawn(p2);
            p2.GetComponent <PlayerControl>().RpcSetAI(true);
        }
        if (playerReady.IndexOf(2) == -1)
        {
            var p3 = Instantiate(player, new Vector3(2f, 0f, 6.155f), Quaternion.Euler(0f, -144f, 0f));
            p3.GetComponent <PlayerControl>().SetAI(true);
            p3.GetComponent <PlayerControl>().playerName             = "Orion";
            p3.GetComponent <PlayerControl>().color                  = new Color(0.106f, 0.69f, 0.208f);
            p3.GetComponent <NetworkIdentity>().localPlayerAuthority = false;
            NetworkServer.Spawn(p3);
            p3.GetComponent <PlayerControl>().RpcSetAI(true);
        }
        if (playerReady.IndexOf(3) == -1)
        {
            var p4 = Instantiate(player, new Vector3(-2f, 0f, 6.155f), Quaternion.Euler(0f, 144f, 0f));
            p4.GetComponent <PlayerControl>().SetAI(true);
            p4.GetComponent <PlayerControl>().playerName             = "Libertas";
            p4.GetComponent <PlayerControl>().color                  = new Color(0.424f, 0.376f, 1f);
            p4.GetComponent <NetworkIdentity>().localPlayerAuthority = false;
            NetworkServer.Spawn(p4);
            p4.GetComponent <PlayerControl>().RpcSetAI(true);
        }
        if (playerReady.IndexOf(4) == -1)
        {
            var p5 = Instantiate(player, new Vector3(-3.236f, 0f, 2.351f), Quaternion.Euler(0f, 72f, 0f));
            p5.GetComponent <PlayerControl>().SetAI(true);
            p5.GetComponent <PlayerControl>().playerName             = "Lucifer";
            p5.GetComponent <PlayerControl>().color                  = new Color(0.369f, 0.106f, 0.427f);
            p5.GetComponent <NetworkIdentity>().localPlayerAuthority = false;
            NetworkServer.Spawn(p5);
            p5.GetComponent <PlayerControl>().RpcSetAI(true);
        }

        List <int> temp = RandomListGenerator(5);

        for (int i = 0; i < 5; i++)
        {
            playerPermutation.Add(temp[i]);
            // players[playerPermutation[n]]으로 n번 속성을 갖는 플레이어를 참조할 수 있다.
            // players[n].GetPlayerElement()로 n번째 플레이어의 속성을 참조할 수 있다.
        }

        temp = RandomListGenerator(5);
        for (int i = 0; i < 5; i++)
        {
            RpcPrintLog("Player" + i + "'s element is " + GetPlayerElement(i));
            isWin.Add(false);
            playerConfirmStat.Add(true);
            elementPermutation.Add(temp[i]);
        }

        for (int i = 0; i < 10; i++)
        {
            if (cardcode.Count <= i)
            {
                cardcode.Add(i);
            }
        }
        CardPermutation();

        long cv = 0;

        for (int i = 0; i < 10; i++)
        {
            cv += cardcode[i] * (long)(Mathf.Pow(10, 9 - i));
        }
        //RpcPrintLog("" + cv);
        RpcSetCardIndex(cv);

        yield return(new WaitForSeconds(5.4f));

        for (int i = 0; i < 10; i++)
        {
            cards[cardcode[i]].GetComponent <Card>().RpcMoveCard(100 + i);
        }
        turnPlayer = Random.Range(0, 5);

        // TODO 임시 코드
        string m = "cardcode";

        for (int i = 0; i < 10; i++)
        {
            m += " " + bm.GetCardCode()[i];
        }
        RpcPrintLog(m);

        yield return(new WaitForSeconds(3f));

        //RpcPrintLog("Battle starts.");
        //RpcPrintLog("turnStep 1(" + players[turnPlayer].GetName() + " turn starts)");

        turnStep = 13;  // 능력치 분배 먼저
    }
Esempio n. 17
0
    public override void OnStartClient()
    {
        base.OnStartClient();


        TurnText     = GameObject.Find("TurnText").GetComponent <Text>();
        PlayerArea   = GameObject.Find("PlayerArea");
        OpponentArea = GameObject.Find("OpponentArea");
        DropZone     = GameObject.Find("DropZone");
        endTurn      = GameObject.Find("endTurn");
        TurnTimer    = GameObject.Find("TurnTimer").GetComponent <Text>();
        Card1        = GameObject.Find("Card1");
        Card2        = GameObject.Find("Card2");
        Card3        = GameObject.Find("Card3");
        Card4        = GameObject.Find("Card4");
        Card5        = GameObject.Find("Card5");
        Card6        = GameObject.Find("Card6");
        Card7        = GameObject.Find("Card7");
        Card8        = GameObject.Find("Card8");
        Card9        = GameObject.Find("Card9");
        Card10       = GameObject.Find("Card10");
        Card11       = GameObject.Find("Card11");
        Card12       = GameObject.Find("Card12");
        Card13       = GameObject.Find("Card13");
        Card14       = GameObject.Find("Card14");
        Card15       = GameObject.Find("Card15");
        Card16       = GameObject.Find("Card16");
        Card17       = GameObject.Find("Card17");
        Card18       = GameObject.Find("Card18");
        Card19       = GameObject.Find("Card19");
        Card20       = GameObject.Find("Card20");
        Card21       = GameObject.Find("Card21");
        Card22       = GameObject.Find("Card22");
        Card23       = GameObject.Find("Card23");
        Card24       = GameObject.Find("Card24");
        Card25       = GameObject.Find("Card25");
        Card26       = GameObject.Find("Card26");
        Card27       = GameObject.Find("Card27");
        Card28       = GameObject.Find("Card28");
        Card29       = GameObject.Find("Card29");
        Card30       = GameObject.Find("Card30");
        Card31       = GameObject.Find("Card31");
        Card32       = GameObject.Find("Card32");
        Card33       = GameObject.Find("Card33");
        Card34       = GameObject.Find("Card34");
        Card35       = GameObject.Find("Card35");
        Card36       = GameObject.Find("Card36");
        Card37       = GameObject.Find("Card37");
        Card38       = GameObject.Find("Card38");
        Card39       = GameObject.Find("Card39");
        Card40       = GameObject.Find("Card40");
        Card41       = GameObject.Find("Card41");
        Card42       = GameObject.Find("Card42");
        Card43       = GameObject.Find("Card43");
        Card44       = GameObject.Find("Card44");
        Card45       = GameObject.Find("Card45");
        Card46       = GameObject.Find("Card46");
        Card47       = GameObject.Find("Card47");
        Card48       = GameObject.Find("Card48");
        Card49       = GameObject.Find("Card49");
        Card50       = GameObject.Find("Card50");
        Card51       = GameObject.Find("Card51");
        Card52       = GameObject.Find("Card52");
        Card53       = GameObject.Find("Card53");
        Card54       = GameObject.Find("Card54");
        for (int i = 1; i < 55; i++)
        {
            CardIds.Add(i);
        }
    }
Esempio n. 18
0
 // this increments lastPlayerId and adds an entry in the scoreboard array
 // this is called from a Command by the player, so it runs as server
 public void AddNewPlayer()
 {
     lastPlayerId++;
     players.Add(0);
 }
Esempio n. 19
0
    // Start is called before the first frame update
    void Start()
    {
        childCnt = transform.childCount;
        transform.SetParent(GameObject.Find("Furniture").transform, true);


        if (name.Contains("Clone"))
        {
            string[] split = name.Split('(');
            name = split[0];
        }
        textures = GameObject.Find("Furniture").GetComponent <FurnitureManager>().FurnitureTextures;


        if (isServer)
        {
            Debug.Log("Server Has SyncListTexture for" + gameObject.name);
            //자식 없는 경우
            if (childCnt == 0)
            {
                if (loadTextures.Length > 0)
                {
                    syncListTexture.Add(loadTextures[0]);
                    SetTexture(gameObject, syncListTexture[0]);
                }
                else
                {
                    syncListTexture.Add(-1);
                }
            }
            //자식 있는 경우
            else
            {
                //불러오기로 불러져 온 객체인 경우 loadTextures를 통해 추가
                if (loadTextures.Length > 0)
                {
                    for (int i = 0; i < childCnt; i++)
                    {
                        syncListTexture.Add(loadTextures[i]);
                        SetTexture(transform.GetChild(i).gameObject, syncListTexture[i]);
                    }
                }
                else
                {
                    for (int i = 0; i < childCnt; i++)
                    {
                        syncListTexture.Add(-1);
                    }
                }
            }
        }
        else
        {
            if (childCnt == 0)
            {
                SetTexture(gameObject, syncListTexture[0]);
            }
            else
            {
                for (int i = 0; i < syncListTexture.Count; i++)
                {
                    SetTexture(transform.GetChild(i).gameObject, syncListTexture[i]);
                }
            }
        }
        syncListTexture.Callback += MyCallBack;
    }
Esempio n. 20
0
	private void randomizeTombs()
	{
		int[] tombSizes;
		
		switch (collectorNum)
		{
		case 4:
			tombSizes = new int[] { 1, 1, 2, 2, 2, 3, 3, 3 };
			break;
		case 3:
			tombSizes = new int[] { 1, 1, 1, 2, 2, 2, 3, 3 };
			break;
		case 2:
			tombSizes = new int[] { 1, 1, 1, 1, 2, 2, 2, 2 };
			break;
		default:
			tombSizes = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 };
			break;
		}
		MixArray(tombSizes);
		finalTreeSizes = new SyncListInt();
		
		GameObject tombSpawnPoints = GameObject.FindGameObjectWithTag("TombsSpawnPoints");
		for (int i = 0; i < tombSpawnPoints.transform.childCount; ++i)
		{
			finalTreeSizes.Add(tombSizes[i]);
		}
	}
Esempio n. 21
0
        public override void OnStartServer()
        {
            base.OnStartServer();

            players.Add(999);  // add dummy 0th player to score list: this is just for debugging
        }
Esempio n. 22
0
 private void CmdTellServerIGotANewItem(int itemID)
 {
     listOfItemsID.Add(itemID);
 }