public void Load(long group_id_, GameRecycleContainer gun_, FlyItem fi_, Vector3 from_pos_, Vector3 to_pos_, float delay_)
            {
                group_id                 = group_id_;
                m_gun                    = gun_;
                m_cur_wave               = fi_;
                m_cur_wave_from_pos      = from_pos_;
                m_cur_wave_to_pos        = to_pos_;
                m_time_sum               = 0.0f - delay_;
                m_is_finished            = false;
                m_is_wait_for_first_fire = true;
#if TEST
                if (999 != group_id_)
                {
                    m_cur_wave.fly_count += 10;
                }
#endif
            }
Beispiel #2
0
 public void Release(FlyItem item)
 {
     queue.Enqueue(item);
     if (item == last)
     {
         var gui  = Game.Instance.GUI;
         var dest = origin + increase;
         if (type == 0)
         {
             gui.RollCoin(origin, dest);
         }
         else if (type == 1)
         {
             gui.RollScore(origin, dest);
         }
     }
 }
Beispiel #3
0
    public void Recycle(GameObject bulletObject)
    {
        FlyItem bullet = bulletObject.GetComponent <FlyItem>();

        if (null == bullet)
        {
            return;
        }


        if (!m_Pool.ContainsKey(bullet.WeaponClassName))
        {
            m_Pool.Add(bullet.WeaponClassName, new List <GameObject>());
        }

        m_Pool[bullet.WeaponClassName].Add(bulletObject);
        bullet.Death = true;
        bulletObject.transform.position = new Vector3(0, 100000000, 0);
    }
Beispiel #4
0
    public void Fly(int origin, int inc, int type = 0)
    {
        this.origin   = origin;
        this.increase = inc;
        this.type     = type;

        FlyNumberText(inc);

        var target = targets[type];
        var sprite = sprites[type];

        ManagerAudio.Instance.PlaySound("AddGold");
        var realCount = inc > 200 ? more : little;

        if (queue.Count < realCount)
        {
            return;
        }
        for (int i = 0; i < realCount; i++)
        {
            var item = queue.Dequeue();
            var img  = item.GetComponent <Image>();
            img.sprite = sprite;
            var size = Vector2.one * 60;
            if (type == 1)
            {
                size.x = 30;
                size.y = 61;
            }
            img.rectTransform.sizeDelta = size;

            item.StartEffect(i, target);
            if (i == realCount - 1)
            {
                last = item;
            }
        }
    }
        public override void OnShow(object param)
        {
            base.OnShow(param);

            m_prepare_fly_group_queue.Clear();


            if (null != param)
            {
                List <long> my_param = param as List <long>;
                this.m_scan_id = my_param[0];
            }
            else
            {
                m_scan_id = CurViewLogic().Scan_id;
            }


            int            max      = 0;
            List <FlyItem> one_wave = new List <FlyItem>();

            foreach (var kvp in CurViewLogic().Cur_game_finded_clues)
            {
                FlyItem fi = new FlyItem()
                {
                    group_id  = kvp.Key,
                    fly_count = kvp.Value.Count,
                };

                one_wave.Add(fi);

                max = kvp.Value.Count > max ? kvp.Value.Count : max;
            }

            if (0 == one_wave.Count)
            {
                FlyVitIcon();
                return;
            }

            max *= CurViewLogic().Cur_game_finded_clues.Keys.Count;

            m_prepare_fly_group_queue.Enqueue(one_wave);


#if TEST
            max += 10;
#endif

            if (CurViewLogic().Win)
            {
                one_wave = new List <FlyItem>();

                FlyItem fi = new FlyItem()
                {
                    group_id  = 999,
                    fly_count = 1,
                };

                one_wave.Add(fi);

                m_prepare_fly_group_queue.Enqueue(one_wave);

                m_special_effect_grid.EnsureSize <FlySpecialVitEffectItemView>(1);
            }


            m_normal_effect_grid.EnsureSize <FlyNromalVitEffectItemView>(max + 3);
#if MULTI_SHAKE
            m_normal_shake_effect_grid.EnsureSize <ShakeVitEffectItemView>(max + 3);
#endif
            m_num_grid.EnsureSize <FlyNumItemView>(max);
            m_shooters.Clear();

            TimeModule.Instance.SetTimeInterval(UpdateFlyEffect, C_FLY_INTERVAL_TIME);

            FlyEffect();
        }
 public void Unload()
 {
     m_cur_wave = null;
 }