private void SpawnEnemy(EnemyAsset asset) { EnemyView view = Object.Instantiate(asset.ViewPrefab); Vector3 startNodePosition = m_Grid.GetStartNode().Position; Vector3 viewSpawnPosition = new Vector3(startNodePosition.x, view.transform.position.y, startNodePosition.z); view.transform.position = viewSpawnPosition; EnemyData data = new EnemyData(asset); data.AttachView(view); view.CreateMovementAgent(m_Grid); Game.Player.EnemySpawned(data); }
private void SpawnEnemy(EnemyAsset asset) { EnemyView view = Object.Instantiate(asset.ViewPrefab); Vector3 newPos = m_Grid.GetStartNode().Position; var transform = view.transform; Vector3 oldPos = transform.position; transform.position = new Vector3(newPos.x, oldPos.y, newPos.z); EnemyData data = new EnemyData(asset); data.AttachView(view); view.CreateMovementAgent(m_Grid); Game.Player.EnemySpawned(data); }