Exemplo n.º 1
0
        /// <summary>
        /// 初始化玩家
        /// </summary>
        public void InitPlayer()
        {
            var asset = ResourceManager.LoadAsset("PlayerBatterys6");
            var go    = Instantiate(asset);

            go.transform.parent        = PondTs;
            go.transform.localPosition = Vector3.zero;
            PlayersBatterys            = go.GetComponent <PlayerBatterys>();
            Defines.NumPlayer          = PlayersBatterys.Count;
        }
Exemplo n.º 2
0
        void Awake()
        {
            HitProcessor.AddFunc_Odd(Func_GetFishOddAddtiveForDieRatio, null);
            PlayersBatterys            = GameMain.Singleton.PlayersBatterys;
            mPrefabNeedGatherFishCache = new Dictionary <int, int>();
            for (int i = 0; i != Prefab_GatherFishAry.Length; ++i)
            {
                mPrefabNeedGatherFishCache.Add(Prefab_GatherFishAry[i].TypeIndex, i);
            }

            //创建PersistentData
            if (PlayerGatheredFishRecs == null)
            {
                PlayerGatheredFishRecs = new PersistentData <uint, uint> [Defines.MaxNumPlayer];
                for (int i = 0; i != Defines.MaxNumPlayer; ++i)
                {
                    PlayerGatheredFishRecs[i] = new PersistentData <uint, uint>("PlayerGatheredFishRecs" + i.ToString());
                }
            }
            if (PlayerGatheredScore == null)
            {
                PlayerGatheredScore = new PersistentData <int, int> [Defines.MaxNumPlayer];
                for (int i = 0; i != Defines.MaxNumPlayer; ++i)
                {
                    PlayerGatheredScore[i] = new PersistentData <int, int>("PlayerGatheredScore" + i.ToString());
                }
            }
            //创建 PlayerGatheredFish
            PlayerGatheredFish = new Dictionary <int, object> [Defines.MaxNumPlayer];


            //由PlayerGatheredFishRec得出字典PlayerGatheredFish
            for (int playerIdx = 0; playerIdx != Defines.MaxNumPlayer; ++playerIdx)
            {
                PlayerGatheredFish[playerIdx] = new Dictionary <int, object>();

                for (int gIdx = 0; gIdx != Prefab_GatherFishAry.Length; ++gIdx)//收集索引
                {
                    if (((PlayerGatheredFishRecs[playerIdx].Val >> gIdx) & 1) == 1)
                    {
                        PlayerGatheredFish[playerIdx].Add(gIdx, null);
                        //_tmpAddViewAniFish(gIdx, Players[playerIdx];
                    }
                }
            }
        }