Пример #1
0
        public void ReceiveEnemyDie(GamePlayer gamePlayer, params object[] objs)
        {
            int         id    = (int)objs[0];
            EnemyEntity enemy = EntityManager.Inst.GetEntity <EnemyEntity>(id);

            if (enemy != null)
            {
                enemy.OnDie();
            }
        }
Пример #2
0
 protected override void OnTriggerStay2D(Collider2D col)
 {
     if (!ignoreList.Contains(col))
     {
         tempEnemy = EntityManager.Inst.GetEntity <EnemyEntity>(col.gameObject);
         if (tempEnemy != null)
         {
             MessageManager.Inst.SendDamagePawn(tempEnemy.Id, cDamage);
             CameraController.Inst.Shake(4f, 0.3f, 3f, 0);
         }
         ignoreList.Add(col);
     }
     base.OnTriggerStay2D(col);
 }
 /// <summary>
 /// 开启协程生成敌人
 /// </summary>
 /// <param name="BuildByWave">每隔X秒生成一波敌人</param>
 /// <param name="EnemyCount">第X波生成敌人数目</param>
 /// <returns></returns>
 public IEnumerator BuildEnemyWaveByMusic(float[] BuildByWave, int[] EnemyCount)
 {
     for (int i = 0; i < BuildByWave.Length; i++)
     {
         for (int j = 0; j < EnemyCount[i]; i++)
         {
             Transform   buildPoint = buildPointsList[Random.Range(0, buildPointsList.Count)];
             EnemyEntity go         = EntityManager.Inst.CreateEnemy <EnemyEntity>(buildPoint.position, buildPoint.forward);
             go.RefreshModel("Enemey");
             //不知道模型上是否有脚本EnemyEntity?
             yield return(new WaitForSeconds(BuildWaitTime));
         }
         yield return(new WaitForSeconds(BuildByWave[i]));
     }
 }