IEnumerator PreTurnAIExcute() { foreach (var AI in AIs) { GChess chess = AI.actor as GChess; if (chess.unableAct) { continue; } curAI = AI.gameObject; AI.Visit(); var t = UIManager.instance.CreateFloorHUD(AI.actor.location, Color.yellow); yield return(1f); Destroy(t); AI.PerformMove(); yield return(null);//移动完成后继续执行 AI.PrepareSkill(); yield return(null);//准备完成后继续执行 } IEnumerator spawnCor = enemySpawn.SpawnEnemy(); while (spawnCor.MoveNext()) { yield return(spawnCor.Current); } GameManager.instance.AIPreTurnEnd(); }
public void CheckCondition() { if (Pickupbles.Count <= 0) { SpawnManyItems(); EnemySpawnManager.SpawnEnemy(); } }
public void SpawnEnemy(TypeEnemy typeEnemy) { EnemyController controller; EnemyModel model; EnemyView view; int numPrefab = Convert.ToInt32(typeEnemy); _enemySpawnManager.SpawnEnemy(_enemyDatas[numPrefab], _enemyPrefabs[numPrefab], _fieldBoundary, out controller, out model, out view); controller.Destroy += DestroyEnemy; _controllerModelPairs.Add(controller, model); _viewModelPairs.Add(view, model); _enemyModels.Add(model); }
public override void OnInspectorGUI() { targetObject = target as EnemySpawnManager; if (UnityEditor.EditorApplication.isPlaying) { GUILayout.Space(10); GUILayout.Label("Control buttons"); if (GUILayout.Button("Try spawn enemy")) { targetObject.SpawnEnemy(); } if (GUILayout.Button("Spawn enemy (ignore requirements)")) { targetObject.SpawnEnemy(true); } if (GUILayout.Button("Kill all enemies")) { targetObject.KillAllEnemies(); } GUILayout.Space(20); } base.OnInspectorGUI(); }
void Update() { if (spawning) { for (int i = 0; i < spawnPoints.Count; ++i) { if (spawnPoints[i].delay <= 0) { manager.SpawnEnemy(spawnPoints[i]); Destroy(spawnPoints[i]); spawnPoints.RemoveAt(i); } else { spawnPoints[i].delay -= Time.deltaTime; } } } }
public override bool UpdateEvent() { Debug.Log("update spawnEvent"); for (int i = 0; i < spawnPoints.Count; ++i) { if (spawnPoints[i].delay <= 0 && !spawnPoints[i].done) { CapsuleController aux = manager.SpawnEnemy(spawnPoints[i]).GetComponent <CapsuleController>(); turrets.capsules.Add(aux); spawnPoints[i].done = true; spawnPoints[i].delay = spawnPoints[i].initialDelay; //Destroy(spawnPoints[i]); //spawnPoints.RemoveAt(i); } else { spawnPoints[i].delay -= Time.deltaTime; } } return(base.UpdateEvent()); }
private void Update() { if (Input.GetKeyDown(KeyCode.R)) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); Debug.Log("Reload"); return; } if (EnemyCountText == null) { return; } DoItemEffects(); DamageImage.color = m_damaged ? FlashColor : Color.Lerp(DamageImage.color, Color.clear, FlashSpeed * Time.deltaTime); m_damaged = false; if (m_myHealthManager.IsDead) { EnemyCountText.text = "YOU LOSE!"; return; } if (!m_bOnLadder && TouchingLadder && Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S)) { MountLadder(); } if (TouchingChest && Input.GetKeyDown(KeyCode.F)) { Chest chestScript = TouchedChest.GetComponent <Chest>(); int chestCost = chestScript.Price; if (CoinHandler.CollectedCoins < chestCost || chestScript.Used) { Debug.Log("Ei pysty"); } else { CoinHandler.CollectedCoins -= chestCost; chestScript.Used = true; chestScript.ChestInfo.text = ""; var item = ItemBaseItem.Spawn(transform.position, 1); Debug.Log("Ostit chestin ", item); } } if (TouchingItem) { AddItem(TouchedItem.GetComponent <Item>().Id); Destroy(TouchedItem); TouchingItem = false; TouchedItem = null; } int iCount = GameObject.FindGameObjectsWithTag("Enemy").Count(enemy => !enemy.GetComponent <HealthManager>().IsDead); if (iCount != 0) { EnemyCountText.text = m_bossActive ? "KILL THE FINAL BOSS!" : (iCount != 1 ? iCount + " enemies alive" : iCount + " enemy alive"); } else { EnemyCountText.text = "YOU WIN!\nPress R to Restart"; } if (iCount != 0 || m_bossActive) { return; } GameObject boss = SpawnManager.SpawnEnemy(new Vector3(-35f, 0f)); HealthManager bossHpManager = boss.GetComponent <HealthManager>(); Enemy bossEnemy = boss.GetComponent <Enemy>(); bossHpManager.Health = bossHpManager.MaxHealth *= 10; bossEnemy.Acceleration = 300f; bossEnemy.AttackDistance = 2f; bossEnemy.DamagePerSwing *= 2; bossEnemy.VisionDistance *= 2f; boss.transform.localScale *= 2f; m_bossActive = true; }
void RpcDoSpawn(Vector3 _pos, Quaternion _rot) { spawnManager.SpawnEnemy(_pos, _rot); }
protected void SpawnEnemyType(EnemyType type) { int index = (int)UnityEngine.Random.Range(0, reusableSpawnPoints.Count - 1); manager.SpawnEnemy(reusableSpawnPoints[index], type, this); }