private void SelectNextTarget() { if (targetStation != null) { homeStation = targetStation; } SNKSpaceStation temp = homeStation; while (temp == homeStation) { temp = stationSpawner.GetRandomStation(); } targetStation = temp; }
public void StartMoving(SNKSpaceStation home) { speed = 3f; rigid = GetComponent <Rigidbody2D>(); stationSpawner = FindObjectOfType <SNKSpaceStationSpawner>(); if (homeStation != null) { homeStation.ShipCount--; } homeStation = home; SelectNextTarget(); StartCoroutine(WaitThenMove()); }
private void GoHome() { targetStation = homeStation; MoveToTarget(); }