Exemplo n.º 1
0
 void Start()
 {
     ShootPoint        = transform.GetChild(2);
     enemyPoolIns      = EnemyPool.enemysPoolInstance;
     selEventSystemIns = selEventSystem.EventIns;
     GMIns             = GameManager.gameManager_ins;
     //注册玩家死亡和胜利事件
     selEventSystemIns.EventplayerDeath.AddListener(PlayerDeath);
     selEventSystemIns.EventplayerWin.AddListener(PlayerWin);
 }
Exemplo n.º 2
0
 private void Awake()
 {
     //防止单例销毁脚本放在SceneContol
     gameManager_ins = this;
     //获取对象池
     enemy_ins = EnemyPool.enemysPoolInstance;
     //事件机制
     eventIns    = selEventSystem.EventIns;
     Enviroments = new GameObject[5];
     //初始化关卡怪物
     for (int i = 0; i <= 4; i++)
     {
         Enviroments[i] = Resources.Load <GameObject>("Prefab/E/" + (i + 1).ToString());
     }
     EnemyBornCount = bornPoints.Length;
     //I初始化
     finalCanvas   = GameObject.Find("FinalCanvas(Clone)");
     winPanel      = finalCanvas.transform.Find("winPanel").gameObject;
     losePanel     = finalCanvas.transform.Find("losePanel").gameObject;
     countDownAnim = finalCanvas.transform.Find("CountDownWarnPanel").GetComponent <Animator>();
     //胜利后的分数特效
     showScores = finalCanvas.transform.Find("winPanel/showScores").GetComponent <Text>();
     for (int i = 0; i < 3; i++)
     {
         starts[i] = winPanel.transform.Find(i.ToString()).gameObject;
     }
     UICanvas = GameObject.Find("UICanvas(Clone)");
     //初始化level
     levelText = UICanvas.transform.Find("levelText").GetComponent <Text>();
     //初始化倒计时
     countDown = UICanvas.transform.Find("countDown").GetComponent <Text>();
     //计分的面板
     scoresText = UICanvas.transform.Find("Scores").GetComponent <Text>();
     //声音
     gameOverAudio = Resources.Load <AudioClip>("Sound/game_over");
     warningAudio  = Resources.Load <AudioClip>("Sound/Warning");
     //添加事件
     eventIns.EventRetryBtn.AddListener(ResetStars);
     eventIns.EventplayerDeath.AddListener(LoseLevel);
     eventIns.EventHomeBtn.AddListener(ResetStars);
 }
Exemplo n.º 3
0
 void Awake()
 {
     EventIns = this;
 }