// Use this for initialization void Start() { moveSpeed = waveConfig.GetMoveSpeed(); waypoints = waveConfig.GetWaypoints(); transform.position = waypoints[waypointIndex].transform.position; }
// Start is called before the first frame update void Start() { waveWaypoints = waveConfig.GetWaypoints(); transform.position = waveWaypoints[0].transform.position; waveMoveSpeed = waveConfig.GetMoveSpeed(); }
private void Move() { if (targetPoint <= wayPoints.Count - 1) { transform.position = Vector3.MoveTowards(transform.position, wayPoints[targetPoint].transform.position, waveConfig.GetMoveSpeed() * Time.deltaTime); if (transform.position == wayPoints[targetPoint].transform.position) { targetPoint++; } } else { Destroy(gameObject); } }
private void Move() { if (wayPoints.Count < 1) { return; } if (wayPointIndex <= wayPoints.Count - 1) { var targetPosition = wayPoints[wayPointIndex].transform.position; transform.position = Vector2.MoveTowards(transform.position, targetPosition, waveConfig.GetMoveSpeed() * Time.deltaTime); if (transform.position == targetPosition) { ++wayPointIndex; } } else { Destroy(gameObject); } }
private void Move() { if (waypointIndex <= waypoints.Count - 1) { var targetPosition = waypoints[waypointIndex].transform.position; var tmp = Vector2.MoveTowards(transform.position, targetPosition, waveConfig.GetMoveSpeed() * Time.deltaTime); transform.position = tmp; // Debug.Log((transform.position == targetPosition) + " -> current: " + transform.position.z + " target: " + targetPosition.z); if (transform.position == targetPosition) { waypointIndex++; } } else { Destroy(gameObject); } }
private void Move() { if (!waveConfig) { return; } if (waypointIndex < waypoints.Count) { if (transform.position == waypoints[waypointIndex].transform.position) { waypointIndex++; } else { transform.position = Vector2.MoveTowards(transform.position, waypoints[waypointIndex].transform.position, waveConfig.GetMoveSpeed() * Time.deltaTime); } } else { Destroy(gameObject); } }
public void SetWaveConfig(WaveConfig waveConfig) { this.waveConfig = waveConfig; moveSpeed = waveConfig.GetMoveSpeed(); }
private void Move() { if (PathLoopPlayingAfterWaveLoop) { if (pathLoopIndex <= (movementLoop.Count - 1)) { pathPoints = movementLoop[pathLoopIndex].GetPathPoints(); if (pathPointIndex <= (pathPoints.Count - 1)) { var targetPosition = pathPoints[pathPointIndex].transform.position; var movementThisFrame = movementLoop[pathLoopIndex].GetPathMoveSpeed() * Time.deltaTime; transform.position = Vector2.MoveTowards(transform.position, targetPosition, movementThisFrame); if (transform.position == targetPosition) { Special_Movement_for_Boss_peanut(); pathPointIndex++; } } else { //SettingPathPointIndex to 0 loops the animation if (IncreaseIndexByOne) { if (pathPointIndex > pathPoints.Count - 1) { pathPointIndex = 0; pathLoopIndex++; } } else if (playSecondPathLoop) { pathLoopIndex = 0; pathPointIndex = 0; playSecondPathLoop = false; } else { pathPointIndex = 0; } } } else { pathLoopIndex = 0; pathPointIndex = 0; } } else if (!PathLoopPlayingAfterWaveLoop) { if (waypointIndex <= waypoints.Count - 1) { var targetPosition = waypoints[waypointIndex].transform.position; var movementThisFrame = waveConfig.GetMoveSpeed() * Time.deltaTime; transform.position = Vector2.MoveTowards(transform.position, targetPosition, movementThisFrame); if (transform.position == targetPosition) { waypointIndex++; } } else if (DestroyEndWLoop) { Destroy(gameObject); gameSession.AddDestroyEnemies(); } else { PathLoopPlayingAfterWaveLoop = true; } } else { Debug.Log("Check enemy Pathing script. Else option triggered. No code."); } }
private void Start() { _waypoints = _waveConfig.GetWayPoints(); transform.position = _waypoints[_waypointIndex].transform.position; _enemySpeed = _waveConfig.GetMoveSpeed(); }
private void Move() { if (waveConfig == null) { return; } if (waypointIndex <= waypoints.Count - 1) { var targetPosition = waypoints[waypointIndex].transform.position; transform.position = Vector2.MoveTowards(transform.position, targetPosition, waveConfig.GetMoveSpeed() * Time.deltaTime); if ((transform.position - targetPosition).sqrMagnitude < waypointsThreshold) { waypointIndex++; } } else { Destroy(gameObject, 0.1f); } }
private void Initailize() { waypoints = waveConfig.GetWaypoints(); transform.position = waypoints[waypointIndex].transform.position; moveSpeed = waveConfig.GetMoveSpeed(); }
// Update is called once per frame void Update() { enemyMovementSpeed = waveConfig.GetMoveSpeed() * Time.deltaTime; MovementPattern(); }
private IEnumerator SpawnAllEnemiesInWave(WaveConfig wc) { GameObject enemyPrefab = wc.GetEnemy(); enemyPrefab.GetComponent <Enemy>() .SetEnemyParams(wc.GetHP(), wc.GetMinFireRate(), wc.GetMaxFireRate(), wc.GetWayPoint(), wc.GetMoveSpeed()); for (int i = 0; i < wc.GetEnemyCount(); i++) { GameObject enemy = Instantiate(enemyPrefab, enemyPrefab.transform.position, Quaternion.identity); yield return(new WaitForSeconds(wc.GetSpawnTime())); } }
void Start() { waypoints = waveConfig.GetWaypoints(); moveSpeed = waveConfig.GetMoveSpeed(); }