IEnumerator WaitForRequest(WWW www) { yield return(www); // check for errors if (www.error == null) { Debug.Log("WWW Ok! - result: " + www.data); GameList = new List <GameClass>(); string[] games = www.data.Split('\n'); foreach (string game in games) { string[] game_data = game.Split(';'); if (game_data.Length == 3) { //Debug.Log("Game between:Home " + game_data[0] + " and " + game_data[1] + " margin is " + game_data[2]); GameClass tempgame = new GameClass(game_data[0], game_data[1], int.Parse(game_data[2])); GameList.Add(tempgame); } } MainPlane mainplane = (MainPlane)GameObject.Find("PlaneMain").GetComponent <MainPlane>(); mainplane.addGames(GameList); } else { Debug.Log("WWW Error: " + www.error); } }
private IEnumerator Step() { yield return(new WaitForSeconds(2)); currentPlane = Instantiate(mainPlane, mainPlane.transform.position, Quaternion.identity); currentPlane.OnDeadEvent += OnMainPlaneDead; }
private void Init() { mainPlane = Resources.Load <MainPlane>("Prefabs/Plane"); //boss = Resources.Load<GameObject>("Prefabs/Enemys/Boss"); data = Resources.Load <PlayerData>("PlayerData"); maxScore = data.maxScore; }
void Init() { mainPlane = Resources.Load <MainPlane>("Prefabs/MainPlane"); bossPlane = Resources.Load <Boss>("Prefabs/Boss"); date = Resources.Load <PlayerData>("PlayerData"); maxScore = date.maxScore; }
private IEnumerator RebornPlayer() { yield return(new WaitForSeconds(2)); CurrentAirPlane = Instantiate(mainPlane, mainPlane.transform.position, Quaternion.identity); GameManager.Instance.Player = CurrentAirPlane; CurrentAirPlane.OnDeadEvent += OnMainPlaneDead; }
private IEnumerator Decorate() { //几时生成 yield return(new WaitForSeconds(2)); //生成什么 CurrentPlane = Instantiate(mainPlane, mainPlane.transform.position, Quaternion.identity); CurrentPlane.OnDeadEvent += OnMainPlaneDead; }
void OnCollisionEnter2D(Collision2D other) { MainPlane player = other.collider.GetComponent <MainPlane>(); if (player != null) { player.ChangeHealth(hurt); Debug.Log("player health" + player.health); } Destroy(gameObject); }
private void Update() { trans.Translate(Vector3.left * Time.deltaTime * speed); MonsterBullet(); if (LevelDirector.Instance.currentPlane == null) { return; } mainPlane = LevelDirector.Instance.currentPlane; Fire(); }
private void Init() { mainPlane = Resources.Load <MainPlane>("Prefab/MainPlane"); mainEnemy = Resources.Load <MainEnemy>("Prefab/Enemys/Enemy"); bossPlane = Resources.Load <MainBoss>("Prefab/Enemys/Boss"); tankPrefab = Resources.Load <TankEnemy>("Prefab/Enemys/Tank"); dataVolume = Resources.Load <GameData>("GameData"); data = Resources.Load <PlayerData>("PlayerData"); maxScore = data.maxScore; }
void OnTriggerEnter2D(Collider2D other) { MainPlane controller = other.GetComponent <MainPlane>(); if (controller != null) { if (controller.firelevel < 7) { controller.firelevel++; } controller.PlaySound(collectedClip); Destroy(gameObject); } }
private IEnumerator Decorate() { yield return(new WaitForSeconds(2)); CurrentAirPlane = Instantiate(mainPlane, mainPlane.transform.position, Quaternion.identity); Instantiate(mainEnemy, mainEnemy.transform.position, Quaternion.identity); GameManager.Instance.Player = CurrentAirPlane; CurrentAirPlane.OnDeadEvent += OnMainPlaneDead; yield return(new WaitForSeconds(10)); Instantiate(tankPrefab, tankPrefab.transform.position, Quaternion.identity); yield return(new WaitForSeconds(10)); Instantiate(bossPlane, bossPlane.transform.position, Quaternion.identity); }
void Update() { minX = ScreenXY.MinX - 1; Move(); if (LevelDirector.Instance.currentPlane == null) { return; } mainplane = LevelDirector.Instance.currentPlane; fireTimer += Time.deltaTime; if (fireTimer > rateTimer) { Fire(); fireTimer = 0; } BarrelRotate(); }
private void Update() { Move(); if (GameManager.Instance.Player == null) { return; } mainPlane = GameManager.Instance.Player; fireTimer += Time.deltaTime; if (fireTimer > fireRate) { Fire(); fireTimer = 0f; } BarrelRotate(); }
private void Awake() { mainPlane = GetComponent <MainPlane>(); }