void Shoot360() { if (!isFacingPlayer) { bulletSpawner.transform.LookAt(new Vector3(Player.transform.position.x, bulletSpawner.transform.position.y, Player.transform.position.z)); isFacingPlayer = true; } else if (isFacingPlayer) { fullCircleTimer += Time.deltaTime; if (fullCircleTimer < spinTime) { bulletSpawner.transform.Rotate(Vector3.up * Time.deltaTime * spinSpeed, Space.World); GameObject tmpObj = Instantiate(normalBulletPrefab, bulletSpawner.transform.position, bulletSpawner.transform.rotation); tmpObj.GetComponent <Rigidbody>().velocity = bulletSpawner.transform.forward * bulletSpeed; } else if (fullCircleTimer >= spinTime) { isFacingPlayer = false; fullCircleTimer = 0.0f; curState = BossCurrentState.SHOOTINGNORMAL; preState = curState; } } }
void SpawnSpiders() { if (GameObject.FindGameObjectsWithTag("Destroyable").Length <= 3) { Instantiate(spiderMinesPrefab, this.transform.position, Quaternion.identity); } else { preState = curState; curState = BossCurrentState.SHOOTINGNORMAL; } }
void ShootExplodingRadial() { bulletSpawner.transform.LookAt(new Vector3(Player.transform.position.x, bulletSpawner.transform.position.y, Player.transform.position.z)); GameObject tmpObj = Instantiate(explodingBulletPrefab, bulletSpawner.transform.position, bulletSpawner.transform.rotation); tmpObj.GetComponent <Rigidbody>().velocity = tmpObj.transform.forward * bulletSpeed; preState = curState; curState = BossCurrentState.SHOOTINGNORMAL; shootTimeNormal = 0.5f; }
void CheckGameStatus() { preState = curState; curState = BossCurrentState.SHOOTINGRADIAL; }
void checkCurrentHealth() { curGlobalTime += Time.deltaTime; float currentPercent = bossHealth / maxbossHealth * 100.0f; if (curState == BossCurrentState.IDLE) { preState = curState; curState = BossCurrentState.SHOOTINGNORMAL; } if (currentPercent >= 70 && curGlobalTime >= firstStageSwitchTime) { if (curState == BossCurrentState.SHOOTINGNORMAL) { preState = curState; curState = BossCurrentState.SHOOTINGRADIAL; shootTimeNormal = 0.5f; curGlobalTime = 0.0f; } else if (curState == BossCurrentState.SHOOTINGRADIAL) { preState = curState; curState = BossCurrentState.SHOOTINGNORMAL; shootTimeRadial = 0.5f; curGlobalTime = 0.0f; } else if (curState == BossCurrentState.SHOOTING360SHOT) { } } if (currentPercent < 70 && currentPercent >= 40) { curGlobalTime2 += Time.deltaTime; WallScript.Instance.curState = WallScript.StageState.STAGE2; GetComponent <NavMeshAgent>().speed = 3.0f; if (curGlobalTime >= secondStageSwitchTime) { preState = curState; curState = BossCurrentState.SHOOTINGEXPLODINGRADIAL; curGlobalTime = 0.0f; } if (curGlobalTime2 >= second2ndStageSwitchTime) { preState = curState; curState = BossCurrentState.SHOOTING360SHOT; curGlobalTime2 = 0.0f; } } if (currentPercent < 40 && currentPercent > 0) { curGlobalTime2 += Time.deltaTime; if (curGlobalTime2 >= secondStageSwitchTime) { preState = curState; curState = BossCurrentState.SHOOTINGEXPLODINGRADIAL; curGlobalTime2 = 0.0f; } if (curGlobalTime >= finalStageSwitchTime) { preState = curState; curState = BossCurrentState.SPAWNSPIDERS; curGlobalTime = 0.0f; } } if (currentPercent <= 0) { LoadScenes.Instance.afterGame(); GameManager.Instance.curState = CurrentGameState.GameWon; } }