Beispiel #1
0
        public void OnNewObject(SocketIOEvent e)
        {
            JSONObject obj = e.data;

            Debug.Log(obj.ToString());
            ObjectType type       = (ObjectType)Enum.Parse(typeof(ObjectType), obj.GetField(TYPE_OBJECT).str);
            float      position_x = obj.GetField(POSITION_X).f;
            //Debug.Log(position_x);
            float  position_y   = obj.GetField(POSITION_Y).f;
            float  position_z   = obj.GetField(POSITION_Z).f;
            float  rotate_angle = obj.GetField(ROTATE_ANGLE).f;
            float  scale_x      = obj.GetField(SCALE_X).f;
            float  scale_y      = obj.GetField(SCALE_Y).f;
            float  scale_z      = obj.GetField(SCALE_Z).f;
            string network_id   = obj.GetField(NETWORK_ID).str;

            //object_network_ids.Add(network_id,game)
            ObjectCreatorFunctions.ObjectCreator(new Vector3(position_x, position_y, position_z), Quaternion.AngleAxis(rotate_angle, new Vector3(0, 0, 1))
                                                 , new Vector3(scale_x, scale_y, scale_z), type, ObjectColliderMaterial.NONE,
                                                 (game_object) => {
                object_network_ids.Add(network_id, game_object);
            });
        }
Beispiel #2
0
 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);
 }