예제 #1
0
 public OnObjectMovedEventArgs(GameObject o, Vector3 newpos, Vector3 oldpos, Vector3 newrot, Vector3 oldrot)
 {
     obj = o;
     NewPos = newpos;
     OldPos = oldpos;
     NewRot = newrot;
     OldRot = oldrot;
 }
예제 #2
0
 public OnObjectCreatedEventArgs(GameObject o)
 {
     obj = o;
 }
예제 #3
0
 internal static bool RemoveObject(GameObject v)
 {
     if (v == null) return false;
     if (OnObjectDestroyed != null) OnObjectDestroyed(null, new OnObjectCreatedEventArgs(v));
     lock (Objects)
     {
         for (int i = 0; i < Objects.Count(); i++)
         {
             if (Objects[i] == null) continue;
             if (Objects[i]== v) { Samp.Util.Log.Debug("Removing Object."); Objects[i] = null; return true; }
         }
     }
     return false;
 }
예제 #4
0
 public static GameObject[] GetObjectsInArea(Vector3 wpos, float distance)
 {
     // todo: interior? virtulworld?
     List<GameObject> objs = new List<GameObject>();
     lock (GameObject.Objects)
     {
         for (int i = 0; i < GameObject.Objects.Length; i++)
         {
             if (GameObject.Objects[i] == null) continue;
             Vector3 opos = GameObject.Objects[i].Pos;
             Util.Log.Debug("objdist: " + wpos.Distance(opos));
             if (wpos.Distance(opos) > 20.0F) continue;
             objs.Add(GameObject.Objects[i]);
         }
     }
     GameObject[] retobjs = new GameObject[objs.Count()];
     for (int i=0;i<objs.Count();i++)
     {
         retobjs[i] = objs[i];
     }
     return retobjs;
 }
예제 #5
0
 public static void DestroyObject(GameObject obj)
 {
     if (GameObject.RemoveObject(obj)) NativeFunctionRequestor.RequestFunctionWithArgs("DestroyObject", "i", obj.ID);
 }
예제 #6
0
 public void AttachObject(GameObject obj,Vector3 offset, Vector3 rot)
 {
     NativeFunctionRequestor.RequestFunctionWithArgs("AttachObjectToPlayer", "iiffffff", obj.ID, ID, offset.X, offset.Y, offset.Z, rot.X, rot.Y, rot.Z);
 }