Пример #1
0
        static public BLBulletManager Instance()
        {
            if (instance == null)
            {
                instance = new BLBulletManager();
            }

            return(instance);
        }
Пример #2
0
        // 实际攻击逻辑
        public override void DoAttack(BLUnitBase attack_target_unit)
        {
            if (attack_cool_down <= 0)
            {
                my_unit.DoAttack(attack_target_unit, false);


                BulletComponent bullet = BLBulletManager.Instance().CreateBullet();
                bullet.bullet_speed = my_unit.bullet_speed;
                bullet.Start(my_unit.position, attack_target_unit.position, HitCallBack);

                // 换算成攻击间隔是多少帧
                attack_cool_down = (int)(my_unit.attack_speed / BLTimelineController.MS_PER_FRAME);
            }
        }
Пример #3
0
        public void DoMainLogic(int elapsed_frame)
        {
            while (elapsed_frame > 0)
            {
                --elapsed_frame;

                //pre_logic_frame_time_stamp = current_logic_frame * MS_PER_FRAME * 0.001f;
                pre_logic_frame_time_stamp     = current_logic_frame_time_stamp;
                current_logic_frame_time_stamp = total_time_elapsed;

                BattleVisionControl.Instance().Tick();

                // 有指令的话,分发指令
                BLCommandManager.Instance().Tick(current_logic_frame);

                BLUnitManager.Instance().Tick();

                BLBulletManager.Instance().Tick();

                ++current_logic_frame;

                //current_logic_frame_time_stamp = current_logic_frame * MS_PER_FRAME * 0.001f;
            }
        }