فهرست منبع

Animation: add removeEvent function

lviguier 1 سال پیش
والد
کامیت
43c6c9506c
1فایلهای تغییر یافته به همراه9 افزوده شده و 0 حذف شده
  1. 9 0
      h3d/anim/Animation.hx

+ 9 - 0
h3d/anim/Animation.hx

@@ -102,6 +102,15 @@ class Animation {
 			events[frame].push(data);
 	}
 
+	public function removeEvent(frame : Int, data : String) {
+		if (events == null || events[frame] == null || !events[frame].contains(data))
+			throw 'Can\'t delete event $data because it doesn\'t exist at frame $frame';
+
+		events[frame].remove(data);
+		if (events[frame].length == 0)
+			events[frame] = null;
+	}
+
 	public function getEvents() return events;
 
 	public function getObjects() return objects;