Esempio n. 1
0
        public static void CreateMainEmitter()
        {
            EmitterManager.RemoveEmitter(MainEmitter_);
            MainEmitter_ = EmitterManager.AddEmitter(new BulletCircleEmitter("MainBullet")
            {
                Master           = PlayerManager.Master,
                Team             = CombatTeam.A,
                TriggerCount     = -1,
                EmittedCountAttr = new EmitterRandInt((int)GetBulletCount()),
                Interval         = GetBulletInterval(),
                IsAlive          = true,
                IsPause          = false,
                Position         = Configure.CoreTopPosition,
                RadiusAttr       = new EmitterRandFloat(0),
                SpeedAttr        = new EmitterRandFloat(1000, 2000),
                DamageAttr       = new EmitterRandFloat(GetBulletDamage()),
                ResName          = "Red",
            }) as BulletCircleEmitter;

            EventHelper.RemoveAllEvent(GameObject.Find("Touch").transform, true);
            EventHelper.AddEvent(GameObject.Find("Touch").transform, () =>
            {
                var Target = FilterHelper.FindNearest(Master);
                if (Target != null)
                {
                    var Desc = new TrackBulletDescriptor(
                        new BaseBulletDescriptor("Touch", Configure.CoreTopPosition, CombatTeam.A, 5),
                        "Blue", Target, 1500);

                    BulletManager.AddTrackBullet(Desc);
                }
            });
        }
Esempio n. 2
0
        public BaseWave(uint Wave)
            : base($"Wave{Wave}")
        {
            this.Wave = Wave;

            Data     = LocalData.WaveList[Wave];
            Emitter_ = EmitterManager.AddEmitter(new NpcRectEmitter(Name)
            {
                Team             = CombatTeam.B,
                TriggerCount     = -1,                       //Data.TriggerCount,
                EmittedCountAttr = new EmitterRandInt(1, 5), //Data.EmitterCount,
                Interval         = 1f,                       //Data.Interval,
                IsAlive          = true,
                IsPause          = false,
                Position         = new Vector2(Configure.WindowLeft + 120, 0),
                SpeedAttr        = new EmitterRandFloat(Data.Speed * 0.8f, Data.Speed * 1.2f),
                HpAttr           = new EmitterRandFloat(Data.Hp),
                DamageAttr       = new EmitterRandFloat(Data.Damage),
                GemAttr          = new EmitterRandInt(Data.Gem),
                OffsetAttr       = new EmitterRandVector2(
                    new Vector2(-100, -Configure.WindowHeight / 2 + 100),
                    new Vector2(100, Configure.WindowHeight / 2 - 100)),
            });
            Emitter_.OnTrigger += (Count) => RemainingCount_ += Count;
            //Emitter_.AtOnce();

            EventManager.Register <NpcDieEvent>(OnNpcDieEvent);
        }
Esempio n. 3
0
        public static bool Startup()
        {
            if (!SfxManager.Startup())
            {
                return(false);
            }

            if (!LabelManager.Startup())
            {
                return(false);
            }

            if (!MapManager.Startup())
            {
                return(false);
            }

            if (!NpcManager.Startup())
            {
                return(false);
            }

            if (!BulletManager.Startup())
            {
                return(false);
            }

            if (!EmitterManager.Startup())
            {
                return(false);
            }

            if (!SkillManager.Startup())
            {
                return(false);
            }

            if (!BuffManager.Startup())
            {
                return(false);
            }

            if (!WaveManager.Startup())
            {
                return(false);
            }

            Calculator = new CombatCalculator();

            EventManager.Register <NpcIdleEvent>(OnCombatEvent);
            EventManager.Register <NpcWalkEvent>(OnCombatEvent);
            EventManager.Register <NpcSkillEvent>(OnCombatEvent);
            EventManager.Register <NpcDieEvent>(OnCombatEvent);
            EventManager.Register <NpcBackEvent>(OnCombatEvent);

            return(true);
        }
Esempio n. 4
0
 public static void Tick(float DeltaTime)
 {
     SfxManager.Tick(DeltaTime);
     LabelManager.Tick(DeltaTime);
     MapManager.Tick(DeltaTime);
     NpcManager.Tick(DeltaTime);
     BulletManager.Tick(DeltaTime);
     EmitterManager.Tick(DeltaTime);
     SkillManager.Tick(DeltaTime);
     BuffManager.Tick(DeltaTime);
     WaveManager.Tick(DeltaTime);
 }
Esempio n. 5
0
    public void LoadEmitters(PolygonStage stage)
    {
        int i = 0;

        //load emitters and emitterManagers, dont forget to handle emitter repeat and delay ! (stored in PolygonStage)
        foreach (var emitter in stage.emitters)
        {
            emitter.life = 4000 + i++ *700;
            EmitterManager em = new EmitterManager();
            em.LoadEmitter(emitter);
            emitters.Add(em);
        }
    }
Esempio n. 6
0
        public static void Shutdown()
        {
            EventManager.UnRegister <NpcIdleEvent>(OnCombatEvent);
            EventManager.UnRegister <NpcWalkEvent>(OnCombatEvent);
            EventManager.UnRegister <NpcSkillEvent>(OnCombatEvent);
            EventManager.UnRegister <NpcDieEvent>(OnCombatEvent);
            EventManager.UnRegister <NpcBackEvent>(OnCombatEvent);

            WaveManager.Shutdown();
            BuffManager.Shutdown();
            SkillManager.Shutdown();
            EmitterManager.Shutdown();
            BulletManager.Shutdown();
            NpcManager.Shutdown();
            MapManager.Shutdown();
            LabelManager.Shutdown();
            SfxManager.Shutdown();
        }
Esempio n. 7
0
 public override bool Execute(SkillArgs Args)
 {
     EmitterManager.AddEmitter(new NpcCircleEmitter(Args.Skill.Name)
     {
         Team             = CombatTeam.B,
         TriggerCount     = 1,
         EmittedCountAttr = new EmitterRandInt(100),
         Interval         = 1.0f / 60.0f,
         IsAlive          = true,
         IsPause          = false,
         Position         = new Vector2(Configure.WindowLeft + 200, 0),
         RadiusAttr       = new EmitterRandFloat(10, 200),
         SpeedAttr        = new EmitterRandFloat(80, 180),
         HpAttr           = new EmitterRandFloat(1, 5),
         DamageAttr       = new EmitterRandFloat(1, 1),
         GemAttr          = new EmitterRandInt(1, 1),
     });
     return(true);
 }
Esempio n. 8
0
 public override bool Execute(SkillArgs Args)
 {
     EmitterManager.AddEmitter(new BulletCircleEmitter(Args.Skill.Name)
     {
         Master           = PlayerManager.Master,
         Team             = CombatTeam.A,
         TriggerCount     = 10,
         EmittedCountAttr = new EmitterRandInt(100),
         Interval         = 30.0f / 60.0f,
         IsAlive          = true,
         IsPause          = false,
         Position         = Configure.CoreTopPosition,
         RadiusAttr       = new EmitterRandFloat(0, 0),
         SpeedAttr        = new EmitterRandFloat(1000, 2000),
         DamageAttr       = new EmitterRandFloat(3, 5),
         ResName          = "Blue",
     });
     return(true);
 }
Esempio n. 9
0
    public override void OnStay()
    {
        if (!_completed)
        {
            timeCount += GameManager.DeltaTime;
            if (timeCount > Delay)
            {
                Transform     parent = null;
                BarrageConfig bCfg   = BarrageConfig.GetData(BarrageId);
                var           bullet = ResourceManager.Load <GameObject>(PathManager.GetBulletPath("Bullet_" + BulletId));
                switch (TargetPosType)
                {
                case TargetPos.敌人位置:
                    parent = TargetTrans;
                    break;

                case TargetPos.固定位置:
                    break;

                case TargetPos.敌人X轴位置:
                    _pos.x = TargetTrans.position.x;
                    _pos.y = Offest.y;
                    break;
                }
                if (m_Owner == GameManager.Player)
                {
                    _emitterManager = ShootManager.Instance.Shoot(parent, _pos, bullet, m_Owner.GetAttribute(E_Attribute.Atk.ToString()).GetTotalValue(), bCfg, GameConfig.Instance.EnemyLayer);
                }
                else
                {
                    _emitterManager = ShootManager.Instance.Shoot(parent, _pos, bullet, m_Owner.GetAttribute(E_Attribute.Atk.ToString()).GetTotalValue(), bCfg, GameConfig.Instance.PlayerLayer);
                }
                if (TargetPosType == TargetPos.敌人X轴位置)
                {
                    _emitterManager.OnUpdate += () =>
                    {
                        _pos.x = TargetTrans.position.x;
                        _pos.y = Offest.y;
                        _emitterManager.transform.position = _pos;
                    };
                }
                _completed = true;
            }
        }
        //if (!_enter)
        //{
        //    _enter = true;
        //Transform parent = null;
        //BarrageConfig bCfg = BarrageConfig.GetData(BarrageId);
        //var bullet = ResourceManager.Load<GameObject>(PathManager.GetBulletPath("Bullet_" + BulletId));
        //TimerManager.Instance.AddListener(Delay, () =>
        //{
        //    switch (TargetPosType)
        //    {
        //        case TargetPos.敌人位置:
        //            parent = TargetTrans;
        //            break;
        //        case TargetPos.固定位置:
        //            break;
        //        case TargetPos.敌人X轴位置:
        //            _pos.x = TargetTrans.position.x;
        //            _pos.y = Offest.y;
        //            break;
        //    }
        //    if (m_Owner==GameManager.Player)
        //    {
        //        _emitterManager = ShootManager.Instance.Shoot(parent, _pos, bullet, m_Owner.GetAttribute(E_Attribute.Atk.ToString()).GetTotalValue(), bCfg, GameConfig.Instance.EnemyLayer);
        //    }
        //    else
        //    {
        //        _emitterManager = ShootManager.Instance.Shoot(parent, _pos, bullet, m_Owner.GetAttribute(E_Attribute.Atk.ToString()).GetTotalValue(), bCfg, GameConfig.Instance.PlayerLayer);
        //    }
        //    if (TargetPosType==TargetPos.敌人X轴位置)
        //    {
        //        _emitterManager.OnUpdate += () =>
        //        {
        //            _pos.x = TargetTrans.position.x;
        //            _pos.y = Offest.y;
        //            _emitterManager.transform.position = _pos;
        //        };
        //    }
        //});
        //    }
    }
 // Use this for initialization
 void Start()
 {
     manager          = new EmitterManager();
     emitter.position = transform.position;
     manager.LoadEmitter(emitter);
 }