Ejemplo n.º 1
0
 // 初始化鱼的参数.
 public void InitFishParam(NavPath _nav, int _fishServerID, SingleShadow _ss, int _fishPool)
 {
     // 变大.
     iTween.ScaleTo(gameObject, localScale, 1f);
     // 这条鱼所对应的影子.
     singleShadow = _ss;
     // 鱼的id.
     fishServerID = _fishServerID;
     // 鱼所在的池,方便同类炸弹使用.
     fishPool = _fishPool;
     // 初始化路径.
     navigation.init(cur_Transform, _nav);
     if (fishType == FishType.likui)
     {
         multi = LikuiBeginBeilv;
     }
 }
Ejemplo n.º 2
0
        private void CreateFishAndShadow(FishParam _fp)
        {
            // 检测是否需要旋转屏幕,如果需要,则鱼的生成位置也需要更换并且旋转
            if (CanonCtrl.Instance.turn_screen == true && CanonCtrl.Instance.turn_screen_on_of)
            {
                FishCache = FishCacheTurn;
            }
            else
            {
                FishCache = FishCacheNoTurn;
            }

            int _fishPool = _fp.fishPool;

            // fish.
            Transform _fish = Factory.Create(fish[_fishPool].fish, Vector3.zero, Quaternion.identity);

            _fish.parent        = FishCache;
            _fish.localPosition = Vector3.zero;
            _fish.rotation      = Quaternion.identity;
            _fish.localScale    = Vector3.zero;
            SingleFish _sf = _fish.GetComponent <SingleFish>();

            // shadow.
            Transform _shadow = Factory.Create(fish[_fishPool].shadow, Vector3.zero, Quaternion.identity);

            _shadow.parent        = FishCache;
            _shadow.localPosition = Vector3.zero;
            _shadow.localScale    = Vector3.zero;
            _shadow.rotation      = Quaternion.identity;
            SingleShadow _ss = _shadow.GetComponent <SingleShadow>();

            // 给fish和shadow的路径赋时间.
            _fp.navPath._time = _fp.pathTimeLength;
            _sf.InitFishParam(_fp.navPath, _fp.serverID, _ss, _fishPool);
            _ss.InitShadowParam(_fp.navPath);

            // 缓存该鱼.
            fishHaveCreated.Add(_sf);
            shadowHaveCreated.Add(_ss);
        }