// Update is called once per frame void Update() { if (boss != null) { if (boss.GetComponent <AI>().getHealth() <= 0) { SceneManager.LoadScene("WinScene"); } } m_WaveText.text = "wave " + (m_CurrentWay + 1) + " / " + m_LevelManage.m_Levels.Count; if (mainGame.m_IsPause) { return; } if (m_Castle.getHealth() <= 0) { Debug.Log("gameover"); SceneManager.LoadScene("gameOver"); } m_BoatGenerate -= Time.deltaTime; generateEater(); Debug.Log("boat generate time: " + m_BoatGenerate); if (m_CurrentWay < m_LevelManage.m_Levels.Count - 1) { if (m_BoatGenerate <= 0) { generateBoat(); //generateAttackableBoat(); // update time if (m_LevelManage.m_Levels[m_CurrentWay].m_NumberOfBoat < 0) { m_LevelManage.m_Levels[m_CurrentWay].m_NumberOfBoat = 0; } m_LevelManage.m_Levels[m_CurrentWay].m_NumberOfBoat--; } if (m_LevelManage.m_Levels[m_CurrentWay].m_NumberOfBoat <= 0 && SpriteManage.m_RedEnemies.Count >= SpriteManage.DEFAULT_RED_ENEMY_SIZE && SpriteManage.m_Boats.Count >= SpriteManage.DEFAULT_BOAT_SIZE) { m_CurrentWay++; if (m_CurrentWay >= m_LevelManage.m_Levels.Count) { m_CurrentWay = 0; m_LevelManage = new LevelManage(); } else { m_BoatGenerate = m_LevelManage.m_Levels[m_CurrentWay].m_TimeBeweenBoat; //m_LevelManage.m_Levels[m_CurrentWay].updateTimeBetweenBoat(); } } } else { generateBoss(); } m_CurrentGenerateTreeTimeStep -= Time.deltaTime; m_ReoucesEaterGenerateTime -= Time.deltaTime; generateResouces(); }
void Start() { isbreakable = (this.tag == "Breakable"); if (isbreakable) { brickcount++; print(brickcount); } Timeshit = 0; levelmanager = GameObject.FindObjectOfType <LevelManage> (); }
void Start() { Debug.Assert(m_LeftWall && m_RightWall && m_TopWall && m_BottomWall); m_LevelManage = new LevelManage(); m_BoatGenerate = m_LevelManage.m_Levels[0].m_TimeBeweenBoat; m_CurrentWay = 0; m_CurrentGenerateTreeTimeStep = 3; m_IsPause = true; GameObject temp = GameObject.Find("castle"); m_Castle = temp.GetComponent <Castle>(); //GameObject boss = SpriteManage.CREATE_SPRITE(SpriteType.FINAL_BOSS); m_ReoucesEaterGenerateTime = DEFAULT_RESOURCE_EATER_TIME; }
void Start() { DeathTimer = 0.0f; isDead = false; GameObject.FindGameObjectWithTag("Dead").GetComponent <SpriteRenderer>().enabled = false; LM = FindObjectOfType <LevelManage> (); animator = GameObject.Find("ZombieAnim"); if (animator != null) { Debug.Log("Loaded Animator Body"); } headAnimator = GameObject.Find("HeadDead"); headMain = GameObject.Find("Head"); body = GameObject.Find("Zombie"); }