Oops, we need to be able to add and remove observers.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3831 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-02-04 03:30:44 +00:00
parent 428afd4ca0
commit 12a4f4bb7e
2 changed files with 21 additions and 3 deletions
@@ -119,6 +119,22 @@ public class CameraHandler
return (_camera.getLocation().z - _minZ) / (_maxZ - _minZ); return (_camera.getLocation().z - _minZ) / (_maxZ - _minZ);
} }
/**
* Adds a camera path observer.
*/
public void addCameraObserver (CameraPath.Observer camobs)
{
_campathobs.add(camobs);
}
/**
* Removes a camera path observer.
*/
public void removeCameraObserver (CameraPath.Observer camobs)
{
_campathobs.remove(camobs);
}
/** /**
* Starts the camera moving along a path which will be updated every tick * Starts the camera moving along a path which will be updated every tick
* until it is complete. * until it is complete.
@@ -328,8 +344,7 @@ public class CameraHandler
_path = path; _path = path;
} }
public boolean apply (Object observer) { public boolean apply (Object observer) {
((CameraPath.Observer)observer).pathCompleted(_path); return ((CameraPath.Observer)observer).pathCompleted(_path);
return true;
} }
protected CameraPath _path; protected CameraPath _path;
} }
@@ -36,8 +36,11 @@ public abstract class CameraPath
* path was set before this path completed). * path was set before this path completed).
* *
* @param path the path that was completed. * @param path the path that was completed.
*
* @return true if the observer should remain in the list, false if it
* should be removed following this notification.
*/ */
public void pathCompleted (CameraPath path); public boolean pathCompleted (CameraPath path);
} }
/** /**