public void create(Vector3 position, Vector3 rotate, Vector3 scale, ObjectType object_type, ObjectColliderMaterial material = ObjectColliderMaterial.NONE) { ObjectCreatorFunctions.ObjectCreator(position, Quaternion.AngleAxis(rotate.z, new Vector3(0, 0, 1)), scale, object_type); }
public void create(Vector3 position, Vector3 rotate, Vector3 scale, ObjectType object_type, ObjectColliderMaterial material = ObjectColliderMaterial.NONE) { JSONObject jsonObject = new JSONObject(JSONObject.Type.OBJECT); jsonObject.AddField(POSITION_X, position.x); jsonObject.AddField(POSITION_Y, position.y); jsonObject.AddField(POSITION_Z, position.z); jsonObject.AddField(ROTATE_ANGLE, rotate.z); jsonObject.AddField(SCALE_X, scale.x); jsonObject.AddField(SCALE_Y, scale.y); jsonObject.AddField(SCALE_Z, scale.z); jsonObject.AddField(TYPE_OBJECT, object_type.ToString()); socket.Emit("newobject", jsonObject); }
public static void ObjectCreator(Vector3 position, Quaternion rotate, Vector3 scale, ObjectType object_type, ObjectColliderMaterial material = ObjectColliderMaterial.NONE, Action <GameObject> callback = null) { Debug.Log("ObjectCreator" + position.x); TaskSystem.getInstance().addTask( () => { Debug.Log("task_system" + position.x); GameObject game_object = ObjectPoolManager.getInstance().getPool(object_type.ToString()).getNewObject(); game_object.transform.position = position; game_object.transform.rotation = rotate; game_object.transform.localScale = scale; game_object.SetActive(true); switch (material) { case ObjectColliderMaterial.NONE: break; default: break; } if (callback != null) { callback(game_object); } }); }