Skip to content

Commit

Permalink
Adding externalPosition and a setter to set the objectToSpawn from an…
Browse files Browse the repository at this point in the history
…other script
  • Loading branch information
reneabreu committed Nov 4, 2018
1 parent 8bd62b3 commit eeceaf1
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ public class UltimateSpawner : MonoBehaviour {
// Target
public Transform targetTransform;

// External
public Vector3 externalPosition;

#endregion

#region Rotation Setup
Expand Down Expand Up @@ -578,6 +581,10 @@ void OnDrawGizmos() {
} // End Y for
} // End X for
}

else if (spawnAt == SpawnAt.ExternalPosition) {
Gizmos.DrawIcon(externalPosition, "UltimateSpawner/spawner_icon.png", true);
}

}

Expand Down Expand Up @@ -655,6 +662,9 @@ Vector3 GetSpawnPosition() {
return spawnPosition;
}

else if (spawnAt == SpawnAt.ExternalPosition)
return externalPosition;

#if UNITY_EDITOR
UltimateLog("Something went wrong and the position is null", "ERROR");
#endif
Expand Down Expand Up @@ -850,6 +860,14 @@ void ShowUltimateSpawnerSetUp() {
}
#endif

public void SetObjectToSpawn(GameObject newObjectToSpawn) {
objectToSpawn = newObjectToSpawn;
}

public void SetExternalPosition(Vector3 extPos) {
externalPosition = extPos;
}

#endregion

#region UltimateSpawner Events
Expand All @@ -873,7 +891,8 @@ public enum SpawnAt {
Spawner,
SpawnPoint,
Position,
TargetTransform
TargetTransform,
ExternalPosition
}

public enum SpawnRotation {
Expand Down

0 comments on commit eeceaf1

Please sign in to comment.